# HG changeset patch # User Dan # Date 1248878923 14400 # Node ID d3e12f1f9f291632f0888588192e3eea4095b566 # Parent f5d2bca33bb8f304b2006a6a43c3d137bbe00a55 Added method add_header_js() to template to allow insertion of code to be run immediately after JS init diff -r f5d2bca33bb8 -r d3e12f1f9f29 includes/template.php --- a/includes/template.php Wed Jul 29 10:47:26 2009 -0400 +++ b/includes/template.php Wed Jul 29 10:48:43 2009 -0400 @@ -22,6 +22,7 @@ var $page_id = false; var $namespace = false; var $js_preload = array(); + var $js_append = ''; /** * Page action conditions @@ -470,6 +471,16 @@ } /** + * Queue some HTML to be inserted after the Javascript runtime. + * @param string HTML glob + */ + + function add_header_js($html) + { + $this->js_append .= "$html\n "; + } + + /** * Global, only-called-once init. Goes to all themes. */ @@ -557,6 +568,7 @@ window.onload = function(e) { }; } + $this->js_append JSEOF; } else @@ -604,6 +616,7 @@ window.onload = function(e) { }; } //]]> + $this->js_append JSEOF; }