r108225 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108224‎ | r108225 | r108226 >
Date:12:29, 6 January 2012
Author:nikerabbit
Status:deferred
Tags:
Comment:
Blind search and replace to get rid of legacy globals - untested
Modified paths:
  • /trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_autoedit.js (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_imagePreview.js (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_submit.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/libs/SF_autoedit.js
@@ -8,7 +8,7 @@
99
1010 $('.autoedit-trigger').click(function(){
1111
12 - if ( wgUserName == null ) {
 12+ if ( mw.config.get( 'wgUserName' ) == null ) {
1313 if ( confirm( sfgAnonEditWarning ) ) {
1414 handleAutoEdit( this );
1515 }
Index: trunk/extensions/SemanticForms/libs/SF_submit.js
@@ -7,7 +7,7 @@
88 var sacButtons;
99 var form;
1010
11 - if ( wgAction == "formedit" || wgCanonicalSpecialPageName == "FormEdit" ) {
 11+ if ( mw.config.get( 'wgAction' ) == "formedit" || mw.config.get( 'wgCanonicalSpecialPageName' ) == "FormEdit" ) {
1212
1313 form = $('#sfForm');
1414
@@ -132,16 +132,16 @@
133133
134134 }
135135
136 - if (wgAction == "formedit") {
137 - params += "&target=" + encodeURIComponent( wgPageName );
138 - } else if ( wgCanonicalSpecialPageName == "FormEdit") {
 136+ if (mw.config.get( 'wgAction' ) == "formedit") {
 137+ params += "&target=" + encodeURIComponent( mw.config.get( 'wgPageName' ) );
 138+ } else if ( mw.config.get( 'wgCanonicalSpecialPageName' ) == "FormEdit") {
139139
140140 var url = String(window.location);
141141
142142 var stop = url.indexOf("?");
143143 if ( stop > 0 ) url = url.substring(0, stop);
144144
145 - var start = url.indexOf( wgPageName ); // find start of page name
 145+ var start = url.indexOf( mw.config.get( 'wgPageName' ) ); // find start of page name
146146 start = url.indexOf("/", start) + 1; // find start of subpage
147147
148148 if ( start >= 0 ) {
Index: trunk/extensions/SemanticForms/libs/SF_imagePreview.js
@@ -11,7 +11,7 @@
1212
1313 this.getPreviewImage = function( args, callback ) {
1414 $.getJSON(
15 - wgScriptPath + '/api.php',
 15+ mw.config.get( 'wgScriptPath' ) + '/api.php',
1616 {
1717 'action': 'query',
1818 'format': 'json',
Index: trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js
@@ -10,7 +10,7 @@
1111
1212 function ajaxFormPreviewInit(){
1313
14 - if ((wgNamespaceNumber % 2 == 0) && /\.(js|css)$/.test(wgTitle)) return;
 14+ if ((mw.config.get( 'mw.config.get( 'wgNamespaceNumber' )' ) % 2 == 0) && /\.(js|css)$/.test(mw.config.get( 'wgTitle' ))) return;
1515
1616 if(!document.getElementById('wikiPreview')) return;
1717
@@ -63,7 +63,7 @@
6464
6565 //prepare
6666 var action = document.URL;
67 - if (wgAction=='formedit') action += '&live';
 67+ if (mw.config.get( 'wgAction' )=='formedit') action += '&live';
6868
6969 var boundary = '--------123xyz';
7070 var data = '';
@@ -253,7 +253,7 @@
254254 }
255255 }
256256
257 -if (wgAction=='formedit' || wgCanonicalSpecialPageName == 'FormEdit') {
 257+if (mw.config.get( 'wgAction' )=='formedit' || mw.config.get( 'wgCanonicalSpecialPageName' ) == 'FormEdit') {
258258 if ( typeof( addOnloadHook ) != 'undefined' ) addOnloadHook(ajaxFormPreviewInit);
259259 else if ( typeof( jQuery ) != 'undefined' ) jQuery(function(){
260260 ajaxFormPreviewInit()

Follow-up revisions

RevisionCommit summaryAuthorDate
r109017Revert of r108255 - too early to get rid of JS globals, since SF still suppor...yaron03:42, 16 January 2012
r112138Follow-up to r108225 and r109017 - re-did nikerabbit's replacement of JS glob...yaron19:37, 22 February 2012