includes/template.php
changeset 1048 7b9132bfb5ce
parent 1047 d996bb6d6e74
child 1053 bdbb49cf6f1b
equal deleted inserted replaced
1047:d996bb6d6e74 1048:7b9132bfb5ce
   547     // these depend heavily on whether we have a CDN to work with or not
   547     // these depend heavily on whether we have a CDN to work with or not
   548     if ( getConfig('cdn_path') )
   548     if ( getConfig('cdn_path') )
   549     {
   549     {
   550       // we're on a CDN, point to static includes
   550       // we're on a CDN, point to static includes
   551       // CLI javascript compression script: includes/clientside/jscompress.php
   551       // CLI javascript compression script: includes/clientside/jscompress.php
   552       $js_head = '';
   552       $js_head = '<script type="text/javascript" src="' . cdnPath . '/includes/clientside/static/enano-lib-basic.js"></script>';
   553       
   553       
   554       if ( !empty($this->js_preload) )
   554       if ( !empty($this->js_preload) )
   555       {
   555       {
   556         $loadlines = array();
   556         $loadlines = array();
   557         
   557         
   558         // make unique
   558         // make unique
   559         foreach ( $this->js_preload as &$script )
   559         foreach ( $this->js_preload as &$script )
   560         {
   560         {
   561           $script = preg_replace('/\.js$/', '', $script) . '.js';
   561           $script = preg_replace('/\.js$/', '', $script) . '.js';
   562         }
   562         }
       
   563         unset($script);
   563         $this->js_preload = array_unique($this->js_preload);
   564         $this->js_preload = array_unique($this->js_preload);
   564         
   565         
   565         foreach ( $this->js_preload as $script )
   566         foreach ( $this->js_preload as $script )
   566         {
   567         {
   567           $js_head .= "\n    <script type=\"text/javascript\" src=\"" . cdnPath . "/includes/clientside/static/$script\"></script>";
   568           $js_head .= "\n    <script type=\"text/javascript\" src=\"" . cdnPath . "/includes/clientside/static/$script\"></script>";
   579         $js_head .= "\n    <script type=\"text/javascript\">
   580         $js_head .= "\n    <script type=\"text/javascript\">
   580       var loaded_components = loaded_components || {};
   581       var loaded_components = loaded_components || {};
   581       $loadlines
   582       $loadlines
   582     </script>";
   583     </script>";
   583       }
   584       }
   584       
       
   585       $js_head .= '<script type="text/javascript" src="' . cdnPath . '/includes/clientside/static/enano-lib-basic.js"></script>';
       
   586       
   585       
   587       $js_foot = <<<JSEOF
   586       $js_foot = <<<JSEOF
   588     <script type="text/javascript">
   587     <script type="text/javascript">
   589       // This initializes the Javascript runtime when the DOM is ready - not when the page is
   588       // This initializes the Javascript runtime when the DOM is ready - not when the page is
   590       // done loading, because enano-lib-basic still has to load some 15 other script files
   589       // done loading, because enano-lib-basic still has to load some 15 other script files