From ce0fb01d055a14894839c16de341a69fe56b8cfd Mon Sep 17 00:00:00 2001 From: Antoine Musso Date: Sun, 21 Jan 2007 16:46:36 +0000 Subject: [PATCH] New hook: AjaxAddScript. Used to load some more ajax javascripts --- docs/hooks.txt | 4 ++++ includes/OutputPage.php | 5 ++++- skins/MonoBook.php | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index 213171e043..c63b8a26da 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -554,5 +554,9 @@ $content_actions: The array of content actions Can be used to set custom CSS/JS $out: OutputPage object +'AjaxAddScript': Called in output page just before the initialisation +of the javascript ajax engine. The hook is only called when ajax +is enabled ( $wgUseAjax = true; ). + More hooks might be available but undocumented, you can execute ./maintenance/findhooks.php to find hidden one. diff --git a/includes/OutputPage.php b/includes/OutputPage.php index 1dd42124ea..1244830be0 100644 --- a/includes/OutputPage.php +++ b/includes/OutputPage.php @@ -69,7 +69,7 @@ class OutputPage { # To add an http-equiv meta tag, precede the name with "http:" function addMeta( $name, $val ) { array_push( $this->mMetatags, array( $name, $val ) ); } function addKeyword( $text ) { array_push( $this->mKeywords, $text ); } - function addScript( $script ) { $this->mScripts .= $script; } + function addScript( $script ) { $this->mScripts .= "\t\t".$script; } /** * Add a self-contained script tag with the given contents @@ -549,6 +549,9 @@ class OutputPage { if ( $wgUseAjax ) { $this->addScript( "\n" ); + + wfRunHooks( 'AjaxAddScript', array( &$this ) ); + if( $wgAjaxSearch ) { $this->addScript( "\n" ); $this->addScript( "\n" ); diff --git a/skins/MonoBook.php b/skins/MonoBook.php index dcdddcb707..50d7f00f3e 100644 --- a/skins/MonoBook.php +++ b/skins/MonoBook.php @@ -89,7 +89,7 @@ class MonoBookTemplate extends QuickTemplate { data['trackbackhtml']) print $this->data['trackbackhtml']; ?> - html('headscripts') ?> +html('headscripts') ?> data['body_ondblclick']) { ?>ondblclick="text('body_ondblclick') ?>" data['body_onload' ]) { ?>onload="text('body_onload') ?>" -- 2.20.1