مدیاویکی:Gadget-Cat-a-lot.js: تفاوت میان نسخه‌ها

بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
 
(۷ نسخهٔ میانیِ ایجادشده توسط همین کاربر نشان داده نشد)
خط ۱۹۲: خط ۱۹۲:
href: commonsURL + '?title=Special:MyLanguage/Help:Gadget-Cat-a-lot',
href: commonsURL + '?title=Special:MyLanguage/Help:Gadget-Cat-a-lot',
target: '_blank',
target: '_blank',
style: 'float:left',
style: 'float:right',
title: ( $( '#n-help a' ).attr( 'title' ) || '' ) + ' (v. ' + this.version + ')'
title: ( $( '#n-help a' ).attr( 'title' ) || '' ) + ' (v. ' + this.version + ')'
} ).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.resizable', 'jquery.ui.draggable' ] );
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.autocomplete', initAutocomplete );
mw.loader.using( 'jquery.ui', initAutocomplete );


if ( !CAL.executed ) {
if ( !CAL.executed ) {
$.when( mw.loader.using( [
$.when( mw.loader.using( [
'jquery.ui.resizable',
'jquery.ui',
'jquery.ui.draggable',
'jquery.ui',
'jquery.ui.button',
'jquery.ui',
'mediawiki.api.messages',
'mediawiki.api',
'mediawiki.jqueryMsg'
'mediawiki.jqueryMsg'
] ), $.ready )
] ), $.ready )
خط ۶۱۱: خط ۶۱۱:


// escape regexp metacharacters (= any ASCII punctuation except _)
// escape regexp metacharacters (= any ASCII punctuation except _)
category = mw.RegExp.escape( category );
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.dialog', 'jquery.spinner', 'mediawiki.RegExp' ], function () {
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 ) {
this.connectionError.push( params.title );
self.connectionError.push( params.title );
this.updateCounter();
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.button' ) === 'ready' ) ? 1 : 0;
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>' ),
خط ۱٬۱۵۰: خط ۱٬۱۵۱:
table.width( '100%' );
table.width( '100%' );
$container.height( Math.min( $container.height(), $head.offset().top - $container.offset().top + 10 ) );
$container.height( Math.min( $container.height(), $head.offset().top - $container.offset().top + 10 ) );
$container.offset( { right: $( window ).width() - $container.outerWidth() } ); // Fix overlap
$container.offset( { left: $( window ).width() - $container.outerWidth() } ); // Fix overlap
},
},


خط ۱٬۲۹۶: خط ۱٬۲۹۷:
$link.after( $( '<a>' )
$link.after( $( '<a>' )
.text( '–' )
.text( '–' )
.css( { fontWeight: 'bold', marginright: '.7em' } )
.css( { fontWeight: 'bold', marginLeft: '.7em' } )
.one( 'click', this.minimize )
.one( 'click', this.minimize )
);
);
خط ۱٬۳۷۱: خط ۱٬۳۷۲:


manageSettings: function () {
manageSettings: function () {
mw.loader.using( [ 'ext.gadget.SettingsManager', 'ext.gadget.SettingsUI', 'jquery.ui.progressbar' ], CAL._manageSettings );
mw.loader.using( [ 'ext.gadget.SettingsManager', 'ext.gadget.SettingsUI', 'jquery.ui' ], CAL._manageSettings );
},
},


خط ۱٬۵۹۸: خط ۱٬۵۹۹:


/**
/**
* Derivative work of
  * When clicking a cat-a-lot label with Shift pressed, select all labels between the current and last-clicked one.
* (replace "checkboxes" with cat-a-lot labels in your mind)
*/
**
* jQuery checkboxShiftClick
*
* This will enable checkboxes to be checked or unchecked in a row by clicking one, holding shift and clicking another one
*
* @author Krinkle <krinklemail@gmail.com>
* @license GPL v2
*/
$.fn.catALotShiftClick = function ( cb ) {
$.fn.catALotShiftClick = function ( cb ) {
var prevCheckbox = null,
var prevCheckbox = null,