21
επεξεργασίες
(Migration: addPortletLink → mw.util.addPortletLink) |
(Migration: wg* → mw.config.get('wg*')) |
||
// Don't install link if the user opted out, or when were on a special page
if (window.AjaxDeleteOptOut || mw.config.get('wgNamespaceNumber') < 0) return;
// Set up toolbox link
if (mw.config.get('wgNamespaceNumber') != 14) {
mw.util.addPortletLink('p-tb', 'javascript:AjaxQuickDelete.nominateForDeletion();', this.i18n.toolboxLinkDelete, 't-ajaxquickdelete', null);
} else {
// Check user group. Attention: Array.prototype.indexOf does not exist on IE! See also
// https://
if (
this.userRights = 'sysop';
} else if (
this.userRights = 'filemover';
}
// Install AjaxMoveButton
if (($.inArray(this.userRights,
// Also add a "Move & Replace" button to dropdown menu
}
}
if (this.userRights == 'sysop' && mw.config.get('wgNamespaceNumber') == 6) {
if ($('#AjaxDupeProcess').length) $('#AjaxDupeProcess')
.append('<a href="javascript:AjaxQuickDelete.processDupes();">Επεξεργασία διπλότυπων</a>').show();
}
// Define optional buttons
if (window.QuickDeleteEnhanced && mw.config.get('wgNamespaceNumber') == 6) {
$.each(this.insertTagButtons, function (k, v) {
mw.util.addPortletLink('p-tb', 'javascript:AjaxQuickDelete.insertTagOnPage("' + v.tag + '","'
insertTagOnPage: function (tag, img_summary, talk_tag, talk_summary, prompt_text, page) {
this.pageName = (page === undefined) ? mw.config.get('wgPageName').replace(/_/g,' ') : page.replace(/_/g,' ');
this.tag = tag + '\n';
this.img_summary = img_summary;
discussCategory: function () {
this.pageName = mw.config.get('wgPageName');
this.startDate = new Date();
this.tag = '{\{subst:cfd}}';
this.img_summary = 'This category needs discussion';
this.talk_tag = "{\{subst:cdw|" + mw.config.get('wgPageName') + "}}";
this.talk_summary = "[[:" + mw.config.get('wgPageName') + "]] needs discussion";
this.subpage_summary = 'Starting category discussion';
// set up some page names we'll need later
this.requestPage = 'Commons:Categories for discussion/' + this.formatDate("YYYY/MM/") + mw.config.get('wgPageName');
this.dailyLogPage = 'Commons:Categories for discussion/' + this.formatDate("YYYY/MM");
},
nominateForDeletion: function (page) {
this.pageName = (page === undefined) ? mw.config.get('wgPageName') : page;
this.startDate = new Date();
iiprop: 'size|sha1|url',
iiurlwidth: 365,
titles: mw.config.get('wgPageName') + '|' + this.destination
};
this.doAPICall(query, 'getDupeDetailsCB');
}
//If ordner (old=0, new=1) not correct: Reverse the order
if (this.details[0].title != mw.config.get('wgPageName').replace(/_/g, ' ')) this.details.reverse();
this.nextTask();
},
this.uploadersToNotify = 0;
for (var user in this.uploaders) {
if (user == mw.config.get('wgUserName')) continue; // notifying yourself is pointless
var page = [];
page.title = this.userTalkPrefix + user;
**/
findCreator: function () {
if (mw.config.get('wgNamespaceNumber') == 6) {
var query = {
action: 'query',
//First handle non-file pages
if (mw.config.get('wgNamespaceNumber') != 6) {
this.pageCreator = pages[id].revisions[0].user;
rvprop: 'content|timestamp',
intoken: 'edit|move',
titles: mw.config.get('wgPageName')
};
removeTemplate: function () {
var page = [];
page.title = (this.destination || mw.config.get('wgPageName'));
page.text = this.pageContent.replace(/\{\{(rename|rename media|move)\|.*?\}\}/i, "");
page.editType = 'text';
if (this.userRights == 'filemover') page.title = 'User talk:CommonsDelinker/commands';
if (!this.details) this.reason = '[[Commons:File renaming|File renamed]]: ' + this.reason;
page.text = '\n{{universal replace|' + mw.config.get('wgPageName').replace('File:', '') + '|'
+ this.destination.replace('File:', '') + '|reason=' + this.reason + '}}';
page.editType = 'appendtext';
this.showProgress(this.i18n.replacingUsage);
this.savePage(page, 'universal replace: [[:' + mw.config.get('wgPageName') + ']] → [[:' + this.destination + ']]', 'nextTask');
},
redirectPage: function () {
var page = [];
page.title = mw.config.get('wgPageName');
page.text = '#REDIRECT [[' + this.destination + ']]';
page.editType = 'text';
uncleanName = uncleanName.replace(/\.gif$/i, '.gif');
currentExtension = mw.config.get('wgPageName').toLowerCase().replace(/.*?\.(\w{3,4})$/, '$1').replace('jpeg', 'jpg');
// If new file name is without extension, add the one from the old name
action: 'move',
reason: this.reason,
from: mw.config.get('wgPageName'),
to: this.destination,
movetalk: '',
action: 'delete',
reason: this.reason,
title: mw.config.get('wgPageName'),
token: this.deletetoken,
recreate: ''
reloadPage: function () {
this.progressDialog.remove();
if (this.pageName && this.pageName.replace(/ /g, '_') != mw.config.get('wgPageName')) return;
var encTitle = (this.destination || mw.config.get('wgPageName'));
encTitle = encodeURIComponent(encTitle.replace(/ /g, '_')).replace(/%2F/ig, '/').replace(/%3A/ig, ':');
location.href = mw.config.get('wgServer') + mw.config.get('wgArticlePath').replace("$1", encTitle);
},
$('#feedbackContainer').html(msg + " " + fix + "<br>" + this.i18n.errorDetails + "<br>" + err
+ "<br><a href=" + mw.config.get('wgServer') + "/wiki/MediaWiki_talk:AjaxQuickDelete.js>" + this.i18n.errorReport + "</a>");
$('.ui-dialog-content').height('auto');
$('.ui-dialog').addClass('ajaxDeleteError');
requestPagePrefix: "Commons:Deletion requests/",
// user talk page prefix
userTalkPrefix: mw.config.get('wgFormattedNamespaces')[3] + ":",
// MediaWiki API script URL
apiURL: mw.config.get('wgServer') + mw.config.get('wgScriptPath') + "/api.php",
// Translatable strings
creatingNomination: "Δημιουργία σελίδας υποψηφιότητας... ",
listingNomination: "Προσθήκη σελίδας υποψηφιότητας στην ημερήσια σελίδα... ",
addingAnyTemplate: "Προσθήκη του προτύπου " + mw.config.get('wgCanonicalNamespace').toLowerCase() + " στην σελίδα περιγραφής... ",
notifyingUploader: "Ειδοποίηση %USER%... ",
taskFailure: {
listUploaders: "An error occurred while determining the "
+ (6 == mw.config.get('wgNamespaceNumber') ? " uploader(s) of this file" : "creator of this page") + ".",
loadPages: "An error occurred while preparing to nominate this "
+ mw.config.get('wgCanonicalNamespace').toLowerCase() + " for deletion.",
prependDeletionTemplate: "An error occurred while adding the {{delete}} template to this "
+ mw.config.get('wgCanonicalNamespace').toLowerCase() + ".",
createRequestSubpage: "An error occurred while creating the request subpage.",
listRequestSubpage: "An error occurred while adding the deletion request to today's log.",
notifyUploaders: "An error occurred while notifying the "
+ (6 == mw.config.get('wgNamespaceNumber') ? " uploader(s) of this file" : "creator of this page") + "."
},
addTemplateByHand: "To nominate this " + mw.config.get('wgCanonicalNamespace').toLowerCase()
+ " for deletion, please edit the page to add the {{delete}} template and follow the instructions shown on it.",
completeRequestByHand: "Please follow the instructions on the deletion notice to complete the request.",
};
if (mw.config.get('wgUserLanguage') != 'en') importScript('MediaWiki:AjaxQuickDelete.js/' + mw.config.get('wgUserLanguage'));
mediaWiki.loader.using('jquery.ui.dialog', function () {
$(document).ready(function () {
|
επεξεργασίες