r93163 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93162‎ | r93163 | r93164 >
Date:07:25, 26 July 2011
Author:nad
Status:deferred
Tags:
Comment:
update to ensure JS is added only once, only if at least one tree is found, and added before the tree in the source
Modified paths:
  • /trunk/extensions/TreeAndMenu/TreeAndMenu.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TreeAndMenu/TreeAndMenu.php
@@ -14,7 +14,7 @@
1515
1616 if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' );
1717
18 -define( 'TREEANDMENU_VERSION','1.2.2, 2011-07-08' );
 18+define( 'TREEANDMENU_VERSION','1.2.3, 2011-07-26' );
1919
2020 # Set any unset images to default titles
2121 if ( !isset( $wgTreeViewImages ) || !is_array( $wgTreeViewImages ) ) $wgTreeViewImages = array();
@@ -264,11 +264,8 @@
265265 $text = preg_replace( "/\x7f1$u\x7f.+?[\\r\\n]+/m", '', $text ); # Remove all unreplaced row information
266266
267267 # Add the dTRee script if not loaded yet
268 - if( !$this->js++ ) {
269 - $script = "<script type=\"$wgJsMimeType\" src=\"{$this->baseUrl}/dtree.js\"></script>";
270 - if( method_exists( $wgOut, 'addModules' ) ) $wgOut->addHtml( $script );
271 - else $wgOut->addScript( $script );
272 - }
 268+ if( !$this->js++ ) $text = "<script type=\"$wgJsMimeType\" src=\"{$this->baseUrl}/dtree.js\"></script>\n$text";
 269+
273270 return true;
274271 }
275272

Status & tagging log