diff options
author | Joakim Reinert <mail@jreinert.com> | 2015-04-18 22:18:26 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2015-05-05 12:21:26 +0200 |
commit | e9a248f9e9ff9a5b816338a634a0ace1d4883471 (patch) | |
tree | 7c8e3d87c29820e8d2c99bb56868df0e559fb048 /application | |
parent | 01581b3db2b617a5cf12ef7cf363b982dfc91d7b (diff) |
Use require.js for javascript loading
Diffstat (limited to 'application')
-rw-r--r-- | application/helpers/filebin_helper.php | 24 | ||||
-rw-r--r-- | application/views/file/fragments/thumbnail.php | 2 | ||||
-rw-r--r-- | application/views/file/fragments/uploads_table.php | 1 | ||||
-rw-r--r-- | application/views/file/upload_history.php | 2 | ||||
-rw-r--r-- | application/views/footer.php | 5 | ||||
-rw-r--r-- | application/views/header.php | 4 |
6 files changed, 4 insertions, 34 deletions
diff --git a/application/helpers/filebin_helper.php b/application/helpers/filebin_helper.php index 7fd25d5f4..2ac061e79 100644 --- a/application/helpers/filebin_helper.php +++ b/application/helpers/filebin_helper.php @@ -135,30 +135,6 @@ 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); diff --git a/application/views/file/fragments/thumbnail.php b/application/views/file/fragments/thumbnail.php index 603832d44..d830a1bed 100644 --- a/application/views/file/fragments/thumbnail.php +++ b/application/views/file/fragments/thumbnail.php @@ -1,5 +1,3 @@ -<?php register_js_include("/data/js/jquery.colorbox.js"); ?> -<?php register_js_include("/data/js/jquery.lazyload.js"); ?> <!-- Comment markers background: http://stackoverflow.com/a/14776780/953022 --> <div class="container container-wide"> <div class="upload_thumbnails"><!-- diff --git a/application/views/file/fragments/uploads_table.php b/application/views/file/fragments/uploads_table.php index 142d19e91..6673f22a3 100644 --- a/application/views/file/fragments/uploads_table.php +++ b/application/views/file/fragments/uploads_table.php @@ -1,4 +1,3 @@ -<?php register_js_include("/data/js/jquery.tablesorter.min.js"); ?> <div class="table-responsive container-wide"> <p>Non-previewable file(s):</p> <table class="table table-striped tablesorter"> diff --git a/application/views/file/upload_history.php b/application/views/file/upload_history.php index 10afc53e9..1e7ecfa62 100644 --- a/application/views/file/upload_history.php +++ b/application/views/file/upload_history.php @@ -1,5 +1,3 @@ -<?php register_js_include("/data/js/jquery.tablesorter.min.js"); ?> -<?php register_js_include("/data/js/jquery.metadata.js"); ?> <?php include 'nav_history.php'; ?> <?php echo form_open("file/do_delete") ?> <div class="table-responsive"> diff --git a/application/views/footer.php b/application/views/footer.php index ae8d2e575..0797fa0df 100644 --- a/application/views/footer.php +++ b/application/views/footer.php @@ -24,10 +24,5 @@ if ($CI->config->item("environment") == "development" && property_exists($CI, "e echo $CI->email->print_debugger(); } ?> -<?php echo include_js("/data/js/jquery-2.0.3.min.js"); ?> -<?php echo include_js("/data/js/jquery-ui-1.10.3.custom.min.js"); ?> -<?php echo include_js("/data/js/bootstrap.min.js"); ?> -<?php echo include_js("/data/js/script.js"); ?> -<?php echo include_registered_js(); ?> </body> </html> diff --git a/application/views/header.php b/application/views/header.php index ab947bd45..27fdbb92f 100644 --- a/application/views/header.php +++ b/application/views/header.php @@ -26,6 +26,10 @@ if (is_cli_client() && !isset($force_full_html)) { echo '<link href="'.link_with_mtime("/data/local/favicon.png").'" rel="shortcut icon">'; } ?> + <script> + var require = { baseUrl: '/data/js' }; + </script> + <script data-main="main" src="/data/js/vendor/require.js"></script> </head> <body> |