"மீடியாவிக்கி:Gadget-twinkleprod.js" பக்கத்தின் திருத்தங்களுக்கிடையேயான வேறுபாடு

6,703 பைட்டுகள் சேர்க்கப்பட்டது ,  2 மாதங்களுக்கு முன்
update from enwiki
("//<nowiki> (function($){ /* *********************************..."-இப்பெயரில் புதிய பக்கம் உருவாக்கப்பட்டுள்ளது)
 
(update from enwiki)
 
// <nowiki>
 
 
(function($) {
 
 
****************************************
* Mode of invocation: Tab ("PROD")
* Active on: Existing articles, files, books which are not redirects,
* and user pages in [[:Category:Wikipedia books (user books)]]
* Config directives in: TwinkleConfig
*/
 
Twinkle.prod = function twinkleprod() {
if ((([0, 6, 108].indexOf(mw.config.get('wgNamespaceNumber')) !=== 0-1) ||&& !(mw.config.get('wgCurRevisionIdwgNamespaceNumber') !== 2 || Morebitsmw.wikiconfig.isPageRedirectget('wgCategories').indexOf('Wikipedia books (user books)') {=== -1))
|| !mw.config.get('wgCurRevisionId') || Morebits.isPageRedirect()) {
return;
}
 
Twinkle.addPortletLink( Twinkle.prod.callback, "'PROD"', "'tw-prod"', "'Propose deletion via WP:PROD" ');
};
 
// Used in edit summaries, for comparisons, etc.
var namespace;
 
Twinkle.prod.callback = function twinkleprodCallback() {
Twinkle.prod.defaultReason = Twinkle.getPref('prodReasonDefault');
 
switch (mw.config.get('wgNamespaceNumber')) {
var Window = new Morebits.simpleWindow( 800, 410 );
case 0:
Window.setTitle( "Proposed deletion (PROD)" );
namespace = 'article';
Window.setScriptName( "Twinkle" );
break;
Window.addFooterLink( "Proposed deletion policy", "WP:PROD" );
case 6:
Window.addFooterLink( "BLP PROD policy", "WP:BLPPROD" );
namespace = 'file';
Window.addFooterLink( "Twinkle help", "WP:TW/DOC#prod" );
break;
case 2:
case 108:
namespace = 'book';
break;
// no default
}
 
var formWindow = new Morebits.quickFormsimpleWindow(800, Twinkle.prod.callback.evaluate 410);
Window.setTitle('Proposed deletion (PROD)');
Window.setScriptName('Twinkle');
 
var form = new Morebits.quickForm(Twinkle.prod.callback.evaluate);
var field = form.append( {
type: 'field',
label: 'PROD type'
} );
field.append( {
type: 'radio',
name: 'prodtype',
event: Twinkle.prod.callback.prodtypechanged,
list: [
{
label: 'PROD (proposed deletion)',
value: 'prod',
checked: true,
tooltip: 'Normal proposed deletion, per [[WP:PROD]]'
},
{
label: 'BLP PROD (proposed deletion of unsourced BLPs)',
value: 'prodblp',
tooltip: 'Proposed deletion of new, completely unsourced biographies of living persons, per [[WP:BLPPROD]]'
}
]
} );
 
if (namespace === 'article') {
form.append( {
Window.addFooterLink('Proposed deletion policy', 'WP:PROD');
type: 'field',
Window.addFooterLink('BLP PROD policy', 'WP:BLPPROD');
label:'Work area',
} else if (namespace === 'file') {
name: 'work_area'
Window.addFooterLink('Proposed deletion policy', 'WP:PROD');
} );
} else { // if book
Window.addFooterLink('Proposed deletion (books) policy', 'WP:BOOKPROD');
}
 
var field = form.append({
form.append( { type:'submit', label:'Propose deletion' } );
type: 'field',
label: 'PROD type',
id: 'prodtype_fieldset'
});
 
field.append({
type: 'div',
label: Twinkle.makeFindSourcesDiv(),
style: 'margin-bottom: 5px;'
});
 
field.append({
type: 'radio',
name: 'prodtype',
event: Twinkle.prod.callback.prodtypechanged,
list: [
{
label: 'PROD (proposed deletion)',
value: 'prod',
checked: true,
tooltip: 'Normal proposed deletion, per [[WP:PROD]]'
},
{
label: 'BLP PROD (proposed deletion of unsourced BLPs)',
value: 'prodblp',
tooltip: 'Proposed deletion of new, completely unsourced biographies of living persons, per [[WP:BLPPROD]]'
}
]
});
 
// Placeholder fieldset to be replaced in Twinkle.prod.callback.prodtypechanged
form.append({
type: 'field',
name: 'parameters'
});
 
Window.addFooterLink('PROD prefs', 'WP:TW/PREF#prod');
Window.addFooterLink('Twinkle help', 'WP:TW/DOC#prod');
Window.addFooterLink('Give feedback', 'WT:TW');
 
form.append({ type: 'submit', label: 'Propose deletion' });
 
var result = form.render();
Window.setContent( result );
Window.display();
 
// Hide fieldset for File and Book PROD types since only normal PROD is allowed
// fake a change event on the first prod type radio, to initialize the type-dependent controls
if (namespace !== 'article') {
var evt = document.createEvent( "Event" );
$(result).find('#prodtype_fieldset').hide();
evt.initEvent( 'change', true, true );
}
result.prodtype[0].dispatchEvent( evt );
 
// Fake a change event on the first prod type radio, to initialize the type-dependent controls
var evt = document.createEvent('Event');
evt.initEvent('change', true, true);
result.prodtype[0].dispatchEvent(evt);
 
};
 
 
Twinkle.prod.callback.prodtypechanged = function(event) {
// prepare frame for prod type dependant controls
var field = new Morebits.quickForm.element( {
type: 'field',
label: 'Parameters',
name: 'work_areaparameters'
} );
// create prod type dependant controls
switch ( event.target.values ) {
case 'prod':
field.append( {
type: 'checkbox',
list: [
{
label: 'Notify page creator if possible',
value: 'notify',
name: 'notify',
tooltip: "A notification template will be placed on the creator's talk page if this is true.",
checked: true
}
]
});
field.append({
);
type: 'textarea',
field.append( {
typename: 'textareareason',
namelabel: 'reasonReason for proposed deletion:',
value: Twinkle.prod.defaultReason
label: 'Reason for proposed deletion:',
});
value: Twinkle.prod.defaultReason
} );
break;
 
case 'prodblp':
// first, remember the prod value that the user entered in the textarea, in case hethey wantswant to switch back. We can abuse the config field for that.
if (event.target.form.reason) {
Twinkle.prod.defaultReason = event.target.form.reason.value;
}
 
field.append( {
type: 'checkbox',
list: [
{
label: 'Notify page creator if possible',
value: 'notify',
name: 'notify',
tooltip: 'Creator of article has to be notified.',
checked: true,
disabled: true
}
]
});
// temp warning, can be removed down the line once BLPPROD is more established. Amalthea, May 2010.
);
//temp warning, can be removed down the line once BLPPROD is more established. Amalthea, May 2010.
var boldtext = document.createElement('b');
boldtext.appendChild(document.createTextNode('Please note that only unsourced biographies of living persons are eligible for this tag, narrowly construed.'));
label: boldtext
});
if (mw.config.get('wgArticleId') < 26596183) {
field.append({
type: 'header',
label: 'It appears that this article was created before March 18, 2010, and is thus ineligible for a BLP PROD. Please make sure that this is not the case, or use normal PROD instead.'
});
}
break;
 
}
 
