Index: trunk/extensions/LiquidThreads/classes/LqtView.php |
— | — | @@ -26,6 +26,8 @@ |
27 | 27 | protected $threadNestingLevel = 0; |
28 | 28 | |
29 | 29 | protected $sort_order = LQT_NEWEST_CHANGES; |
| 30 | + |
| 31 | + static $stylesAndScriptsDone = false; |
30 | 32 | |
31 | 33 | function __construct( &$output, &$article, &$title, &$user, &$request ) { |
32 | 34 | $this->article = $article; |
— | — | @@ -621,12 +623,19 @@ |
622 | 624 | static function addJSandCSS() { |
623 | 625 | // Changed this to be static so that we can call it from |
624 | 626 | // wfLqtBeforeWatchlistHook. |
| 627 | + |
| 628 | + if ( self::$stylesAndScriptsDone ) { |
| 629 | + return; |
| 630 | + } |
| 631 | + |
625 | 632 | global $wgOut; |
626 | 633 | global $wgScriptPath, $wgStyleVersion; |
627 | 634 | |
628 | 635 | $wgOut->addInlineScript( 'var wgLqtMessages = ' . self::exportJSLocalisation() . ';' ); |
629 | 636 | $wgOut->addScriptFile( "{$wgScriptPath}/extensions/LiquidThreads/lqt.js" ); |
630 | 637 | $wgOut->addExtensionStyle( "{$wgScriptPath}/extensions/LiquidThreads/lqt.css?{$wgStyleVersion}" ); |
| 638 | + |
| 639 | + self::$stylesAndScriptsDone = true; |
631 | 640 | } |
632 | 641 | |
633 | 642 | static function exportJSLocalisation() { |
Index: trunk/extensions/LiquidThreads/classes/LqtDispatch.php |
— | — | @@ -184,7 +184,7 @@ |
185 | 185 | $thread = Threads::withRoot( new Post( $rc->getTitle() ) ); |
186 | 186 | if ( !$thread ) return true; |
187 | 187 | |
188 | | - LqtView::addJSandCSS(); // TODO only do this once. |
| 188 | + LqtView::addJSandCSS(); |
189 | 189 | wfLoadExtensionMessages( 'LiquidThreads' ); |
190 | 190 | |
191 | 191 | if ( $rc->mAttribs['rc_type'] != RC_NEW ) { |