includes/clientside/jsres.php
changeset 568 3700f7124c2b
parent 559 cfdc0aa8af50
child 581 5e8fd89c02ea
--- a/includes/clientside/jsres.php	Mon Jun 09 20:52:34 2008 -0400
+++ b/includes/clientside/jsres.php	Tue Jun 10 00:21:34 2008 -0400
@@ -102,6 +102,35 @@
 header('Content-type: text/javascript');
 $everything = '';
 
+// if we only want the tiny version of the API (just enough to get by until the full one is loaded), send that
+// with a simple ETag and far future expires header
+if ( isset($_GET['early']) )
+{
+  header('ETag: enanocms-lib-early-r1');
+  header('Expires: Wed, 1 Jan 2020 00:00:00 GMT');
+  
+  echo <<<JSEOF
+var onload_hooks = new Array();
+
+function addOnloadHook(func)
+{
+  if ( typeof ( func ) == 'function' )
+  {
+    if ( typeof(onload_hooks.push) == 'function' )
+    {
+      onload_hooks.push(func);
+    }
+    else
+    {
+      onload_hooks[onload_hooks.length] = func;
+    }
+  }
+}
+JSEOF;
+  
+  exit();
+}
+
 // Load and parse enano_lib_basic
 $file = @file_get_contents('includes/clientside/static/enano-lib-basic.js');