event.target.form.replaceChild( field.render(), $(event.target.form).find('fieldset[name="work_areaparameters"]')[0] );
};
 
// global params object, initially set in evaluate(), and
// modified in various callback functions
var params = {};
 
Twinkle.prod.callbacks = {
maincheckPriors: function twinkleprodcheckPriors(pageobj) {
var talk_title = new mw.Title(mw.config.get('wgPageName')).getTalkPage().getPrefixedText();
var statelem = pageobj.getStatusElement();
// Talk page templates for PROD-able discussions
var blocking_templates = 'Template:Old XfD multi|Template:Old MfD|Template:Oldffdfull|' + // Common prior XfD talk page templates
'Template:Oldpuffull|' + // Legacy prior XfD template
'Template:Olddelrev|' + // Prior DRV template
'Template:Old prod';
var query = {
action: 'query',
titles: talk_title,
prop: 'templates',
tltemplates: blocking_templates,
format: 'json'
};
 
var wikipedia_api = new Morebits.wiki.api('Checking talk page for prior nominations', query);
if( !pageobj.exists() ) {
return wikipedia_api.post().then(function(apiobj) {
statelem.error( "It seems that the page doesn't exist. Perhaps it has already been deleted." );
var statelem = apiobj.statelem;
return;
}
 
// Check talk page for templates indicating prior XfD or PROD
var text = pageobj.getPageText();
var templates = apiobj.getResponse().query.pages[0].templates;
var params = pageobj.getCallbackParameters();
var numTemplates = templates && templates.length;
if (numTemplates) {
var template = templates[0].title;
if (numTemplates === 1 && template === 'Template:Old prod') {
params.oldProdPresent = true; // Mark for reference later, when deciding if to endorse
// if there are multiple templates, at least one of them would be a prior xfd template
} else {
statelem.warn('Previous XfD template found on talk page, aborting procedure');
return $.Deferred().reject();
}
}
});
},
 
fetchCreationInfo: function twinkleprodFetchCreationInfo() {
var tag_re = /(\{\{(?:db-?|delete|[aitcmrs]fd|md1)[^{}]*?\|?[^{}]*?\}\})/i;
var def = $.Deferred();
if( tag_re.test( text ) ) {
var ts = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Looking up page creator');
statelem.warn( 'Page already tagged with a deletion template, aborting procedure' );
ts.setFollowRedirect(true); // for NPP, and also because redirects are ineligible for PROD
return;
ts.setLookupNonRedirectCreator(true); // Look for author of first non-redirect revision
}
ts.lookupCreation(function(pageobj) {
params.initialContrib = pageobj.getCreator();
params.creation = pageobj.getCreationTimestamp();
pageobj.getStatusElement().info('Done, found ' + params.initialContrib);
def.resolve();
}, def.reject);
return def;
},
 
taggingPage: function twinkleprodTaggingPage() {
// Remove tags that become superfluous with this action
var def = $.Deferred();
text = text.replace(/\{\{\s*([Nn]ew unreviewed article|[Uu]nreviewed|[Uu]serspace draft)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/g, "");
 
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging page');
var prod_re = /\{\{\s*(?:dated prod|dated prod blp|Prod blp\/dated|Proposed deletion\/dated)\s*\|(?:\{\{[^\{\}]*\}\}|[^\}\{])*\}\}/i;
wikipedia_page.setFollowRedirect(true); // for NPP, and also because redirects are ineligible for PROD
var summaryText;
wikipedia_page.load(function(pageobj) {
if( !prod_re.test( text ) ) {
var statelem = pageobj.getStatusElement();
// Notification to first contributor
 
if( params.usertalk ) {
if (!pageobj.exists()) {
var thispage = new Morebits.wiki.page(mw.config.get('wgPageName'));
statelem.error("It seems that the page doesn't exist. Perhaps it has already been deleted.");
thispage.setCallbackParameters(params);
// reject, so that all dependent actions like notifyAuthor() and
thispage.lookupCreator(Twinkle.prod.callbacks.userNotification);
// addToLog() are cancelled
}
return def.reject();
// If not notifying, log this PROD
else if( Twinkle.getPref('logProdPages') ) {
Twinkle.prod.callbacks.addToLog(params);
}
 
var text = pageobj.getPageText();
summaryText = "Proposing article for deletion per [[WP:" + (params.blp ? "BLP" : "") + "PROD]].";
 
text = "{{subst:prod" + (params.blp ? " blp" : ("|1=" + Morebits.string.formatReasonText(params.reason))) + "}}\n" + text;
// Check for already existing deletion tags
}
var tag_re = /{{(?:db-?|delete|article for deletion\/dated|AfDM|ffd\b)|#invoke:Redirect for discussion/i;
else { // already tagged for PROD, so try endorsing it
if (tag_re.test(text)) {
var prod2_re = /\{\{(?:Proposed deletion endorsed|prod-?2).*?\}\}/;
statelem.warn('Page already tagged with a deletion template, aborting procedure');
if( prod2_re.test( text ) ) {
return def.reject();
statelem.warn( 'Page already tagged with {{proposed deletion}} and {{proposed deletion endorsed}} templates, aborting procedure' );
return;
}
var confirmtext = "A {{proposed deletion}} tag was already found on this article. \nWould you like to add a {{proposed deletion endorsed}} tag with your explanation?";
if (params.blp) {
confirmtext = "A non-BLP {{proposed deletion}} tag was found on this article. \nWould you like to add a {{proposed deletion endorsed}} tag with explanation \"article is a biography of a living person with no sources\"?";
}
if( !confirm( confirmtext ) ) {
statelem.warn( 'Aborted per user request' );
return;
}
 
summaryText = "Endorsing proposed deletion per [[WP:" + (params.blp ? "BLP" : "") + "PROD]].";
text = text.replace( prod_re, text.match( prod_re ) + "\n{{proposed deletion endorsed|1=" + (params.blp ?
"article is a [[WP:BLPPROD|biography of a living person with no sources]]" :
Morebits.string.formatReasonText(params.reason)) + "}}\n" );
 
// Remove tags that become superfluous with this action
if( Twinkle.getPref('logProdPages') ) {
text = text.replace(/{{\s*(userspace draft|mtc|(copy|move) to wikimedia commons|(copy |move )?to ?commons)\s*(\|(?:{{[^{}]*}}|[^{}])*)?}}\s*/gi, '');
var prod_re = /{{\s*(?:Prod blp|Proposed deletion|book-prod)\/dated(?: files)?\s*\|(?:{{[^{}]*}}|[^{}])*}}/i;
var summaryText;
 
if (!prod_re.test(text)) {
 
// Page previously PROD-ed
if (params.oldProdPresent) {
if (params.blp) {
if (!confirm('Previous PROD nomination found on talk page. Do you still want to continue applying BLPPROD? ')) {
statelem.warn('Previous PROD found on talk page, aborted by user');
return def.reject();
}
statelem.info('Previous PROD found on talk page, continuing');
} else {
statelem.warn('Previous PROD found on talk page, aborting procedure');
return def.reject();
}
}
 
// Alert if article is at least three days old, not in Category:Living people, and BLPPROD is selected
if (params.blp) {
var isMoreThan3DaysOld = new Morebits.date(params.creation).add(3, 'days').isAfter(new Date(pageobj.getLoadTime()));
var blpcheck_re = /\[\[Category:Living people\]\]/i;
if (!blpcheck_re.test(text) && isMoreThan3DaysOld) {
if (!confirm('Please note that the article is not in Category:Living people and hence may be ineligible for BLPPROD. Are you sure you want to continue? \n\nYou may wish to add the category if you proceed, unless the article is about a recently deceased person.')) {
return def.reject();
}
}
}
 
var tag;
if (params.blp) {
summaryText = 'Proposing article for deletion per [[WP:BLPPROD]].';
tag = '{{subst:prod blp' + (params.usertalk ? '|help=off' : '') + '}}';
} else if (params.book) {
summaryText = 'Proposing book for deletion per [[WP:BOOKPROD]].';
tag = '{{subst:book-prod|1=' + Morebits.string.formatReasonText(params.reason) + (params.usertalk ? '|help=off' : '') + '}}';
} else {
summaryText = 'Proposing ' + namespace + ' for deletion per [[WP:PROD]].';
tag = '{{subst:prod|1=' + Morebits.string.formatReasonText(params.reason) + (params.usertalk ? '|help=off' : '') + '}}';
}
 
// Insert tag after short description or any hatnotes
var wikipage = new Morebits.wikitext.page(text);
text = wikipage.insertAfterTemplates(tag + '\n', Twinkle.hatnoteRegex).getText();
 
} else { // already tagged for PROD, so try endorsing it
var prod2_re = /{{(?:Proposed deletion endorsed|prod-?2).*?}}/i;
if (prod2_re.test(text)) {
statelem.warn('Page already tagged with {{proposed deletion}} and {{proposed deletion endorsed}} templates, aborting procedure');
return def.reject();
}
var confirmtext = 'A {{proposed deletion}} tag was already found on this page. \nWould you like to add a {{proposed deletion endorsed}} tag with your explanation?';
if (params.blp && !/{{\s*Prod blp\/dated/.test(text)) {
confirmtext = 'A non-BLP {{proposed deletion}} tag was found on this article.\nWould you like to add a {{proposed deletion endorsed}} tag with explanation "article is a biography of a living person with no sources"?';
}
if (!confirm(confirmtext)) {
statelem.warn('Aborted per user request');
return def.reject();
}
 
summaryText = 'Endorsing proposed deletion per [[WP:' + (params.blp ? 'BLP' : params.book ? 'BOOK' : '') + 'PROD]].';
text = text.replace(prod_re, text.match(prod_re) + '\n{{Proposed deletion endorsed|1=' + (params.blp ?
'article is a [[WP:BLPPROD|biography of a living person with no sources]]' :
Morebits.string.formatReasonText(params.reason)) + '}}\n');
 
params.logEndorsing = true;
Twinkle.prod.callbacks.addToLog(params);
}
 
// curate/patrol the page
if (Twinkle.getPref('markProdPagesAsPatrolled')) {
pageobj.triage();
}
 
pageobj.setPageText(text);
pageobj.setEditSummary(summaryText);
pageobj.setChangeTags(Twinkle.changeTags);
pageobj.setWatchlist(Twinkle.getPref('watchProdPages'));
pageobj.setCreateOption('nocreate');
pageobj.save(def.resolve, def.reject);
 
}, def.reject);
return def;
},
 
addOldProd: function twinkleprodAddOldProd() {
var def = $.Deferred();
 
if (params.oldProdPresent) {
return def.resolve();
}
 
// Add {{Old prod}} to the talk page
pageobj.setPageText(text);
var oldprodfull = '{{Old prod|nom=' + mw.config.get('wgUserName') + '|nomdate={{subst:#time: Y-m-d}}}}\n';
pageobj.setEditSummary(summaryText + Twinkle.getPref('summaryAd'));
var talktitle = new mw.Title(mw.config.get('wgPageName')).getTalkPage().getPrefixedText();
pageobj.setWatchlist(Twinkle.getPref('watchProdPages'));
var talkpage = new Morebits.wiki.page(talktitle, 'Placing {{Old prod}} on talk page');
pageobj.setCreateOption('nocreate');
talkpage.setPrependText(oldprodfull);
pageobj.save();
talkpage.setEditSummary('Adding {{Old prod}}');
talkpage.setChangeTags(Twinkle.changeTags);
talkpage.setFollowRedirect(true); // match behavior for page tagging
talkpage.setCreateOption('recreate');
talkpage.prepend(def.resolve, def.reject);
return def;
},
 
userNotificationnotifyAuthor: function twinkleprodNotifyAuthor(pageobj) {
var paramsdef = pageobj$.getCallbackParametersDeferred();
 
var initialContrib = pageobj.getCreator();
if (!params.blp && !params.usertalk) {
return def.resolve();
}
 
// Disallow warning yourself
if (params.initialContrib === mw.config.get("'wgUserName"')) {
pageobjMorebits.getStatusElement()status.warninfo("'Notifying creator', 'You ("' + params.initialContrib + "') created this page; skipping user notification"');
return def.resolve();
if (Twinkle.getPref("logProdPages")) {
Twinkle.prod.callbacks.addToLog(params);
}
return;
}
// [[Template:Proposed deletion notify]] supports File namespace
var notifyTemplate;
if (params.blp) {
notifyTemplate = 'prodwarningBLP';
} else if (params.book) {
notifyTemplate = 'bprodwarning';
} else {
notifyTemplate = 'proposed deletion notify';
}
var notifytext = '\n{{subst:' + notifyTemplate + '|1=' + Morebits.pageNameNorm + '|concern=' + params.reason + '}} ~~~~';
 
var usertalkpage = new Morebits.wiki.page('User talk:' + params.initialContrib, "'Notifying initial contributor ("' + params.initialContrib + "')"');
var notifytext = "\n{{subst:prodwarning" + (params.blp ? "BLP" : "") + "|1=" + Morebits.pageNameNorm + "|concern=" + params.reason + "}} ~~~~";
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary("'Notification: proposed deletion of [[":' + Morebits.pageNameNorm + "']]." + Twinkle.getPref('summaryAd'));
usertalkpage.setChangeTags(Twinkle.changeTags);
usertalkpage.setCreateOption('recreate');
usertalkpage.setFollowRedirect(true, false);
usertalkpage.append(function onNotifySuccess(); {
// add nomination to the userspace log, if the user has enabled it
if (Twinkle.getPref('logProdPages')) {
params.logInitialContrib = params.initialContrib;
def.resolve();
Twinkle.prod.callbacks.addToLog(params);
}, def.resolve); // resolves even if notification was unsuccessful
}
},
 
return def;
addToLog: function(params) {
var wikipedia_page = new Morebits.wiki.page("User:" + mw.config.get('wgUserName') + "/" + Twinkle.getPref('prodLogPageName'), "Adding entry to userspace log");
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.prod.callbacks.saveLog);
},
 
saveLogaddToLog: function twinkleprodAddToLog(pageobj) {
if (!Twinkle.getPref('logProdPages')) {
var text = pageobj.getPageText();
return $.Deferred().resolve();
var params = pageobj.getCallbackParameters();
 
// add blurb if log page doesn't exist
if (!pageobj.exists()) {
text =
"This is a log of all [[WP:PROD|proposed deletion]] tags applied or endorsed by this user using [[WP:TW|Twinkle]]'s PROD 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]].\n";
}
var usl = new Morebits.userspaceLogger(Twinkle.getPref('prodLogPageName'));
usl.initialText =
"This is a log of all [[WP:PROD|proposed deletion]] tags applied or endorsed by this user using [[WP:TW|Twinkle]]'s PROD 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]].\n';
 
var logText = '# [[:' + Morebits.pageNameNorm + ']]';
// create monthly header
var date = new Date()summaryText;
// If a logged file is deleted but exists on commons, the wikilink will be blue, so provide a link to the log
var headerRe = new RegExp("^==+\\s*" + date.getUTCMonthName() + "\\s+" + date.getUTCFullYear() + "\\s*==+", "m");
logText += namespace === 'file' ? ' ([{{fullurl:Special:Log|page=' + mw.util.wikiUrlencode(mw.config.get('wgPageName')) + '}} log]): ' : ': ';
if (!headerRe.exec(text)) {
text += "\n\n=== " + date.getUTCMonthName() + " " + date.getUTCFullYear() + " ===";
}
 
var summarytext;
if (params.logEndorsing) {
textlogText += "\n#'endorsed [["' + Morebits(params.pageNameNormblp +? "]]:'BLP endorsed' ": + (params.blpbook ? "BLP "'BOOK' : ""'') + "'PROD. ~~~~~"';
if (params.reason) {
textlogText += "\n#* '''Reason''': " + params.reason + "'\n"';
}
summarytextsummaryText = "'Logging endorsement of PROD nomination of [[":' + Morebits.pageNameNorm + "']]."';
} else {
textlogText += "\n#(params.blp [["? +'BLP Morebits.pageNameNorm' + "]]: " + (params.blpbook ? "BLP "'BOOK' : ""'') + "'PROD"';
if (params.logInitialContrib) {
textlogText += "'; notified {{user|"' + params.logInitialContrib + "'}}"';
}
textlogText += "' ~~~~~\n"';
if (!params.blp && params.reason) {
textlogText += "#* '''Reason''': " + Morebits.string.formatReasonForLog(params.reason) + "'\n"';
}
summarytextsummaryText = "'Logging PROD nomination of [[":' + Morebits.pageNameNorm + "']]."';
}
usl.changeTags = Twinkle.changeTags;
 
return usl.log(logText, summaryText);
pageobj.setPageText(text);
pageobj.setEditSummary(summarytext + Twinkle.getPref('summaryAd'));
pageobj.setCreateOption("recreate");
pageobj.save();
}
 
};
 
Twinkle.prod.callback.evaluate = function twinkleprodCallbackEvaluate(e) {
var form = e.target;
var input = Morebits.quickForm.getInputData(form);
var prodtype;
 
params = {
var prodtypes = form.prodtype;
usertalk: input.notify || input.prodtype === 'prodblp',
for( var i = 0; i < prodtypes.length; i++ ) {
blp: input.prodtype === 'prodblp',
if( !prodtypes[i].checked ) {
book: namespace === 'book',
continue;
reason: input.reason || '' // using an empty string here as fallback will help with prod-2.
}
prodtype = prodtypes[i].values;
break;
}
 
var params = {
usertalk: form.notify.checked,
blp: prodtype === 'prodblp',
reason: prodtype === 'prodblp' ? '' : form.reason.value // using an empty string here as fallback will help with prod-2.
};
 
if (!params.blp && !params.reason) {
Morebits.simpleWindow.setButtonsEnabled( false );
if (!confirm('You left the reason blank, do you really want to continue without providing one?')) {
Morebits.status.init( form );
 
if (prodtype === 'prodblp' && mw.config.get('wgArticleId') < 26596183) {
if (!confirm( "It appears that this article was created before March 18, 2010, and is thus ineligible for a BLP PROD. Do you want to continue tagging it?" )) {
Morebits.status.warn( 'Notice', 'Aborting per user input.' );
return;
}
}
 
Morebits.simpleWindow.setButtonsEnabled(false);
Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.status.init(form);
Morebits.wiki.actionCompleted.notice = "Tagging complete";
 
var wikipedia_pagetm = new Morebits.wiki.pagetaskManager(mw.config.get('wgPageName'), "Tagging page");
var cbs = Twinkle.prod.callbacks; // shortcut reference, cbs for `callbacks`
wikipedia_page.setFollowRedirect(true); // for NPP, and also because redirects are ineligible for PROD
 
wikipedia_page.setCallbackParameters(params);
// Disable Morebits.wiki.numberOfActionsLeft system
wikipedia_page.load(Twinkle.prod.callbacks.main);
Morebits.wiki.numberOfActionsLeft = 1000;
 
// checkPriors() and fetchCreationInfo() have no dependencies, they'll run first
tm.add(cbs.checkPriors, []);
tm.add(cbs.fetchCreationInfo, []);
// tag the page once we're clear of the pre-requisites
tm.add(cbs.taggingPage, [ cbs.checkPriors ]);
// notify the author once we know who's the author, and also wait for the
// taggingPage() as we don't need to notify if tagging was not done, such as
// there was already a tag and the user chose not to endorse.
tm.add(cbs.notifyAuthor, [ cbs.fetchCreationInfo, cbs.taggingPage ]);
// oldProd needs to be added only if there wasn't one before, so need to wait
// for checkPriors() to finish. Also don't add oldProd if tagging itself was
// aborted or unsuccessful
tm.add(cbs.addOldProd, [ cbs.taggingPage, cbs.checkPriors ]);
// add to log only after notifying author so that the logging can be adjusted if
// notification wasn't successful. Also, don't run if tagging was not done.
tm.add(cbs.addToLog, [ cbs.notifyAuthor, cbs.taggingPage ]);
// All set, go!
tm.execute().then(function() {
Morebits.status.actionCompleted('Tagging complete');
setTimeout(function () {
window.location.href = mw.util.getUrl(mw.config.get('wgPageName'));
}, Morebits.wiki.actionCompleted.timeOut);
});
};
 
Twinkle.addInitCallback(Twinkle.prod, 'prod');
})(jQuery);
 
 
// </nowiki>
10,498

தொகுப்புகள்

"https://ta.wikipedia.org/wiki/சிறப்பு:MobileDiff/3108507" இருந்து மீள்விக்கப்பட்டது