r55498 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r55497‎ | r55498 | r55499 >
Date:20:07, 22 August 2009
Author:brion
Status:deferred
Tags:
Comment:
Remove extra inline <script> exposing $wgDraftsStyleVersion to JS; the JS doesn't use it.
Note -- if it's necessary later, it would be cleaner to add it to the global JS vars with another hook, so we don't have to build another <script> around it:

// Add $wgDraftsStyleVersion to page JS vars
$wgHooks['MakeGlobalVariablesScript'][] = 'DraftHooks::addStyleVersion';

...

/**
* MakeGlobalVariablesScript hook
* Add $wgDraftsStyleVersion to JS page vars
*/
public static function addStyleVersion( &$vars ) {
global $wgDraftsStyleVersion;
$vars['wgDraftsStyleVersion'] = $wgDraftsStyleVersion;
return true;
}
Modified paths:
  • /trunk/extensions/Drafts/Drafts.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Drafts/Drafts.hooks.php
@@ -302,9 +302,6 @@
303303 global $wgScriptPath, $wgJsMimeType, $wgDraftsStyleVersion;
304304 // FIXME: assumes standard dir structure
305305 // Add javascript to support ajax draft saving
306 - $out->addInlineScript(
307 - "var wgDraftsStyleVersion = \"$wgDraftsStyleVersion\";\n"
308 - );
309306 $out->addScript(
310307 Xml::element(
311308 'script',

Status & tagging log