jenkins-bot has submitted this change and it was merged.

Change subject: wikibits: Replace checkboxShiftClick globals with dummies
......................................................................


wikibits: Replace checkboxShiftClick globals with dummies

They have been deprecated in favour of jquery.checkboxShiftClick for
many releases now (since MediaWiki 1.17) and aren't used anywhere in
MediaWiki core (or extensions that I know of).

Though removal is justified, given the slow pace at which the tour[1]
is progressing and the amount of garbage I still find on a daily basis,
I'm replacing them with dummies instead and marking the dummies as
deprecated for easier tracking.

[1] 
https://meta.wikimedia.org/wiki/User:Krinkle/Le_Tour_de_Wik%C3%AD/2011_Resource_Walker

Change-Id: I72aac6111b9be974f160fecad8312c49c9460c5b
---
M skins/common/wikibits.js
1 file changed, 15 insertions(+), 65 deletions(-)

Approvals:
  Catrope: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js
index 1c409d8..1a9aabc 100644
--- a/skins/common/wikibits.js
+++ b/skins/common/wikibits.js
@@ -296,71 +296,21 @@
        return str;
 };
 
-window.checkboxes = undefined;
-window.lastCheckbox = undefined;
-
-window.setupCheckboxShiftClick = function() {
-       checkboxes = [];
-       lastCheckbox = null;
-       var inputs = document.getElementsByTagName( 'input' );
-       addCheckboxClickHandlers( inputs );
-};
-
-window.addCheckboxClickHandlers = function( inputs, start ) {
-       if ( !start ) {
-               start = 0;
-       }
-
-       var finish = start + 250;
-       if ( finish > inputs.length ) {
-               finish = inputs.length;
-       }
-
-       for ( var i = start; i < finish; i++ ) {
-               var cb = inputs[i];
-               if ( !cb.type || cb.type.toLowerCase() != 'checkbox' || ( ' ' + 
cb.className + ' ' ).indexOf( ' noshiftselect ' )  != -1 ) {
-                       continue;
-               }
-               var end = checkboxes.length;
-               checkboxes[end] = cb;
-               cb.index = end;
-               addClickHandler( cb, checkboxClickHandler );
-       }
-
-       if ( finish < inputs.length ) {
-               setTimeout( function() {
-                       addCheckboxClickHandlers( inputs, finish );
-               }, 200 );
-       }
-};
-
-window.checkboxClickHandler = function( e ) {
-       if ( typeof e == 'undefined' ) {
-               e = window.event;
-       }
-       if ( !e.shiftKey || lastCheckbox === null ) {
-               lastCheckbox = this.index;
-               return true;
-       }
-       var endState = this.checked;
-       var start, finish;
-       if ( this.index < lastCheckbox ) {
-               start = this.index + 1;
-               finish = lastCheckbox;
-       } else {
-               start = lastCheckbox;
-               finish = this.index - 1;
-       }
-       for ( var i = start; i <= finish; ++i ) {
-               checkboxes[i].checked = endState;
-               if( i > start && typeof checkboxes[i].onchange == 'function' ) {
-                       checkboxes[i].onchange(); // fire triggers
-               }
-       }
-       lastCheckbox = this.index;
-       return true;
-};
-
+/**
+ * Toggle checkboxes with shift selection.
+ * To be removed in MediaWiki 1.23.
+ *
+ * @deprecated since 1.17 Use jquery.checkboxShiftClick instead.
+ */
+$.each({
+       checkboxes: [],
+       lastCheckbox: null,
+       setupCheckboxShiftClick: $.noop,
+       addCheckboxClickHandlers: $.noop,
+       checkboxClickHandler: $.noop
+}, function ( key, val ) {
+       mw.log.deprecate( window, key, val, 'Use jquery.checkboxShiftClick 
instead.' );
+} );
 
 /*
        Written by Jonathan Snook, http://www.snook.ca/jonathan

-- 
To view, visit https://gerrit.wikimedia.org/r/60267
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I72aac6111b9be974f160fecad8312c49c9460c5b
Gerrit-PatchSet: 11
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Daniel Friesen <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: Matmarex <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Trevor Parscal <[email protected]>
Gerrit-Reviewer: Waldir <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to