۵٬۱۲۳
ویرایش
بدون خلاصۀ ویرایش |
بدون خلاصۀ ویرایش |
||
خط ۱: | خط ۱: | ||
/** | /** | ||
* Cat-a-lot | * Cat-a-lot | ||
خط ۳۷: | خط ۳۰: | ||
userGrp = mw.config.get( 'wgUserGroups' ), | userGrp = mw.config.get( 'wgUserGroups' ), | ||
project = mw.config.get( 'wgDBname' ); | project = mw.config.get( 'wgDBname' ); | ||
var msgs = { | var msgs = { | ||
خط ۴۳: | خط ۳۵: | ||
// new: added 2012-09-19. Please translate. | // new: added 2012-09-19. Please translate. | ||
// Use user language for i18n | // Use user language for i18n | ||
'cat-a-lot-watchlistpref' | 'cat-a-lot-watchlistpref': 'Watchlist preference concerning files edited with Cat-a-lot', | ||
'cat-a-lot-watch_pref' | 'cat-a-lot-watch_pref': 'According to your general preferences', | ||
'cat-a-lot-watch_nochange' : ' | 'cat-a-lot-watch_nochange': 'Do not change watchstatus', | ||
'cat-a-lot-watch_watch' | 'cat-a-lot-watch_watch': 'Watch pages edited with Cat-a-lot', | ||
'cat-a-lot-watch_unwatch' | 'cat-a-lot-watch_unwatch': 'Remove pages while editing with Cat-a-lot from your watchlist', | ||
'cat-a-lot-minorpref' | 'cat-a-lot-minorpref': 'Mark edits as minor (if you generally mark your edits as minor, this won’t change anything)', | ||
'cat-a-lot-editpagespref' | 'cat-a-lot-editpagespref': 'Allow categorising pages (including categories) that are not files', | ||
'cat-a-lot-docleanuppref' | 'cat-a-lot-docleanuppref': 'Remove {{Check categories}} and other minor cleanup', | ||
'cat-a-lot-uncatpref' | 'cat-a-lot-uncatpref': 'Remove {{Uncategorized}}', | ||
'cat-a-lot-subcatcountpref': ' | 'cat-a-lot-subcatcountpref': 'Sub-categories to show at most', | ||
'cat-a-lot-config-settings': ' | 'cat-a-lot-config-settings': 'Preferences', | ||
'cat-a-lot-buttonpref' | 'cat-a-lot-buttonpref': 'Use buttons instead of text-links', | ||
'cat-a-lot-comment-label' | 'cat-a-lot-comment-label': 'Custom edit comment', | ||
'cat-a-lot-edit-question' | 'cat-a-lot-edit-question': 'Why is this change necessary?', | ||
// Progress | // Progress | ||
// 'cat-a-lot-loading' | // 'cat-a-lot-loading': 'Loading …', | ||
'cat-a-lot-editing' | 'cat-a-lot-editing': 'Editing page', | ||
'cat-a-lot-of' | 'cat-a-lot-of': 'of ', | ||
'cat-a-lot-skipped-already' | 'cat-a-lot-skipped-already': 'The following {{PLURAL:$1|1=page was|$1 pages were}} skipped, because the page was already in the category:', | ||
'cat-a-lot-skipped-not-found': ' | 'cat-a-lot-skipped-not-found': 'The following {{PLURAL:$1|1=page was|$1 pages were}} skipped, because the old category could not be found:', | ||
'cat-a-lot-skipped-server' | 'cat-a-lot-skipped-server': 'The following {{PLURAL:$1|1=page|$1 pages}} couldn’t be changed, since there were problems connecting to the server:', | ||
'cat-a-lot-all-done' | 'cat-a-lot-all-done': 'All pages are processed.', | ||
'cat-a-lot-done' | 'cat-a-lot-done': 'Done!', // mw.msg("Feedback-close") | ||
'cat-a-lot-added-cat' | 'cat-a-lot-added-cat': 'Added category $1', | ||
'cat-a-lot-copied-cat' | 'cat-a-lot-copied-cat': 'Copied to category $1', | ||
'cat-a-lot-moved-cat' | 'cat-a-lot-moved-cat': 'Moved to category $1', | ||
'cat-a-lot-removed-cat' | 'cat-a-lot-removed-cat': 'Removed from category $1', | ||
// 'cat-a-lot-return-to-page': ' | // 'cat-a-lot-return-to-page': 'Return to page', | ||
// 'cat-a-lot-cat-not-found' : ' | // 'cat-a-lot-cat-not-found': 'Category not found.', | ||
// as in 17 files selected | // as in 17 files selected | ||
'cat-a-lot-files-selected': '{{PLURAL:$1|1= | 'cat-a-lot-files-selected': '{{PLURAL:$1|1=One file|$1 files}} selected.', | ||
'cat-a-lot-pe_file': '$1 {{PLURAL:$1|page|pages}} of $2 affected', | |||
'cat-a-lot-parent-cat': 'Has parent-category: ', | |||
'cat-a-lot-sub-cat': 'Has sub-category: ', | |||
// Actions | // Actions | ||
'cat-a-lot- | 'cat-a-lot-copy': 'Copy', | ||
'cat-a-lot-move': 'Move', | |||
'cat-a-lot- | 'cat-a-lot-add': 'Add', | ||
'cat-a-lot- | // 'cat-a-lot-remove-from-cat': 'Remove from this category', | ||
'cat-a-lot- | 'cat-a-lot-overcat': 'Check over-categorization', | ||
'cat-a-lot- | 'cat-a-lot-enter-name': 'Enter category name', | ||
'cat-a-lot- | 'cat-a-lot-select': 'Select', | ||
'cat-a-lot- | 'cat-a-lot-all': 'all', | ||
'cat-a-lot- | 'cat-a-lot-none': 'none', | ||
// 'cat-a-lot-none-selected': 'No files selected!', 'Ooui-selectfile-placeholder' | |||
// Summaries (project language): | |||
'cat-a-lot-pref-save-summary': 'Updating user preferences', | |||
'cat-a-lot-summary-add': 'Adding [[Category:$1]]', | |||
'cat-a-lot-summary-copy': 'Copying from [[Category:$1]] to [[Category:$2]]', | |||
'cat-a-lot-summary-move': 'Moving from [[Category:$1]] to [[Category:$2]]', | |||
'cat-a-lot-summary-remove': 'Removing from [[Category:$1]]', | |||
'cat-a-lot-prefix-summary': '', | |||
'cat-a-lot-using-summary': ' using [[c:Help:Cat-a-lot|Cat-a-lot]]' | |||
}; | }; | ||
mw.messages.set( msgs ); | mw.messages.set( msgs ); | ||
خط ۲۷۲: | خط ۲۵۹: | ||
$( '.ui-autocomplete' ) | $( '.ui-autocomplete' ) | ||
.position( { | .position( { | ||
my: | my: is_rtl ? 'left bottom' : 'right bottom', | ||
at: | at: is_rtl ? 'left top' : 'right top', | ||
of: $searchInput | of: $searchInput | ||
} ); | } ); | ||
خط ۷۹۹: | خط ۷۸۶: | ||
case 'add': | case 'add': | ||
text = addCategory( text, targetcat ); | text = addCategory( text, targetcat ); | ||
sumCmt = msg( 'summary-add' ).replace( | sumCmt = msg( 'summary-add' ).replace( /\$1/g, targetcat ); | ||
sumCmtShort = '+[[' + catNS + targetcat + ']]'; | sumCmtShort = '+[[' + catNS + targetcat + ']]'; | ||
break; | break; | ||
case 'copy': | case 'copy': | ||
text = text.replace( this.regexCatBuilder( sourcecat ), '[[' + catNS + sourcecat + '$1]]\n[[' + catNS + targetcat + '$1]]\n' ); | text = text.replace( this.regexCatBuilder( sourcecat ), '[[' + catNS + sourcecat + '$1]]\n[[' + catNS + targetcat + '$1]]\n' ); | ||
sumCmt = msg( 'summary-copy' ).replace( | sumCmt = msg( 'summary-copy' ).replace( /\$1/g, sourcecat ).replace( /\$2/g, targetcat ); | ||
sumCmtShort = '+[[' + catNS + sourcecat + ']]' + arr + '[[' + catNS + targetcat + ']]'; | sumCmtShort = '+[[' + catNS + sourcecat + ']]' + arr + '[[' + catNS + targetcat + ']]'; | ||
// If category is added through template: | // If category is added through template: | ||
خط ۸۱۲: | خط ۷۹۹: | ||
case 'move': | case 'move': | ||
text = text.replace( this.regexCatBuilder( sourcecat ), '[[' + catNS + targetcat + '$1]]\n' ); | text = text.replace( this.regexCatBuilder( sourcecat ), '[[' + catNS + targetcat + '$1]]\n' ); | ||
sumCmt = msg( 'summary-move' ).replace( | sumCmt = msg( 'summary-move' ).replace( /\$1/g, sourcecat ).replace( /\$2/g, targetcat ); | ||
sumCmtShort = '±[[' + catNS + sourcecat + ']]' + arr + '[[' + catNS + targetcat + ']]'; | sumCmtShort = '±[[' + catNS + sourcecat + ']]' + arr + '[[' + catNS + targetcat + ']]'; | ||
break; | break; | ||
case 'remove': | case 'remove': | ||
text = text.replace( this.regexCatBuilder( targetcat ), '' ); | text = text.replace( this.regexCatBuilder( targetcat ), '' ); | ||
sumCmt = msg( 'summary-remove' ).replace( | sumCmt = msg( 'summary-remove' ).replace( /\$1/g, targetcat ); | ||
sumCmtShort = '-[[' + catNS + targetcat + ']]'; | sumCmtShort = '-[[' + catNS + targetcat + ']]'; | ||
break; | break; | ||
خط ۹۷۰: | خط ۹۵۷: | ||
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; | ||
} | } | ||
خط ۱٬۰۴۷: | خط ۱٬۰۳۵: | ||
if ( button ) { | if ( button ) { | ||
$buttons.slice( -1 )[ 0 ].button( { | $buttons.slice( -1 )[ 0 ].button( { | ||
icons: { primary: 'ui-icon-arrowthick-1- | icons: { primary: 'ui-icon-arrowthick-1-e' }, | ||
showLabel: false, | showLabel: false, | ||
text: false | text: false | ||
خط ۱٬۱۶۳: | خط ۱٬۱۵۱: | ||
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( { | $container.offset( { left: $( window ).width() - $container.outerWidth() } ); // Fix overlap | ||
}, | }, | ||
خط ۱٬۳۲۳: | خط ۱٬۳۱۱: | ||
.css( { | .css( { | ||
maxHeight: '', | maxHeight: '', | ||
width | width: '' | ||
} ); | } ); | ||
}, | }, | ||
خط ۱٬۶۱۳: | خط ۱٬۵۹۹: | ||
/** | /** | ||
* 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, |
ویرایش