http://www.mediawiki.org/wiki/Special:Code/MediaWiki/70424
Revision: 70424 Author: mah Date: 2010-08-03 20:59:10 +0000 (Tue, 03 Aug 2010) Log Message: ----------- revert r70106 and switch ordering of addJSandCSS and hook Modified Paths: -------------- trunk/extensions/LiquidThreads/LiquidThreads.php trunk/extensions/LiquidThreads/classes/View.php trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php Modified: trunk/extensions/LiquidThreads/LiquidThreads.php =================================================================== --- trunk/extensions/LiquidThreads/LiquidThreads.php 2010-08-03 20:58:40 UTC (rev 70423) +++ trunk/extensions/LiquidThreads/LiquidThreads.php 2010-08-03 20:59:10 UTC (rev 70424) @@ -157,7 +157,6 @@ $wgAutoloadClasses['SpecialNewMessages'] = $dir . 'pages/SpecialNewMessages.php'; $wgAutoloadClasses['SpecialSplitThread'] = $dir . 'pages/SpecialSplitThread.php'; $wgAutoloadClasses['SpecialMergeThread'] = $dir . 'pages/SpecialMergeThread.php'; -$wgAutoloadClasses['SpecialHotTopics'] = "$dir/pages/SpecialHotTopics.php"; // Job queue $wgJobClasses['synchroniseThreadArticleData'] = 'SynchroniseThreadArticleDataJob'; @@ -237,6 +236,7 @@ /** Whether or not to allow users to activate/deactivate LiquidThreads per-page */ $wgLiquidThreadsAllowUserControl = true; -/** Whether or not to allow users to activate/deactivate LiquidThreads in specific namespaces. - NULL means either all or none, depending on the above. */ +/** Whether or not to allow users to activate/deactivate LiquidThreads + in specific namespaces. NULL means either all or none, depending + on the above. */ $wgLiquidThreadsAllowUserControlNamespaces = null; Modified: trunk/extensions/LiquidThreads/classes/View.php =================================================================== --- trunk/extensions/LiquidThreads/classes/View.php 2010-08-03 20:58:40 UTC (rev 70423) +++ trunk/extensions/LiquidThreads/classes/View.php 2010-08-03 20:59:10 UTC (rev 70424) @@ -25,7 +25,7 @@ protected $sort_order = LQT_NEWEST_CHANGES; - static $stylesAndScriptsDone = array(); + static $stylesAndScriptsDone = false; function __construct( &$output, &$article, &$title, &$user, &$request ) { $this->article = $article; @@ -1182,19 +1182,8 @@ * Output methods * *************************/ - static function sendMoreScripts( $scripts = array() ) { - global $wgOut; - foreach( $scripts as $file ) { - if( !in_array( $file, self::$stylesAndScriptsDone ) ) { - $wgOut->addScriptFile( $file ); - self::$stylesAndScriptsDone[] = $file; - } - } - } - - static function addJSandCSS( $scripts = array() ) { - if ( count( self::$stylesAndScriptsDone ) ) { - self::sendMoreScripts( $scripts ); + static function addJSandCSS() { + if ( self::$stylesAndScriptsDone ) { return; } @@ -1204,22 +1193,22 @@ LqtHooks::$scriptVariables['wgLqtMessages'] = self::exportJSLocalisation(); - - $wgOut->addExtensionStyle( "$wgLiquidThreadsExtensionPath/jquery/jquery-ui-1.7.2.css" ); - $wgOut->addExtensionStyle( "$wgLiquidThreadsExtensionPath/lqt.css?{$wgStyleVersion}" ); - - array_unshift( $scripts, "$wgLiquidThreadsExtensionPath/js/lqt.toolbar.js" ); - array_unshift( $scripts, "$wgLiquidThreadsExtensionPath/jquery/jquery.autogrow.js" ); - array_unshift( $scripts, "$wgLiquidThreadsExtensionPath/lqt.js" ); - if ( method_exists( $wgOut, 'includeJQuery' ) ) { $wgOut->includeJQuery(); - array_unshift( $scripts, "$wgLiquidThreadsExtensionPath/jquery/plugins.js" ); + $wgOut->addScriptFile( "$wgLiquidThreadsExtensionPath/jquery/plugins.js" ); } else { - array_unshift( $scripts, "$wgLiquidThreadsExtensionPath/jquery/js2.combined.js" ); + $wgOut->addScriptFile( "$wgLiquidThreadsExtensionPath/jquery/js2.combined.js" ); } - self::sendMoreScripts( $scripts ); + $wgOut->addExtensionStyle( "$wgLiquidThreadsExtensionPath/jquery/jquery-ui-1.7.2.css" ); + + $wgOut->addScriptFile( "$wgLiquidThreadsExtensionPath/jquery/jquery.autogrow.js" ); + + $wgOut->addScriptFile( "$wgLiquidThreadsExtensionPath/lqt.js" ); + $wgOut->addScriptFile( "$wgLiquidThreadsExtensionPath/js/lqt.toolbar.js" ); + $wgOut->addExtensionStyle( "$wgLiquidThreadsExtensionPath/lqt.css?{$wgStyleVersion}" ); + + self::$stylesAndScriptsDone = true; } static function exportJSLocalisation() { @@ -1897,10 +1886,10 @@ ) ); $replyTo = $this->methodAppliesToThread( 'reply', $thread ); + self::addJSandCSS(); + $html = ''; wfRunHooks( 'EditPageBeforeEditToolbar', array( &$html ) ); - $scripts = isset( $options['addScripts'] ) ? $options['addScripts'] : array(); - self::addJSandCSS( $scripts ); $class = $this->threadDivClass( $thread ); if ( $levelNum == 1 ) { Modified: trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php =================================================================== --- trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php 2010-08-03 20:58:40 UTC (rev 70423) +++ trunk/extensions/LiquidThreads/pages/NewUserMessagesView.php 2010-08-03 20:59:10 UTC (rev 70424) @@ -85,6 +85,13 @@ function showOnce() { NewMessages::recacheMessageCount( $this->user->getId() ); + static $scriptDone = false; + + if ( !$scriptDone ) { + global $wgOut, $wgLiquidThreadsExtensionPath; + $wgOut->addScriptFile( "$wgLiquidThreadsExtensionPath/newmessages.js" ); + } + $this->user->setNewtalk( false ); if ( $this->methodApplies( 'mark_as_unread' ) ) { @@ -200,9 +207,8 @@ $mustShowThreads = $this->targets[$t->id()]; - global $wgLiquidThreadsExtensionPath; - $this->showThread( $t, 1, 1, array( 'mustShowThreads' => $mustShowThreads, - 'addScripts' => array( "$wgLiquidThreadsExtensionPath/newmessages.js" ) ) ); + $this->showThread( $t, 1, 1, array( 'mustShowThreads' => $mustShowThreads ) ); + $this->output->addHTML( "</td></tr>" ); } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs