மீடியாவிக்கி:Gadget-twinkleimage.js: திருத்தங்களுக்கு இடையிலான வேறுபாடு
உள்ளடக்கம் நீக்கப்பட்டது உள்ளடக்கம் சேர்க்கப்பட்டது
"//<nowiki> (function($){ /* *********************************..."-இப்பெயரில் புதிய பக்கம் உருவாக்கப்பட்டுள்ளது |
update from enwiki |
||
வரிசை 1:
// <nowiki>
(function($) {
வரிசை 10:
****************************************
* Mode of invocation: Tab ("DI")
* Active on:
*/
Twinkle.image = function twinkleimage() {
if (mw.config.get('wgNamespaceNumber') === 6 && mw.config.get('wgArticleId') && !document.getElementById('mw-sharedupload') && !Morebits.isPageRedirect()) {
Twinkle.addPortletLink(Twinkle.image.callback, 'DI', 'tw-di', 'Nominate file for delayed speedy deletion');
}
};
Twinkle.image.callback = function twinkleimageCallback() {
var Window = new Morebits.simpleWindow(
Window.setTitle(
Window.setScriptName(
Window.addFooterLink(
Window.addFooterLink('Image
Window.addFooterLink('Twinkle help', 'WP:TW/DOC#image');
Window.addFooterLink('Give feedback', 'WT:TW');
var form = new Morebits.quickForm(
form.append(
);
var field = form.append(
field.append(
form.append(
form.append(
var result = form.render();
Window.setContent(
Window.display();
// We must init the parameters
var evt = document.createEvent(
evt.initEvent(
result.type[0].dispatchEvent(
};
வரி 116 ⟶ 114:
var value = event.target.values;
var root = event.target.form;
var work_area = new Morebits.quickForm.element(
switch (
case 'no source no license':
case 'no source':
work_area.append(
/* falls through */
case 'no license':
work_area.append(
break;
case 'no permission':
work_area.append(
break;
case 'disputed fair use rationale':
work_area.append(
break;
case 'orphaned fair use':
work_area.append(
tooltip: 'Optional file that replaces this one. The "File:" prefix is optional.'
});
break;
case 'replaceable fair use':
work_area.append(
break;
default:
வரி 179 ⟶ 178:
}
root.replaceChild(
};
Twinkle.image.callback.evaluate = function twinkleimageCallbackEvaluate(event) {
var input = Morebits.quickForm.getInputData(event.target);
if (input.replacement) {
input.replacement = (new RegExp('^' + Morebits.namespaceRegex(6) + ':', 'i').test(input.replacement) ? '' : 'File:') + input.replacement;
}
var csdcrit;
switch (
case 'no source no license':
case 'no source':
case 'no license':
csdcrit =
break;
case 'orphaned fair use':
csdcrit =
break;
case 'no fair use rationale':
csdcrit =
break;
case 'disputed fair use rationale':
case 'replaceable fair use':
csdcrit =
break;
case 'no permission':
csdcrit =
break;
default:
throw new Error(
}
var lognomination = Twinkle.getPref('logSpeedyNominations') && Twinkle.getPref('noLogOnSpeedyNomination').indexOf(csdcrit.toLowerCase()) === -1;
var templatename =
var params = $.extend({
templatename: templatename,
normalized: csdcrit,
lognomination: lognomination
}, input);
Morebits.simpleWindow.setButtonsEnabled(false);
Morebits.status.init(event.target);
Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.wiki.actionCompleted.notice =
// Tagging image
var wikipedia_page = new Morebits.wiki.page(
wikipedia_page.setCallbackParameters(
wikipedia_page.load(
// Notifying uploader
if (
wikipedia_page.
} else {
// add to CSD log if desired
if (lognomination) {
Twinkle.image.callbacks.addToLog(params, null);
}
// No auto-notification, display what was going to be added.
var noteData = document.createElement(
noteData.appendChild(
Morebits.status.info(
}
};
வரி 279 ⟶ 253:
// remove "move to Commons" tag - deletion-tagged files cannot be moved to Commons
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi,
var tag =
switch (
case 'no source no license':
case 'no source':
tag += params.non_free ?
break;
case 'no permission':
tag += params.source ?
break;
case 'disputed fair use rationale':
tag += params.reason ?
break;
case 'orphaned fair use':
tag += params.replacement ?
break;
case 'replaceable fair use':
tag += params.reason ?
break;
default:
break; // doesn't matter
}
tag +=
pageobj.setPageText(tag + text);
pageobj.setEditSummary(
pageobj.setWatchlist(Twinkle.getPref('deliWatchPage'));
pageobj.setCreateOption('nocreate');
pageobj.save();
வரி 326 ⟶ 291:
// disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
pageobj.getStatusElement().warn(
} else {
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib,
var notifytext =
if (params.type === 'no permission') {
notifytext += params.source ?
}
notifytext +=
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary(
usertalkpage.setChangeTags(Twinkle.changeTags);
usertalkpage.setCreateOption('recreate');
usertalkpage.setFollowRedirect(true, false);
usertalkpage.append();
}
வரி 354 ⟶ 310:
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.image.callbacks.addToLog(params, initialContrib);
}
},
addToLog: function(params, initialContrib) {
var usl = new Morebits.userspaceLogger(Twinkle.getPref('speedyLogPageName'));
usl.initialText =
"This is a log of all [[WP:CSD|speedy deletion]] nominations made by this user using [[WP:TW|Twinkle]]'s CSD module.\n\n" +
'If you no longer wish to keep this log, you can turn it off using the [[Wikipedia:Twinkle/Preferences|preferences panel]], and ' +
'nominate this page for speedy deletion under [[WP:CSD#U1|CSD U1]].' +
(Morebits.userIsSysop ? '\n\nThis log does not track outright speedy deletions made using Twinkle.' : '');
var formatParamLog = function(normalize, csdparam, input) {
if (normalize === 'F5' && csdparam === 'replacement') {
input = '[[:' + input + ']]';
}
return ' {' + normalize + ' ' + csdparam + ': ' + input + '}';
};
var extraInfo = '';
// If a logged file is deleted but exists on commons, the wikilink will be blue, so provide a link to the log
var fileLogLink = ' ([{{fullurl:Special:Log|page=' + mw.util.wikiUrlencode(mw.config.get('wgPageName')) + '}} log])';
var appendText = '# [[:' + Morebits.pageNameNorm + ']]' + fileLogLink + ': DI [[WP:CSD#' + params.normalized.toUpperCase() + '|CSD ' + params.normalized.toUpperCase() + ']] ({{tl|di-' + params.templatename + '}})';
['reason', 'replacement', 'source'].forEach(function(item) {
if (params[item]) {
extraInfo += formatParamLog(params.normalized.toUpperCase(), item, params[item]);
return false;
}
});
if (extraInfo) {
appendText += '; additional information:' + extraInfo;
}
if (initialContrib) {
appendText += '; notified {{user|1=' + initialContrib + '}}';
}
appendText += ' ~~~~~\n';
var editsummary = 'Logging speedy deletion nomination of [[:' + Morebits.pageNameNorm + ']].';
usl.changeTags = Twinkle.changeTags;
usl.log(appendText, editsummary);
}
};
Twinkle.addInitCallback(Twinkle.image, 'image');
})(jQuery);
// </nowiki>
|