Index: trunk/extensions/TreeAndMenu/TreeAndMenu.php |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | |
16 | 16 | if ( !defined( 'MEDIAWIKI' ) ) die( 'Not an entry point.' ); |
17 | 17 | |
18 | | -define( 'TREEANDMENU_VERSION','1.2.3, 2011-07-26' ); |
| 18 | +define( 'TREEANDMENU_VERSION','1.2.4, 2011-07-26' ); |
19 | 19 | |
20 | 20 | # Set any unset images to default titles |
21 | 21 | if ( !isset( $wgTreeViewImages ) || !is_array( $wgTreeViewImages ) ) $wgTreeViewImages = array(); |
— | — | @@ -221,9 +221,13 @@ |
222 | 222 | $$pos .= "<a href=\"javascript: $objid.{$arg}All();\"> {$arg} all</a> "; |
223 | 223 | if ( $top ) $top = "<p> $top</p>"; |
224 | 224 | if ( $bottom ) $bottom = "<p> $bottom</p>"; |
225 | | - $html = "$top<div class='$class' id='$id'> |
| 225 | + |
| 226 | + # Add the dTRee script if not loaded yet |
| 227 | + $dTreeScript = $this->js++ ? "" : "<script type=\"$wgJsMimeType\" src=\"{$this->baseUrl}/dtree.js\"></script>"; |
| 228 | + |
| 229 | + $html = "$top<div class='$class' id='$id'>$dTreeScript |
226 | 230 | <script type=\"$wgJsMimeType\">/*<![CDATA[*/ |
227 | | - // TreeAndMenu{$this->version} |
| 231 | + // TreeAndMenu-{$this->version} |
228 | 232 | tree = new dTree('$objid'); |
229 | 233 | for (i in tree.icon) tree.icon[i] = '{$this->baseUrl}/'+tree.icon[i];{$this->images} |
230 | 234 | tree.config.useLines = {$this->useLines}; |
— | — | @@ -260,12 +264,7 @@ |
261 | 265 | } |
262 | 266 | } |
263 | 267 | } |
264 | | - |
265 | 268 | $text = preg_replace( "/\x7f1$u\x7f.+?[\\r\\n]+/m", '', $text ); # Remove all unreplaced row information |
266 | | - |
267 | | - # Add the dTRee script if not loaded yet |
268 | | - if( !$this->js++ ) $text = "<script type=\"$wgJsMimeType\" src=\"{$this->baseUrl}/dtree.js\"></script>\n$text"; |
269 | | - |
270 | 269 | return true; |
271 | 270 | } |
272 | 271 | |