r108226 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108225‎ | r108226 | r108227 >
Date:12:36, 6 January 2012
Author:nikerabbit
Status:deferred
Tags:
Comment:
Some quick untested cleanups to this JS
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_autogrow.js (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_imagePreview.js (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_popupform.js (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_submit.js (modified) (history)
  • /trunk/extensions/SemanticForms/libs/SF_wikieditor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/libs/SF_autoedit.js
@@ -4,7 +4,7 @@
55 * @author Stephan Gambke
66 */
77
8 -jQuery(function($){
 8+jQuery( function( $ ) {
99
1010 $('.autoedit-trigger').click(function(){
1111
Index: trunk/extensions/SemanticForms/libs/SF_submit.js
@@ -2,12 +2,12 @@
33 * Javascript handler for the save-and-continue button
44 */
55
6 -jQuery(function($){
 6+jQuery( function( $ ) {
77
88 var sacButtons;
99 var form;
1010
11 - if ( mw.config.get( 'wgAction' ) == "formedit" || mw.config.get( 'wgCanonicalSpecialPageName' ) == "FormEdit" ) {
 11+ if ( mw.config.get( 'wgAction' ) === "formedit" || mw.config.get( 'wgCanonicalSpecialPageName' ) === "FormEdit" ) {
1212
1313 form = $('#sfForm');
1414
@@ -30,11 +30,9 @@
3131 }
3232
3333 function setChanged( event ) {
34 -
35 - sacButtons.removeAttr("disabled");
36 -
3734 sacButtons
38 - .addClass("sf-save_and_continue-changed");
 35+ .removeAttr("disabled");
 36+ .addClass("sf-save_and_continue-changed");
3937
4038 return true;
4139 }
Index: trunk/extensions/SemanticForms/libs/SF_imagePreview.js
@@ -69,4 +69,4 @@
7070 } );
7171 } );
7272
73 -})( window.jQuery );
 73+})( jQuery );
Index: trunk/extensions/SemanticForms/libs/SF_ajax_form_preview.js
@@ -253,10 +253,6 @@
254254 }
255255 }
256256
257 -if (mw.config.get( 'wgAction' )=='formedit' || mw.config.get( 'wgCanonicalSpecialPageName' ) == 'FormEdit') {
258 - if ( typeof( addOnloadHook ) != 'undefined' ) addOnloadHook(ajaxFormPreviewInit);
259 - else if ( typeof( jQuery ) != 'undefined' ) jQuery(function(){
260 - ajaxFormPreviewInit()
261 - });
262 -// else sorry, no Ajax preview for you
 257+if ( mw.config.get( 'wgAction' ) ==='formedit' || mw.config.get( 'wgCanonicalSpecialPageName' ) === 'FormEdit' ) {
 258+ jQuery( ajaxFormPreviewInit );
263259 }
Index: trunk/extensions/SemanticForms/libs/SF_autogrow.js
@@ -12,8 +12,8 @@
1313 * @author Yaron Koren
1414 */
1515
16 -var autoGrowColsDefault = new Array();
17 -var autoGrowRowsDefault = new Array();
 16+var autoGrowColsDefault = [];
 17+var autoGrowRowsDefault = [];
1818
1919 function autoGrowSetDefaultValues(textArea) {
2020 var id = textArea.id
Index: trunk/extensions/SemanticForms/libs/SF_popupform.js
@@ -6,31 +6,31 @@
77 */
88
99 // initialise
10 -jQuery(function(){
 10+jQuery( function( $ ) {
1111
1212 // register eventhandlers on 'edit' links and buttons
1313
1414 // register formlink with link
15 - jQuery('a.popupformlink').click(function(evt){
 15+ $('a.popupformlink').click(function(evt){
1616 return ext.popupform.handlePopupFormLink( this.getAttribute('href'), this );
1717 });
1818
1919 // register formlink with button
20 - jQuery( 'form.popupformlink' ).submit(function(evt){
 20+ $( 'form.popupformlink' ).submit(function(evt){
2121 return ext.popupform.handlePopupFormLink( this.getAttribute( 'action' ), this );
2222 });
2323
2424
2525 // register forminput
26 - jQuery( 'form.popupforminput' ).submit(function(evt){
 26+ $( 'form.popupforminput' ).submit(function(evt){
2727 return ext.popupform.handlePopupFormInput( this.getAttribute( 'action' ), this );
2828 });
2929
3030 });
3131
3232 // create ext if it does not exist yet
33 -if ( typeof( window[ 'ext' ] ) == "undefined" ) {
34 - window[ 'ext' ] = {};
 33+if ( typeof( window.ext' ) === "undefined" ) {
 34+ window.ext = {};
3535 }
3636
3737 window.ext.popupform = new function() {
Index: trunk/extensions/SemanticForms/libs/SF_wikieditor.js
@@ -1,12 +1,12 @@
22 // create ext if it does not exist yet
3 -if ( typeof( window[ 'ext' ] ) == "undefined" ) {
4 - window[ 'ext' ] = {};
 3+if ( typeof( window.ext' ) === "undefined" ) {
 4+ window.ext = {};
55 }
66
77 window.ext.wikieditor = new function(){
88
99 // initialize the wikieditor on the specified element
10 - this.init = function init ( input_id, params ) {
 10+ this.init = function init ( input_id, params ) {
1111
1212 if ( window.mediaWiki ) {
1313 mediaWiki.loader.using( 'ext.semanticforms.wikieditor', function(){
@@ -14,7 +14,7 @@
1515 var input = jQuery( '#' + input_id );
1616
1717 // load toolbar
18 - mediaWiki.loader.using( ['jquery.wikiEditor.toolbar', 'jquery.wikiEditor.toolbar.config'] , function(){
 18+ mediaWiki.loader.using( ['jquery.wikiEditor.toolbar', 'jquery.wikiEditor.toolbar.config'] , function(){
1919 if ( jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.toolbar ) ) {
2020
2121 input.wikiEditor( 'addModule', jQuery.wikiEditor.modules.toolbar.config.getDefaultConfig() );
@@ -32,7 +32,7 @@
3333 });
3434
3535 // load dialogs
36 - mediaWiki.loader.using( ['jquery.wikiEditor.dialogs', 'jquery.wikiEditor.dialogs.config'] , function(){
 36+ mediaWiki.loader.using( ['jquery.wikiEditor.dialogs', 'jquery.wikiEditor.dialogs.config'] , function(){
3737 if ( jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.dialogs ) ) {
3838
3939 jQuery.wikiEditor.modules.dialogs.config.replaceIcons( input );
@@ -43,7 +43,7 @@
4444
4545 // load toc
4646 // TODO: Can this be enabled? Should it?
47 -// mediaWiki.loader.using( ['jquery.wikiEditor.toc' ] , function(){
 47+// mediaWiki.loader.using( ['jquery.wikiEditor.toc' ] , function(){
4848 // if ( jQuery.wikiEditor.isSupported( jQuery.wikiEditor.modules.toc ) ) {
4949 //
5050 // input.wikiEditor( 'addModule', 'toc' );

Follow-up revisions

RevisionCommit summaryAuthorDate
r109391Fix for r108226 - removed stray single-quoteyaron16:47, 18 January 2012
r109729fix for r108226 - removed stray single-quote; partial undofoxtrott12:53, 22 January 2012