about summary refs log tree commit diff stats
path: root/wiki/lib/exe/jquery.php
diff options
context:
space:
mode:
authorahriman <ahriman@falte.red>2018-12-03 19:22:25 -0500
committerahriman <ahriman@falte.red>2018-12-03 19:22:25 -0500
commit0ae8cbf5c0b1a198b963490985b7738392ebcb97 (patch)
treeb2c77ae72c6b717e2b97492065196ac5ffb2d9e2 /wiki/lib/exe/jquery.php
parentf57f6cc5a2d159f90168d292437dc4bd8cd7f934 (diff)
downloadsite-0ae8cbf5c0b1a198b963490985b7738392ebcb97.tar.gz
installed dokuwiki, added to navbar, updated news
Diffstat (limited to 'wiki/lib/exe/jquery.php')
-rw-r--r--wiki/lib/exe/jquery.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/wiki/lib/exe/jquery.php b/wiki/lib/exe/jquery.php
new file mode 100644
index 0000000..f32aef7
--- /dev/null
+++ b/wiki/lib/exe/jquery.php
@@ -0,0 +1,43 @@
+<?php
+
+if(!defined('DOKU_INC')) define('DOKU_INC', dirname(__FILE__) . '/../../');
+if(!defined('NOSESSION')) define('NOSESSION', true); // we do not use a session or authentication here (better caching)
+if(!defined('NL')) define('NL', "\n");
+if(!defined('DOKU_DISABLE_GZIP_OUTPUT')) define('DOKU_DISABLE_GZIP_OUTPUT', 1); // we gzip ourself here
+require_once(DOKU_INC . 'inc/init.php');
+
+// MAIN
+header('Content-Type: application/javascript; charset=utf-8');
+jquery_out();
+
+/**
+ * Delivers the jQuery JavaScript
+ *
+ * We do absolutely nothing fancy here but concatenating the different files
+ * and handling conditional and gzipped requests
+ *
+ * uses cache or fills it
+ */
+function jquery_out() {
+    $cache = new cache('jquery', '.js');
+    $files = array(
+        DOKU_INC . 'lib/scripts/jquery/jquery.min.js',
+        DOKU_INC . 'lib/scripts/jquery/jquery-ui.min.js',
+        DOKU_INC . 'lib/scripts/jquery/jquery-migrate.min.js',
+    );
+    $cache_files = $files;
+    $cache_files[] = __FILE__;
+
+    // check cache age & handle conditional request
+    // This may exit if a cache can be used
+    $cache_ok = $cache->useCache(array('files' => $cache_files));
+    http_cached($cache->cache, $cache_ok);
+
+    $js = '';
+    foreach($files as $file) {
+        $js .= file_get_contents($file)."\n";
+    }
+    stripsourcemaps($js);
+
+    http_cached_finish($cache->cache, $js);
+}