summaryrefslogtreecommitdiffstats
path: root/application/helpers
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2013-05-23 17:55:12 +0200
committerFlorian Pritz <bluewind@xinu.at>2013-05-23 18:19:55 +0200
commitb7ff91d8e34e1d9f04ad0b153e94441efd312f78 (patch)
treef4f50a1615a102e08bbcc70b8332afb7fefad678 /application/helpers
parentd575e1bcb35dc228f3851fbf1f9d4a1de0bdecc4 (diff)
Rework javascript inclusion
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/helpers')
-rw-r--r--application/helpers/filebin_helper.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php
index 0063b6526..394d55ba5 100644
--- a/application/helpers/filebin_helper.php
+++ b/application/helpers/filebin_helper.php
@@ -234,6 +234,30 @@ function link_with_mtime($file)
return $link;
}
+function include_js($file)
+{
+ static $included = array();
+ if (in_array($file, $included) || $file === null) {
+ return "";
+ }
+ return "<script src=\"".link_with_mtime($file)."\"></script>\n";
+}
+
+// kind of hacky, but works well enough for now
+function register_js_include($file, $return = false)
+{
+ static $list = "";
+ $list .= include_js($file);
+ if ($return) {
+ return $list;
+ }
+}
+
+function include_registered_js()
+{
+ return register_js_include(null, true);
+}
+
function handle_etag($etag)
{
$etag = strtolower($etag);