r19554 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r19553‎ | r19554 | r19555 >
Date:16:46, 21 January 2007
Author:hashar
Status:old
Tags:
Comment:
New hook: AjaxAddScript. Used to load some more ajax javascripts
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/OutputPage.php (modified) (history)
  • /trunk/phase3/skins/MonoBook.php (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/MonoBook.php
@@ -89,7 +89,7 @@
9090 <?php }
9191 if($this->data['trackbackhtml']) print $this->data['trackbackhtml']; ?>
9292 <!-- Head Scripts -->
93 - <?php $this->html('headscripts') ?>
 93+<?php $this->html('headscripts') ?>
9494 </head>
9595 <body <?php if($this->data['body_ondblclick']) { ?>ondblclick="<?php $this->text('body_ondblclick') ?>"<?php } ?>
9696 <?php if($this->data['body_onload' ]) { ?>onload="<?php $this->text('body_onload') ?>"<?php } ?>
Index: trunk/phase3/docs/hooks.txt
@@ -554,5 +554,9 @@
555555 Can be used to set custom CSS/JS
556556 $out: OutputPage object
557557
 558+'AjaxAddScript': Called in output page just before the initialisation
 559+of the javascript ajax engine. The hook is only called when ajax
 560+is enabled ( $wgUseAjax = true; ).
 561+
558562 More hooks might be available but undocumented, you can execute
559563 ./maintenance/findhooks.php to find hidden one.
Index: trunk/phase3/includes/OutputPage.php
@@ -69,7 +69,7 @@
7070 # To add an http-equiv meta tag, precede the name with "http:"
7171 function addMeta( $name, $val ) { array_push( $this->mMetatags, array( $name, $val ) ); }
7272 function addKeyword( $text ) { array_push( $this->mKeywords, $text ); }
73 - function addScript( $script ) { $this->mScripts .= $script; }
 73+ function addScript( $script ) { $this->mScripts .= "\t\t".$script; }
7474
7575 /**
7676 * Add a self-contained script tag with the given contents
@@ -549,6 +549,9 @@
550550
551551 if ( $wgUseAjax ) {
552552 $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajax.js?$wgStyleVersion\"></script>\n" );
 553+
 554+ wfRunHooks( 'AjaxAddScript', array( &$this ) );
 555+
553556 if( $wgAjaxSearch ) {
554557 $this->addScript( "<script type=\"{$wgJsMimeType}\" src=\"{$wgStylePath}/common/ajaxsearch.js\"></script>\n" );
555558 $this->addScript( "<script type=\"{$wgJsMimeType}\">hookEvent(\"load\", sajax_onload);</script>\n" );