includes/clientside/jsres.php
changeset 568 3700f7124c2b
parent 559 cfdc0aa8af50
child 581 5e8fd89c02ea
equal deleted inserted replaced
567:7f196509bf78 568:3700f7124c2b
   100 
   100 
   101 // Output format will always be JS
   101 // Output format will always be JS
   102 header('Content-type: text/javascript');
   102 header('Content-type: text/javascript');
   103 $everything = '';
   103 $everything = '';
   104 
   104 
       
   105 // if we only want the tiny version of the API (just enough to get by until the full one is loaded), send that
       
   106 // with a simple ETag and far future expires header
       
   107 if ( isset($_GET['early']) )
       
   108 {
       
   109   header('ETag: enanocms-lib-early-r1');
       
   110   header('Expires: Wed, 1 Jan 2020 00:00:00 GMT');
       
   111   
       
   112   echo <<<JSEOF
       
   113 var onload_hooks = new Array();
       
   114 
       
   115 function addOnloadHook(func)
       
   116 {
       
   117   if ( typeof ( func ) == 'function' )
       
   118   {
       
   119     if ( typeof(onload_hooks.push) == 'function' )
       
   120     {
       
   121       onload_hooks.push(func);
       
   122     }
       
   123     else
       
   124     {
       
   125       onload_hooks[onload_hooks.length] = func;
       
   126     }
       
   127   }
       
   128 }
       
   129 JSEOF;
       
   130   
       
   131   exit();
       
   132 }
       
   133 
   105 // Load and parse enano_lib_basic
   134 // Load and parse enano_lib_basic
   106 $file = @file_get_contents('includes/clientside/static/enano-lib-basic.js');
   135 $file = @file_get_contents('includes/clientside/static/enano-lib-basic.js');
   107 
   136 
   108 $pos_start_includes = strpos($file, '/*!START_INCLUDER*/');
   137 $pos_start_includes = strpos($file, '/*!START_INCLUDER*/');
   109 $pos_end_includes = strpos($file, '/*!END_INCLUDER*/');
   138 $pos_end_includes = strpos($file, '/*!END_INCLUDER*/');