# HG changeset patch # User Dan # Date 1247106444 14400 # Node ID cfc6c30c5e2dd1153d326125d2d48352279e8c99 # Parent ce069a06906c8e8d9bbfd0691b05780810242872 Fixed a series of infinite loops with preloading components and placeholders diff -r ce069a06906c -r cfc6c30c5e2d includes/clientside/jsres.php --- a/includes/clientside/jsres.php Wed Jul 08 18:53:45 2009 -0400 +++ b/includes/clientside/jsres.php Wed Jul 08 22:27:24 2009 -0400 @@ -40,12 +40,7 @@ $local_start = microtime_float(); // Disable for IE, it causes problems. -if ( ( strstr(@$_SERVER['HTTP_USER_AGENT'], 'MSIE') || defined('ENANO_JS_DEBUG') ) && !isset($_GET['early']) ) -{ - header('HTTP/1.1 302 Redirect'); - header('Location: static/enano-lib-basic.js'); - exit(); -} +$disable_compress = ( strstr(@$_SERVER['HTTP_USER_AGENT'], 'MSIE') || defined('ENANO_JS_DEBUG') ) && !isset($_GET['early']); // Setup Enano @@ -135,10 +130,12 @@ // note - obfuscated for optimization purposes. The exact same code except properly indented is in enano-lib-basic. if ( isset($_GET['early']) ) { - header('ETag: enanocms-lib-early-r2'); + header('ETag: enanocms-lib-early-r3'); header('Expires: Wed, 1 Jan 2020 00:00:00 GMT'); echo << 0 ) - { - // we have at least one input that needs to be made an autofill element. - // is spry data loaded? - load_component('l10n'); - } - - this.loaded = true; - - for ( var i = 0; i < inputs.length; i++ ) - { - autofill_init_element(inputs[i]); - } -} - window.autofill_init_element = function(element, params) { if ( element.af_initted ) @@ -126,6 +102,32 @@ autofill_init_element(el, {}); } +// note: init, then onload (the latter is called automatically) + +window.autofill_onload = function() +{ + if ( this.loaded ) + { + return true; + } + + var inputs = document.getElementsByClassName('input', 'autofill'); + + if ( inputs.length > 0 ) + { + // we have at least one input that needs to be made an autofill element. + // is spry data loaded? + load_component('l10n'); + } + + this.loaded = true; + + for ( var i = 0; i < inputs.length; i++ ) + { + autofill_init_element(inputs[i]); + } +} + window.autofill_init = function() { load_component(['l10n', 'jquery', 'jquery-ui']); diff -r ce069a06906c -r cfc6c30c5e2d includes/clientside/static/enano-lib-basic.js --- a/includes/clientside/static/enano-lib-basic.js Wed Jul 08 18:53:45 2009 -0400 +++ b/includes/clientside/static/enano-lib-basic.js Wed Jul 08 22:27:24 2009 -0400 @@ -592,7 +592,6 @@ unselectAllButtonsMinor: 'toolbar.js', darken: 'fadefilter.js', enlighten: 'fadefilter.js', - autofill_onload: 'autofill.js', password_score: 'pwstrength.js', password_score_field: 'pwstrength.js', ajaxEditTheme: 'theme-manager.js', @@ -601,7 +600,7 @@ ajaxInitRankEdit: 'rank-manager.js', ajaxInitRankCreate: 'rank-manager.js', autofill_init_element: 'autofill.js', - autofill_onload: 'autofill.js', + autofill_init: 'autofill.js', paginator_goto: 'paginate.js' }; @@ -627,15 +626,16 @@ { var file = placeholder_list[i]; placeholder_instances[i] = new Placeholder(i, file); - window[i] = placeholder_instances[i].go; + window[i] = window[i] || placeholder_instances[i].go; } -$lang = { +$lang = window.$lang || { get: function(a, b) { load_component('l10n'); return $lang.get(a, b); - } + }, + placeholder: true } //*/ diff -r ce069a06906c -r cfc6c30c5e2d includes/template.php --- a/includes/template.php Wed Jul 08 18:53:45 2009 -0400 +++ b/includes/template.php Wed Jul 08 22:27:24 2009 -0400 @@ -607,23 +607,7 @@ JSEOF; - } - $js_foot = << - - -JSEOF; + $js_foot = ''; if ( !empty($this->js_preload) ) { @@ -640,7 +624,27 @@ } $scripts = implode(',', $this->js_preload); $js_foot .= "\n "; + + } + + $js_foot .= << + + +JSEOF; } + $this->assign_bool(array( 'fixed_menus' => false,