r112462 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112461‎ | r112462 | r112463 >
Date:00:56, 27 February 2012
Author:tstarling
Status:ok
Tags:
Comment:
(bug 34538) Fixed compatibility with $wgResourceLoaderExperimentalAsyncLoading in extensions N-Z. Followup from r111989 where I did A-M. Untested.
Modified paths:
  • /trunk/extensions/PageSchemas/PageSchemas.js (modified) (history)
  • /trunk/extensions/RecordAdmin/recordadmin.js (modified) (history)
  • /trunk/extensions/SignupAPI/includes/verification.js (modified) (history)
  • /trunk/extensions/Translate/resources/ext.translate.special.languagestats.js (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.init.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.init.js
@@ -1 +1,5 @@
2 -mw.loader.using( 'ext.wikiLove.local', jQuery.wikiLove.init );
 2+mw.loader.using( 'ext.wikiLove.local', function() {
 3+ jQuery( document ).ready( function() {
 4+ jQuery.wikiLove.init();
 5+ } );
 6+} );
Index: trunk/extensions/Translate/resources/ext.translate.special.languagestats.js
@@ -73,17 +73,19 @@
7474 // When hovering a row, adjust brightness of the last two custom-colored cells as well
7575 // See also translate.langstats.css for the highlighting for the other normal rows
7676 mw.loader.using( 'jquery.colorUtil' , function() {
77 - $( '.mw-sp-translate-table.wikitable tr' ).hover( function() {
78 - $( '> td.hover-color', this )
79 - // 30% more brightness
80 - .css( 'background-color', function( i, val ) {
81 - return $.colorUtil.getColorBrightness( val, +0.3 );
 77+ jQuery( document ).ready( function( $ ) {
 78+ $( '.mw-sp-translate-table.wikitable tr' ).hover( function() {
 79+ $( '> td.hover-color', this )
 80+ // 30% more brightness
 81+ .css( 'background-color', function( i, val ) {
 82+ return $.colorUtil.getColorBrightness( val, +0.3 );
 83+ } );
 84+ }, function() {
 85+ $( '> td.hover-color', this )
 86+ // 30% less brightness
 87+ .css( 'background-color', function( i, val ) {
 88+ return $.colorUtil.getColorBrightness( val, -0.3 );
 89+ } );
8290 } );
83 - }, function() {
84 - $( '> td.hover-color', this )
85 - // 30% less brightness
86 - .css( 'background-color', function( i, val ) {
87 - return $.colorUtil.getColorBrightness( val, -0.3 );
88 - } );
8991 } );
9092 } );
Index: trunk/extensions/PageSchemas/PageSchemas.js
@@ -6,8 +6,8 @@
77 */
88
99
10 -var fieldNum = jQuery('.fieldBox:visible').length;
11 -var templateNum = jQuery('.templateBox:visible').length;
 10+var fieldNum;
 11+var templateNum;
1212
1313 jQuery.fn.editSchemaMakeTemplateDeleter = function() {
1414 jQuery(this).click( function() {
@@ -80,6 +80,9 @@
8181 }
8282
8383 jQuery(document).ready(function() {
 84+ fieldNum = jQuery('.fieldBox:visible').length;
 85+ templateNum = jQuery('.templateBox:visible').length;
 86+
8487 // Add and delete buttons
8588 jQuery(".deleteTemplate").editSchemaMakeTemplateDeleter();
8689 jQuery(".editSchemaAddTemplate").editSchemaMakeTemplateAdder();
Index: trunk/extensions/RecordAdmin/recordadmin.js
@@ -22,4 +22,6 @@
2323 }
2424 }
2525 };
26 -jQuery( '#editform' ).submit( raRecordForms );
 26+jQuery( document ).ready( function( $ ) {
 27+ $( '#editform' ).submit( raRecordForms );
 28+} );
Index: trunk/extensions/SignupAPI/includes/verification.js
@@ -1,78 +1,81 @@
22 //setup verification fields on the form
33
4 -function validateInput( fieldtype,fieldid ) {
5 - var inputVal = document.getElementById(fieldid).value;
6 - var valresult = document.getElementById(fieldid+'val');
7 - $.ajax({
8 - type: "POST",
9 - url: mw.util.wikiScript('api'),
10 - data: {'action':'validatesignup', 'format':'json', 'field':fieldtype, 'inputVal':inputVal },
11 - dataType: 'json',
12 - success: function( jsondata ){
13 - var image = "<img src='"+ imagePath + jsondata.signup.icon +"'>";
14 - var message = jsondata.signup.result;
15 - valresult.innerHTML = image+message;
16 - }
17 - });
18 -}
 4+jQuery( document ).ready( function( $ ) {
195
20 -function passwordStrength() {
21 - var strength = document.getElementById('wpPassword2val');
22 - var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
23 - var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
24 - var enoughRegex = new RegExp("(?=.{6,}).*", "g");
25 - var pwd = document.getElementById("wpPassword2");
 6+ function validateInput( fieldtype,fieldid ) {
 7+ var inputVal = document.getElementById(fieldid).value;
 8+ var valresult = document.getElementById(fieldid+'val');
 9+ $.ajax({
 10+ type: "POST",
 11+ url: mw.util.wikiScript('api'),
 12+ data: {'action':'validatesignup', 'format':'json', 'field':fieldtype, 'inputVal':inputVal },
 13+ dataType: 'json',
 14+ success: function( jsondata ){
 15+ var image = "<img src='"+ imagePath + jsondata.signup.icon +"'>";
 16+ var message = jsondata.signup.result;
 17+ valresult.innerHTML = image+message;
 18+ }
 19+ });
 20+ }
2621
27 - if (pwd.value.length==0) {
28 - strength.innerHTML = mw.message( 'signupapi-enterpassword' );
29 - } else if (pwd.value.length<minlength) {
30 - strength.innerHTML = mw.message( 'signupapi-passwordtooshort', minlength );
31 - $("#progress").progressbar({value: 10});
32 - $("div.ui-progressbar-value").css("background","red");
33 - } else if (strongRegex.test(pwd.value)) {
34 - strength.innerHTML = '<span style="color:green">'+mw.message( 'signupapi-strong' )+'</span>';
35 - $("#progress").progressbar({value: 100});
36 - $("div.ui-progressbar-value").css("background","green");
37 - } else if (mediumRegex.test(pwd.value)) {
38 - strength.innerHTML = '<span style="color:orange">'+mw.message( 'signupapi-medium' )+'</span>';
39 - $("#progress").progressbar({value: 60});
40 - $("div.ui-progressbar-value").css("background","orange");
41 - } else {
42 - strength.innerHTML = '<span style="color:red">'+mw.message( 'signupapi-weak' )+'</span>';
43 - $("#progress").progressbar({value: 30});
44 - $("div.ui-progressbar-value").css("background","red");
 22+ function passwordStrength() {
 23+ var strength = document.getElementById('wpPassword2val');
 24+ var strongRegex = new RegExp("^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\\W).*$", "g");
 25+ var mediumRegex = new RegExp("^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$", "g");
 26+ var enoughRegex = new RegExp("(?=.{6,}).*", "g");
 27+ var pwd = document.getElementById("wpPassword2");
 28+
 29+ if (pwd.value.length==0) {
 30+ strength.innerHTML = mw.message( 'signupapi-enterpassword' );
 31+ } else if (pwd.value.length<minlength) {
 32+ strength.innerHTML = mw.message( 'signupapi-passwordtooshort', minlength );
 33+ $("#progress").progressbar({value: 10});
 34+ $("div.ui-progressbar-value").css("background","red");
 35+ } else if (strongRegex.test(pwd.value)) {
 36+ strength.innerHTML = '<span style="color:green">'+mw.message( 'signupapi-strong' )+'</span>';
 37+ $("#progress").progressbar({value: 100});
 38+ $("div.ui-progressbar-value").css("background","green");
 39+ } else if (mediumRegex.test(pwd.value)) {
 40+ strength.innerHTML = '<span style="color:orange">'+mw.message( 'signupapi-medium' )+'</span>';
 41+ $("#progress").progressbar({value: 60});
 42+ $("div.ui-progressbar-value").css("background","orange");
 43+ } else {
 44+ strength.innerHTML = '<span style="color:red">'+mw.message( 'signupapi-weak' )+'</span>';
 45+ $("#progress").progressbar({value: 30});
 46+ $("div.ui-progressbar-value").css("background","red");
 47+ }
4548 }
46 -}
4749
48 -function checkRetype( pass,retype ) {
49 - var valresult = document.getElementById('wpRetypeval');
50 - var image = "";
51 - var message = "";
52 - if ( pass==retype ) {
53 - image = "<img src='"+ imagePath +"MW-Icon-CheckMark.png'>";
54 - message = mw.message( 'signupapi-passwordsmatch' );
55 - }else {
56 - image = "<img src='"+ imagePath +"MW-Icon-NoMark.png'>";
57 - message = mw.message( 'signupapi-badretype' );
 50+ function checkRetype( pass,retype ) {
 51+ var valresult = document.getElementById('wpRetypeval');
 52+ var image = "";
 53+ var message = "";
 54+ if ( pass==retype ) {
 55+ image = "<img src='"+ imagePath +"MW-Icon-CheckMark.png'>";
 56+ message = mw.message( 'signupapi-passwordsmatch' );
 57+ }else {
 58+ image = "<img src='"+ imagePath +"MW-Icon-NoMark.png'>";
 59+ message = mw.message( 'signupapi-badretype' );
 60+ }
 61+ valresult.innerHTML = image+message;
5862 }
59 - valresult.innerHTML = image+message;
60 -}
6163
62 -$('#wpName2').change(function() {validateInput("username","wpName2");});
63 -$('#wpPassword2').keyup(function() {passwordStrength();});
64 -$('#wpRetype').change(function() {checkRetype(document.getElementById("wpPassword2").value,document.getElementById("wpRetype").value);});
65 -$('#wpEmail').change(function() {validateInput( "email","wpEmail" );});
 64+ $('#wpName2').change(function() {validateInput("username","wpName2");});
 65+ $('#wpPassword2').keyup(function() {passwordStrength();});
 66+ $('#wpRetype').change(function() {checkRetype(document.getElementById("wpPassword2").value,document.getElementById("wpRetype").value);});
 67+ $('#wpEmail').change(function() {validateInput( "email","wpEmail" );});
6668
67 -$('#wpName2').after('<span id="wpName2val" class="wpName2val"></span>');
68 -$('#wpPassword2').after('<span id="wpPassword2val"></span><div id="progress" class="progress" style="width:30%; float: right;"></div>');
69 -$('#wpRetype').after('<span id="wpRetypeval" class="wpRetypeval"></span>');
70 -$('#wpEmail').after('<span id="wpEmailval" class="wpEmailval"></span>');
 69+ $('#wpName2').after('<span id="wpName2val" class="wpName2val"></span>');
 70+ $('#wpPassword2').after('<span id="wpPassword2val"></span><div id="progress" class="progress" style="width:30%; float: right;"></div>');
 71+ $('#wpRetype').after('<span id="wpRetypeval" class="wpRetypeval"></span>');
 72+ $('#wpEmail').after('<span id="wpEmailval" class="wpEmailval"></span>');
7173
72 -$("#progress").progressbar();
73 -console.log();
74 -$('div.ui-progressbar').css('background','#F2F5F7');
 74+ $("#progress").progressbar();
 75+ console.log();
 76+ $('div.ui-progressbar').css('background','#F2F5F7');
7577
76 -var imagePath = window.wgServer+window.wgExtensionAssetsPath + "/SignupAPI/includes/images/";
77 -var minlength = window.wgMinimalPasswordLength;
 78+ var imagePath = window.wgServer+window.wgExtensionAssetsPath + "/SignupAPI/includes/images/";
 79+ var minlength = window.wgMinimalPasswordLength;
7880
 81+} );
7982

Follow-up revisions

RevisionCommit summaryAuthorDate
r112573[mediawiki.action.edit] Clean up and bug fixes...krinkle03:17, 28 February 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r111983* Fixed failure of the edit toolbar to load when $wgResourceLoaderExperimenta...tstarling23:29, 20 February 2012
r111984Bug 34538 again. Bug reproduced and fix tested.tstarling23:47, 20 February 2012
r111985* Fixed load order like bug 34538...tstarling00:00, 21 February 2012
r111989* (bug 34538) Fixed compatibility with $wgResourceLoaderExperimentalAsyncLoad...tstarling04:03, 21 February 2012

Status & tagging log