مدیاویکی:Gadget-Cat-a-lot.js: تفاوت میان نسخهها
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
(۹ نسخهٔ میانیِ ایجادشده توسط همین کاربر نشان داده نشد) | |||
خط ۱۹۶: | خط ۱۹۶: | ||
} ).text( '?' ) ); | } ).text( '?' ) ); | ||
$container.one( 'mouseover', function () { // Try load on demand earliest as possible | $container.one( 'mouseover', function () { // Try load on demand earliest as possible | ||
mw.loader.load( [ 'jquery.ui | mw.loader.load( [ 'jquery.ui'] ); | ||
} ); | } ); | ||
خط ۳۱۵: | خط ۳۱۵: | ||
$( this ).toggleClass( 'cat_a_lot_enabled' ); | $( this ).toggleClass( 'cat_a_lot_enabled' ); | ||
// Load autocomplete on demand | // Load autocomplete on demand | ||
mw.loader.using( 'jquery.ui | mw.loader.using( 'jquery.ui', initAutocomplete ); | ||
if ( !CAL.executed ) { | if ( !CAL.executed ) { | ||
$.when( mw.loader.using( [ | $.when( mw.loader.using( [ | ||
'jquery.ui | 'jquery.ui', | ||
'jquery.ui | 'jquery.ui', | ||
'jquery.ui | 'jquery.ui', | ||
'mediawiki.api | 'mediawiki.api', | ||
'mediawiki.jqueryMsg' | 'mediawiki.jqueryMsg' | ||
] ), $.ready ) | ] ), $.ready ) | ||
خط ۶۱۱: | خط ۶۱۱: | ||
// escape regexp metacharacters (= any ASCII punctuation except _) | // escape regexp metacharacters (= any ASCII punctuation except _) | ||
category = mw. | category = mw.util.escapeRegExp( category ); | ||
// any sequence of spaces and underscores should match any other | // any sequence of spaces and underscores should match any other | ||
خط ۹۴۲: | خط ۹۴۲: | ||
if ( $( '#cat_a_lot_comment' ).prop( 'checked' ) ) { this.summary = window.prompt( msg( 'edit-question' ), '' ); } // TODO custom pre-value | if ( $( '#cat_a_lot_comment' ).prop( 'checked' ) ) { this.summary = window.prompt( msg( 'edit-question' ), '' ); } // TODO custom pre-value | ||
if ( this.summary !== null ) { | if ( this.summary !== null ) { | ||
mw.loader.using( [ 'jquery.ui | mw.loader.using( [ 'jquery.ui', 'jquery.spinner', 'mediawiki.util' ], function () { | ||
CAL.showProgress(); | CAL.showProgress(); | ||
CAL.getTargetCat( pages, targetcat, mode ); | CAL.getTargetCat( pages, targetcat, mode ); | ||
خط ۹۵۷: | خط ۹۵۷: | ||
var i = 0, | var i = 0, | ||
self = this, | |||
apiUrl = this.apiUrl, | apiUrl = this.apiUrl, | ||
doCall, | doCall, | ||
خط ۹۶۵: | خط ۹۶۶: | ||
i++; | i++; | ||
} else if ( params.title ) { | } else if ( params.title ) { | ||
self.connectionError.push( params.title ); | |||
self.updateCounter(); | |||
return; | return; | ||
} | } | ||
خط ۹۸۸: | خط ۹۸۹: | ||
createCatLinks: function ( symbol, list, table ) { | createCatLinks: function ( symbol, list, table ) { | ||
list.sort(); | list.sort(); | ||
var button = ( this.settings.button && mw.loader.getState( 'jquery.ui | var button = ( this.settings.button && mw.loader.getState( 'jquery.ui' ) === 'ready' ) ? 1 : 0; | ||
for ( var c = 0; c < list.length; c++ ) { | for ( var c = 0; c < list.length; c++ ) { | ||
var $tr = $( '<tr>' ), | var $tr = $( '<tr>' ), | ||
خط ۱٬۳۷۱: | خط ۱٬۳۷۲: | ||
manageSettings: function () { | manageSettings: function () { | ||
mw.loader.using( [ 'ext.gadget.SettingsManager', 'ext.gadget.SettingsUI', 'jquery.ui | mw.loader.using( [ 'ext.gadget.SettingsManager', 'ext.gadget.SettingsUI', 'jquery.ui' ], CAL._manageSettings ); | ||
}, | }, | ||
خط ۱٬۵۹۸: | خط ۱٬۵۹۹: | ||
/** | /** | ||
* When clicking a cat-a-lot label with Shift pressed, select all labels between the current and last-clicked one. | |||
* | */ | ||
*/ | |||
$.fn.catALotShiftClick = function ( cb ) { | $.fn.catALotShiftClick = function ( cb ) { | ||
var prevCheckbox = null, | var prevCheckbox = null, |