ميدياويكي:Gadget-twinklexfd.js: الفرق بين النسختين

تم حذف المحتوى تمت إضافة المحتوى
تجربة
تجربة
سطر 1:
// <nowiki>
 
 
(function($) {
 
 
سطر 11:
* Mode of invocation: Tab ("XFD")
* Active on: Existing, non-special pages, except for file pages with no local (non-Commons) file which are not redirects
* Config directives in: TwinkleConfig
*/
 
السطر 17 ⟵ 18:
// * special pages
// * non-existent pages
// * files on Commons, whether there is a local page or not (unneeded local pages of files on Commons are eligible for CSD F2, or R4 if it's a redirect)
// * file pages without actual files (these are eligible for CSD G8)
if (mw.config.get('wgNamespaceNumber') < 0 || !mw.config.get('wgArticleId') || (mw.config.get('wgNamespaceNumber') === 6 && document.getElementById('mw-sharedupload'))) {
if ( mw.config.get('wgNamespaceNumber') < 0 || !mw.config.get('wgArticleId') || (mw.config.get('wgNamespaceNumber') === 6 && (document.getElementById('mw-sharedupload') || (!document.getElementById('mw-imagepage-section-filehistory') && !Morebits.wiki.isPageRedirect()))) ) {
return;
}
Twinkle.addPortletLink(Twinkle.xfd.callback, 'XFD', 'tw-xfd', 'ابدأ نقاش حذف');
 
Twinkle.addPortletLink(Twinkle.xfd.callback, 'XFD', 'tw-xfd', 'Start a deletion discussion');
};
 
Twinkle.xfd.num2order = function twinklexfdNum2order( num ) {
switch ( num ) {
case 1: return '';
case 2: return '2ndالثاني';
case 3: return '3rdالثالث';
default: return num + 'thال';
}
};
السطر 39 ⟵ 40:
Twinkle.xfd.printRationale = function twinklexfdPrintRationale() {
if (Twinkle.xfd.currentRationale) {
Morebits.status.printUserText(Twinkle.xfd.currentRationale, '"Your deletion rationale is provided below, which you can copy and paste into a new XFD dialog if you wish to try again:'");
// only need to print the rationale once
Twinkle.xfd.currentRationale = null;
السطر 46 ⟵ 47:
 
Twinkle.xfd.callback = function twinklexfdCallback() {
var Window = new Morebits.simpleWindow( 600, 350 );
Window.setTitle('Start a"ابدأ deletionنقاش discussionحذف (XfD)'" );
Window.setScriptName('Twinkle' "لمح البصر" );
Window.addFooterLink('About deletion"حول discussions'نقاشات الحذف", '"WP:XFD'" );
Window.addFooterLink('Twinkle help'"مساعدة لمح البصر", '"WP:TW/DOC#xfd'" );
 
var form = new Morebits.quickForm(Twinkle.xfd.callback.evaluate);
var categories = form.append({
type: 'select',
name: 'category',
label: 'Deletion discussion venue:',
tooltip: 'When activated, a default choice is made, based on what namespace you are in. This default should be the most appropriate; some inappropriate options may be disabled.',
event: Twinkle.xfd.callback.change_category
});
var namespace = mw.config.get('wgNamespaceNumber');
 
var form = new Morebits.quickForm( Twinkle.xfd.callback.evaluate );
var categories = form.append( {
type: 'select',
name: 'category',
label: 'مكان مناقشة الحذف:',
tooltip: 'عند التنشيط، يتم إجراء اختيار افتراضي، بناءً على مساحة الاسم التي تتواجد فيها. يجب أن يكون هذا الإعداد الافتراضي هو الأنسب؛ قد يتم تعطيل بعض الخيارات غير اللائقة.',
event: Twinkle.xfd.callback.change_category
} );
categories.append({
type: 'option',
السطر 67 ⟵ 66:
selected: namespace === 0, // Main namespace
value: 'afd'
} );
categories.append( {
type: 'option',
label: 'نظرخواهی حذف الگوها',
selected: mw.config.get('wgNamespaceNumber') === 10, // Template namespace
value: 'tfd'
} );
categories.append({
type: 'option',
السطر 74 ⟵ 79:
value: 'tfd',
disabled: namespace === 10 && /-stub$/.test(Morebits.pageNameNorm) // Stub templates at CfD
} );
categories.append({
type: 'option',
label: 'FfD (Files for discussion)',
selected: namespace === 6, // File namespace
value: 'ffd',
disabled: namespace !== 6
});
categories.append({
type: 'option',
السطر 88 ⟵ 86:
value: 'cfd',
disabled: [ 10, 14 ].indexOf(namespace) === -1 // Disabled outside category and templatespace
} );
categories.append({
type: 'option',
السطر 94 ⟵ 92:
value: 'cfds',
disabled: namespace !== 14
} );
categories.append({
type: 'option',
السطر 101 ⟵ 99:
// Other namespaces, and userboxes in template namespace
value: 'mfd'
} );
categories.append({
type: 'option',
السطر 107 ⟵ 105:
selected: Morebits.wiki.isPageRedirect(),
value: 'rfd'
} );
categoriesform.append( {
type: 'optioncheckbox',
list: [
label: 'RM (Requested moves)',
{
selected: false,
label: 'نبه منشئ الصفحة إذا كان ذلك ممكنًا',
value: 'rm',
value: 'notify',
disabled: namespace === 14
name: 'notify',
});
tooltip: "سيتم وضع نموذج إشعار على صفحة نقاش المنشئ إذا كان هذا ممكنًا.",
 
checked: true
form.append({
}
type: 'checkbox',
list: [ ]
{}
);
label: 'Notify page creator if possible',
form.append( {
value: 'notify',
nametype: 'notifyfield',
label:'مكان العمل',
tooltip: "A notification template will be placed on the creator's talk page if this is true.",
checkedname: true'work_area'
} );
form.append( { type:'submit' } );
]
});
form.append({
type: 'field',
label: 'Work area',
name: 'work_area'
});
 
var previewlink = document.createElement('a');
$(previewlink).click(function() {
Twinkle.xfd.callbacks.preview(result); // |result| is defined below
});
previewlink.style.cursor = 'pointer';
previewlink.textContent = 'Preview';
form.append({ type: 'div', id: 'xfdpreview', label: [ previewlink ] });
form.append({ type: 'div', id: 'twinklexfd-previewbox', style: 'display: none' });
 
form.append({ type: 'submit' });
 
var result = form.render();
Window.setContent( result );
Window.display();
result.previewer = new Morebits.wiki.preview($(result).find('div#twinklexfd-previewbox').last()[0]);
 
// We must init the controls
var evt = document.createEvent(' "Event'" );
evt.initEvent( 'change', true, true );
result.category.dispatchEvent( evt );
};
 
Twinkle.xfd.previousNotify = true;
 
Twinkle.xfd.callback.change_category = function twinklexfdCallbackChangeCategory(e) {
var value = e.target.value;
var form = e.target.form;
var old_area = Morebits.quickForm.getElements(e.target.form, '"work_area'")[0];
var work_area = null;
 
var oldreasontextbox = form.getElementsByTagName('textarea')[0];
var oldreason = (oldreasontextbox ? oldreasontextbox.value : '');
 
var appendReasonBox = function twinklexfdAppendReasonBox() {
work_area.append( {
type: 'textarea',
name: 'xfdreason',
label: 'Reasonالسبب: ',
value: oldreason,
tooltip: 'يمكنك استخدام علامات ويكي في سببك. سيقوم لمح البصر تلقائيًا بتوقيع مشاركتك.'
tooltip: 'You can use wikimarkup in your reason. Twinkle will automatically sign your post.'
} );
// TODO possible future "preview" link here
};
 
switch( value ) {
form.previewer.closePreview();
case 'afd':
 
work_area = new Morebits.quickForm.element( {
switch (value) {
case 'afd':
work_area = new Morebits.quickForm.element({
type: 'field',
label: 'Articlesمقالات for deletionللحذف',
name: 'work_area'
} );
work_area.append( {
type: 'checkbox',
list: [
{
label: 'Wrapلف deletionوسم tagالحذف باستعمال with <noinclude>',
value: 'noinclude',
name: 'noinclude',
tooltip: 'Willسيضع wrapقالب theالحذف deletionفي tag in &lt;noinclude&gt; tags,بالتالي soلن thatيتم it won\'t transcludeتضمينه. Thisهذا optionالخيار isلا notيختار normallyبشكلٍ requiredطبيعي. '
}
]
} );
var afd_category = work_area.append( {
type: 'select',
name: 'xfdcat',
label: 'Chooseما هو whatالتصنيف categoryالذي thisينتمي nominationإليه belongsهذا inالترشيح:'
} );
 
afd_category.append( { type: 'option', label:'غير 'Unknownمعلوم', value: '?', selected: true } );
afd_category.append( { type: 'option', label: 'Mediaالإعلام and musicوالموسيقى', value: 'M' } );
afd_category.append({ type: 'option', label: 'Organisation, corporation,المنظمات orوالشركات productوالمنتجات', value: 'O' });
afd_category.append({ type: 'option', label: 'Biographicalسير ذاتية', value: 'B' });
afd_category.append({ type: 'option', label: 'Society topics', value: 'S' });
afd_category.append({ type: 'option', label: 'Web or internet', value: 'W' });
afd_category.append({ type: 'option', label: 'Games or sports', value: 'G' });
afd_category.append({ type: 'option', label: 'Science and technology', value: 'T' });
afd_category.append({ type: 'option', label: 'Fiction and the arts', value: 'F' });
afd_category.append({ type: 'option', label: 'Places and transportation', value: 'P' });
afd_category.append({ type: 'option', label: 'Indiscernible or unclassifiable topic', value: 'I' });
afd_category.append({ type: 'option', label: 'Debate not yet sorted', value: 'U' });
 
appendReasonBox();
// delsort categories list copied off [[User:Enterprisey/delsort.js]], originally taken from [[WP:DS/C]]
work_area = work_area.render();
var delsortCategories = {
old_area.parentNode.replaceChild( work_area, old_area );
'People': ['People', 'Academics and educators', 'Actors and filmmakers', 'Artists', 'Authors', 'Bands and musicians', 'Businesspeople', 'Politicians', 'Sportspeople', 'Women', 'Lists of people'],
break;
'Arts': ['Arts', 'Fictional elements', 'Science fiction and fantasy'],
case 'tfd':
'Arts/Culinary': ['Food and drink', 'Wine'],
work_area = new Morebits.quickForm.element( {
'Arts/Language': ['Language', 'Academic journals', 'Bibliographies', 'Journalism', 'Literature', 'Logic', 'News media', 'Philosophy', 'Poetry'],
'Arts/Performing': ['Albums and songs', 'Dance', 'Film', 'Magic', 'Music', 'Radio', 'Television', 'Theatre', 'Video games'],
'Arts/Visual arts': ['Visual arts', 'Architecture', 'Fashion', 'Photography'],
'Arts/Comics and animation': ['Comics and animation', 'Anime and manga', 'Webcomics'],
'Places of interest': ['Museums and libraries', 'Shopping malls'],
'Topical': ['Animal', 'Bilateral relations', 'Business', 'Conservatism', 'Conspiracy theories', 'Crime', 'Disability', 'Discrimination', 'Ethnic groups', 'Events', 'Games', 'Health and fitness', 'History', 'Law', 'Military', 'Organizations', 'Paranormal', 'Piracy', 'Politics', 'Terrorism'],
'Topical/Business': ['Business', 'Advertising', 'Companies', 'Management', 'Finance'],
'Topical/Culture': ['Beauty pageants', 'Fashion', 'Mythology', 'Popular culture', 'Sexuality and gender'],
'Topical/Education': ['Education', 'Fraternities and sororities', 'Schools'],
'Topical/Religion': ['Religion', 'Atheism', 'Bible', 'Buddhism', 'Christianity', 'Islam', 'Judaism', 'Hinduism', 'Paganism', 'Sikhism', 'Spirituality'],
'Topical/Science': ['Science', 'Archaeology', 'Astronomy', 'Behavioural science', 'Economics', 'Environment', 'Geography', 'Mathematics', 'Medicine', 'Organisms', 'Social science', 'Transportation'],
'Topical/Sports': ['Sports', 'American football', 'Baseball', 'Basketball', 'Bodybuilding', 'Boxing', 'Cricket', 'Cycling', 'Football', 'Golf', 'Horse racing', 'Ice hockey', 'Rugby union', 'Softball', 'Martial arts', 'Wrestling'],
'Topical/Technology': ['Technology', 'Aviation', 'Computing', 'Firearms', 'Internet', 'Software', 'Websites'],
'Wikipedia page type': ['Disambiguations', 'Lists'],
'Geographic/Africa': ['Africa', 'Egypt', 'Ethiopia', 'Ghana', 'Kenya', 'Laos', 'Mauritius', 'Morocco', 'Nigeria', 'Somalia', 'South Africa', 'Zimbabwe'],
'Geographic/Asia': ['Asia', 'Afghanistan', 'Bangladesh', 'Bahrain', 'Brunei', 'Cambodia', 'China', 'Hong Kong', 'India', 'Indonesia', 'Japan', 'Korea', 'Malaysia', 'Maldives', 'Mongolia', 'Myanmar', 'Nepal', 'Pakistan', 'Philippines', 'Singapore', 'South Korea', 'Sri Lanka', 'Taiwan', 'Thailand', 'Vietnam'],
'Geographic/Asia/Central Asia': ['Central Asia', 'Kazakhstan', 'Kyrgyzstan', 'Tajikistan', 'Turkmenistan', 'Uzbekistan'],
'Geographic/Asia/Middle East': ['Middle East', 'Iran', 'Iraq', 'Israel', 'Jordan', 'Kuwait', 'Lebanon', 'Libya', 'Palestine', 'Saudi Arabia', 'Syria', 'United Arab Emirates', 'Yemen', 'Qatar'],
'Geographic/Europe': ['Europe', 'Albania', 'Armenia', 'Austria', 'Azerbaijan', 'Belarus', 'Belgium', 'Bosnia and Herzegovina', 'Bulgaria', 'Croatia', 'Cyprus', 'Czech Republic', 'Denmark', 'Estonia', 'Finland', 'France', 'Georgia (country)', 'Germany', 'Greece', 'Hungary', 'Iceland', 'Ireland', 'Italy', 'Jersey', 'Kosovo', 'Latvia', 'Lithuania', 'Luxembourg', 'Macedonia', 'Malta', 'Moldova', 'Montenegro', 'Netherlands', 'Norway', 'Poland', 'Portugal', 'Romania', 'Russia', 'Serbia', 'Slovakia', 'Slovenia', 'Spain', 'Sweden', 'Switzerland', 'Turkey', 'Ukraine', 'Yugoslavia'],
'Geographic/Europe/United Kingdom': ['United Kingdom', 'England', 'Northern Ireland', 'Scotland', 'Wales'],
'Geographic/Oceania': ['Oceania', 'Antarctica', 'Australia', 'New Zealand'],
'Geographic/Americas/Canada': ['Canada', 'British Columbia', 'Manitoba', 'Nova Scotia', 'Ontario', 'Quebec', 'Alberta'],
'Geographic/Americas/Latin America': ['Latin America', 'Caribbean', 'South America', 'Argentina', 'Barbados', 'Belize', 'Bolivia', 'Brazil', 'Chile', 'Colombia', 'Cuba', 'Ecuador', 'El Salvador', 'Guatemala', 'Haiti', 'Mexico', 'Nicaragua', 'Panama', 'Paraguay', 'Peru', 'Puerto Rico', 'Trinidad and Tobago', 'Uruguay', 'Venezuela', 'Grenada'],
'Geographic/Americas/USA': ['United States of America', 'Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California', 'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia (U.S. state)', 'Hawaii', 'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana', 'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota', 'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire', 'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota', 'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island', 'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont', 'Virginia', 'Washington', 'Washington, D.C.', 'West Virginia', 'Wisconsin', 'Wyoming'],
'Geographic/Unsorted': ['Islands']
};
 
var delsort = work_area.append({
type: 'select',
multiple: true,
name: 'delsort',
label: 'Choose deletion sorting categories: ',
tooltip: 'Select a few categories that are specifically relevant to the subject of the article. Be as precise as possible; categories like People and USA should only be used when no other categories apply.'
});
 
$.each(delsortCategories, function(groupname, list) {
var group = delsort.append({ type: 'optgroup', label: groupname });
list.forEach(function(item) {
group.append({ type: 'option', label: item, value: item });
});
});
 
appendReasonBox();
work_area = work_area.render();
old_area.parentNode.replaceChild(work_area, old_area);
 
$(work_area).find('[name=delsort]')
.attr('data-placeholder', 'Select delsort pages')
.select2({
width: '100%',
matcher: Morebits.select2.matcher,
templateResult: Morebits.select2.highlightSearchMatches,
language: {
searching: Morebits.select2.queryInterceptor
},
// Link text to the page itself
templateSelection: function(choice) {
return $('<a>').text(choice.text).attr({
href: mw.util.getUrl('Wikipedia:WikiProject_Deletion_sorting/' + choice.text),
target: '_blank'
});
}
});
 
mw.util.addCSS(
// prevent dropdown from appearing behind the dialog, just in case
'.select2-container { z-index: 10000; }' +
 
// Remove black border
'.select2-container--default.select2-container--focus .select2-selection--multiple { border: 1px solid #aaa; }' +
 
// Reduce padding
'.select2-results .select2-results__option { padding-top: 1px; padding-bottom: 1px; }' +
'.select2-results .select2-results__group { padding-top: 1px; padding-bottom: 1px; } ' +
 
// Adjust font size
'.select2-container .select2-dropdown .select2-results { font-size: 13px; }' +
'.select2-container .selection .select2-selection__rendered { font-size: 13px; }' +
 
// Make the tiny cross larger
'.select2-selection__choice__remove { font-size: 130%; }'
);
break;
case 'tfd':
work_area = new Morebits.quickForm.element({
type: 'field',
label: 'Templatesنظرخواهی forحذف discussionالگوها',
name: 'work_area'
} );
work_area.append( {
type: 'div',
label: 'الگوهای خرد و جعبه‌های کاربری در نظرخواهی حذف الگوها بررسی نمی‌شوند. الگوهای خرد به نظرخواهی حذف رده‌ها و جعبه‌های کاربری به نظرخواهی حذف متفرقه می‌روند.'
label: 'Userboxes are not eligible for TfD; they go to MfD.'
} );
var tfd_category = work_area.append( {
var templateOrModule = mw.config.get('wgPageContentModel') === 'Scribunto' ? 'module' : 'template';
var tfd_category = work_area.append({
type: 'select',
label: 'Chooseحدد typeالإجراء of action wantedالمطلوب: ',
name: 'xfdcat',
event: function(e) {
var target = e.target;
// add/remove extra input box
if ( target.value === 'tfm' && !target.form.xfdtarget ) { // $(target.parentNode).find("input[name='xfdtarget']").length === 0 ) {
var xfdtarget = new Morebits.quickForm.element( {
name: 'xfdtarget',
type: 'input',
label: 'Otherنمط ' + templateOrModule + ' to beآخر mergedللدمج: ',
} );
tooltip: 'Required. Should not include the ' + Morebits.string.toUpperCaseFirstChar(templateOrModule) + ': namespace prefix.',
required: true
});
target.parentNode.appendChild(xfdtarget.render());
} else {
$(Morebits.quickForm.getElementContainer(target.form.xfdtarget)).remove();
target.form.xfdtarget = null;
// $(target.parentNode).find("input[name='xfdtarget']").remove();
}
}
} );
tfd_category.append( { type: 'option', label: 'Deletion', value: 'tfd', selected: true } );
tfd_category.append( { type: 'option', label: 'Merge', value: 'tfm' } );
work_area.append( {
 
var tfd_template_type = work_area.append({
type: 'select',
name: 'templatetype',
label: 'Deletion tag display style: ',
tooltip: 'Which <code>type=</code> parameter to pass to the TfD tag template.'
});
if (templateOrModule === 'module') {
tfd_template_type.append({ type: 'option', value: 'module', label: 'Module', selected: true });
} else {
tfd_template_type.append({ type: 'option', value: 'standard', label: 'Standard', selected: true });
tfd_template_type.append({ type: 'option', value: 'sidebar', label: 'Sidebar/infobox', selected: $('.infobox').length });
tfd_template_type.append({ type: 'option', value: 'inline', label: 'Inline template' });
tfd_template_type.append({ type: 'option', value: 'tiny', label: 'Tiny inline' });
}
 
work_area.append({
type: 'checkbox',
list: [
{
label: 'علامة الحذف داخل السطر',
label: 'Wrap deletion tag with <noinclude> (for substituted templates only)',
value: 'noincludetfdinline',
name: 'noincludetfdinline',
tooltip: 'WillUse wrap{{tfd|type=inline}} the deletionto tag inthe &lt;noinclude&gt;page tags,instead soof that{{tfd}}. itGood won\'tfor getinline substitutedtemplates along(those withthat appear amongst the templatewords of text).',
checked: false
disabled: templateOrModule === 'module',
},
checked: !!$('.box-Subst_only').length // Default to checked if page carries {{subst only}}
} {
label: 'برچسب حذف را در <noinclude> بپیچان (تنها برای الگوهای جاینشین‌شونده)',
]
value: 'noinclude',
});
name: 'noinclude',
 
tooltip: 'Will wrap the deletion tag in &lt;noinclude&gt; tags, so that it won\'t get substituted along with the template.'
appendReasonBox();
}
work_area = work_area.render();
]
old_area.parentNode.replaceChild(work_area, old_area);
break} );
appendReasonBox();
case 'mfd':
work_area = new Morebits.quickFormwork_area.elementrender({);
old_area.parentNode.replaceChild( work_area, old_area );
break;
case 'mfd':
work_area = new Morebits.quickForm.element( {
type: 'field',
label: 'Miscellanyمتنوعة for deletionلحذفها',
name: 'work_area'
} );
work_area.append( {
type: 'checkbox',
list: [
{
label: 'قراردادن برچسب حذف در میان <noinclude>',
value: 'noinclude',
name: 'noinclude',
tooltip: 'Will wrap the deletion tag in &lt;noinclude&gt; tags, so that it won\'t transclude. Select this option for userboxes.'
}
]
} );
if (mw.config.get('wgNamespaceNumber') === 2 /* User: */ || mw.config.get('wgNamespaceNumber') === 3 /* User talk: */) {
work_area.append( {
type: 'checkbox',
list: [
{
label: 'Wrap deletion tag with <noinclude>',
value: 'noinclude',
name: 'noinclude',
tooltip: 'Will wrap the deletion tag in &lt;noinclude&gt; tags, so that it won\'t transclude. Select this option for userboxes.'
}
]
});
if ((mw.config.get('wgNamespaceNumber') === 2 /* User: */ || mw.config.get('wgNamespaceNumber') === 3 /* User talk: */) && mw.config.exists('wgRelevantUserName')) {
work_area.append({
type: 'checkbox',
list: [
{
label: 'Alsoهمچنین notifyاگر ownerمالک ofفضای userspaceنام ifسازندهٔ theyاین areصفحه notنیست، theاو pageرا creatorنیز مطلع کن',
value: 'notifyuserspace',
name: 'notifyuserspace',
tooltip: 'If the user in whose userspace this page is located, is not the page creator (for example, the page is a rescued article stored as a userspace draft), notify the userspace owner as well.',
checked: true
}
]
} );
}
appendReasonBox();
work_area = work_area.render();
old_area.parentNode.replaceChild( work_area, old_area );
break;
case 'ffd':
work_area = new Morebits.quickForm.element( {
type: 'field',
label: 'Discussion venues for files',
name: 'work_area'
} );
work_area.append( {
appendReasonBox();
type: 'radio',
work_area = work_area.render();
name: 'ffdvenue',
old_area.parentNode.replaceChild(work_area, old_area);
event: Twinkle.xfd.callback.ffdvenue_change,
break;
list: [
case 'cfd':
{
work_area = new Morebits.quickForm.element({
label: 'نظرخواهی حذف پرونده',
value: 'ffd',
tooltip: 'General deletion discussion',
checked: mw.config.get('wgNamespaceNumber') === 6
},
{
label: 'پرونده احتمالاً غیر آزاد',
value: 'puf',
tooltip: 'File has disputed source or licensing information'
},
{
label: 'Non-free content review',
value: 'nfcr',
tooltip: 'File\'s compliance with non-free content criteria ([[WP:NFCC]]) is disputed. User notification does not occur for NFCR, as it is not deemed relevant.',
checked: mw.config.get('wgNamespaceNumber') !== 6
}
]
} );
appendReasonBox();
work_area = work_area.render();
old_area.parentNode.replaceChild( work_area, old_area );
break;
case 'cfd':
work_area = new Morebits.quickForm.element( {
type: 'field',
label: 'Categoriesنظرخواهی forحذف discussionرده',
name: 'work_area'
} );
var cfd_category = work_area.append( {
var isCategory = mw.config.get('wgNamespaceNumber') === 14;
var cfd_category;
cfd_category = work_area.append({
type: 'select',
label: 'Chooseعمل typeدلخواه ofرا actionانتخاب wantedکنید: ',
name: 'xfdcat',
event: function(e) {
السطر 433 ⟵ 337:
var target = e.target.form.xfdtarget;
// update enabled status
if( (value === 'cfd' || value === 'sfd-t') {
target.disabled = true;
target.required = false;
} else {
target.disabled = false;
target.required = true;
}
if// (isCategory)update {label
//if( updatevalue label=== 'cfs' ) {
target.previousSibling.textContent = "رده هدف: ";
if (value === 'cfs') {
} else if( value === 'cfc' ) {
target.previousSibling.textContent = 'Target categories: ';
target.previousSibling.textContent = "مقاله هدف: ";
} else if (value === 'cfc') {
} else {
target.previousSibling.textContent = 'Target"رده articleهدف: '";
} else {
// add/remove extra input box
target.previousSibling.textContent = 'Target category: ';
if( value === 'cfs' && $(target.parentNode).find("input[name='xfdtarget2']").length === 0 ) {
}
//var add/removexfdtarget2 extra= document.createElement("input box");
if (value === 'cfs' && $(targetxfdtarget2.parentNode).findsetAttribute("input[name='", "xfdtarget2']").length === 0) {;
var xfdtarget2 = document.createElementsetAttribute('input'"type", "text");
xfdtarget2target.parentNode.setAttributeappendChild('name', 'xfdtarget2');
} else {
xfdtarget2.setAttribute('type', 'text');
$(target.parentNode).find("input[name='xfdtarget2']").remove();
xfdtarget2.setAttribute('required', 'true');
target.parentNode.appendChild(xfdtarget2);
} else {
$(target.parentNode).find("input[name='xfdtarget2']").remove();
}
} else { // Update stub template label
target.previousSibling.textContent = 'Target stub template: ';
}
}
} );
cfd_category.append( { type: 'option', label: 'حذف', value: 'cfd', selected: true } );
 
cfd_category.append( { type: 'option', label: 'ادغام', value: 'cfm' } );
if (isCategory) {
cfd_category.append( { type: 'option', label: 'Deletionتغییر نام', value: 'cfdcfr', selected:} true });
cfd_category.append( { type: 'option', label: 'Mergeتفکیک', value: 'cfmcfs' } );
cfd_category.append( { type: 'option', label: 'Renamingتبدیل به مقاله', value: 'cfrcfc' } );
cfd_category.append({ type: 'option', label: 'Split', value: 'cfs' });
cfd_category.append({ type: 'option', label: 'Convert into article', value: 'cfc' });
} else {
cfd_category.append({ type: 'option', label: 'Stub Deletion', value: 'sfd-t', selected: true });
cfd_category.append({ type: 'option', label: 'Stub Renaming', value: 'sfr-t' });
}
 
work_area.append( {
type: 'input',
name: 'xfdtarget',
label: 'Targetصفحه categoryهدف: ', // default, changed above
disabled: true,
value: ''
} );
appendReasonBox();
work_area = work_area.render();
old_area.parentNode.replaceChild( work_area, old_area );
break;
case 'cfds':
work_area = new Morebits.quickForm.element( {
type: 'field',
label: 'Categoriesنظرخواهی forتغییر speedyنام renamingرده',
name: 'work_area'
} );
var cfds_category = work_area.append( {
type: 'select',
label: 'C2زیر sub-criterionمعیار ر۲: ',
name: 'xfdcat',
tooltip: 'See WP:CFDS for full explanations.',
event: function(e) {
});
var value = e.target.value;
cfds_category.append({ type: 'option', label: 'C2A: Typographic and spelling fixes', value: 'C2A', selected: true });
var target = e.target.form.xfdtarget;
cfds_category.append({ type: 'option', label: 'C2B: Naming conventions and disambiguation', value: 'C2B' });
if( value === 'cfd' ) {
cfds_category.append({ type: 'option', label: 'C2C: Consistency with names of similar categories', value: 'C2C' });
target.disabled = true;
cfds_category.append({ type: 'option', label: 'C2D: Rename to match article name', value: 'C2D' });
} else {
cfds_category.append({ type: 'option', label: 'C2E: Author request', value: 'C2E' });
target.disabled = false;
cfds_category.append({ type: 'option', label: 'C2F: One eponymous article', value: 'C2F' });
}
}
} );
cfds_category.append( { type: 'option', label: 'C2A: Typographic and spelling fixes', value: 'C2A', selected: true } );
cfds_category.append( { type: 'option', label: 'C2B: Naming conventions and disambiguation', value: 'C2B' } );
cfds_category.append( { type: 'option', label: 'C2C: Consistency with names of similar categories', value: 'C2C' } );
cfds_category.append( { type: 'option', label: 'C2D: Rename to match article name', value: 'C2D' } );
cfds_category.append( { type: 'option', label: 'C2E: Author request', value: 'C2E' } );
 
work_area.append( {
type: 'input',
name: 'xfdtarget',
label: 'Newنام nameجدید: ',
value: '',
required:} true);
appendReasonBox();
});
work_area = work_area.render();
appendReasonBox();
old_area.parentNode.replaceChild( work_area, old_area );
work_area = work_area.render();
break;
old_area.parentNode.replaceChild(work_area, old_area);
case 'rfd':
break;
work_area = new Morebits.quickForm.element( {
case 'rfd':
work_area = new Morebits.quickForm.element({
type: 'field',
label: 'Redirects for discussion',
name: 'work_area'
} );
appendReasonBox();
 
work_area = work_area.appendrender({);
old_area.parentNode.replaceChild( work_area, old_area );
type: 'checkbox',
break;
list: [
default:
{
work_area = new Morebits.quickForm.element( {
label: 'Notify target page if possible',
value: 'relatedpage',
name: 'relatedpage',
tooltip: "A notification template will be placed on the talk page of this redirect's target if this is true.",
checked: true
}
]
});
appendReasonBox();
work_area = work_area.render();
old_area.parentNode.replaceChild(work_area, old_area);
break;
 
case 'rm':
work_area = new Morebits.quickForm.element({
type: 'field',
label: 'Requestedهیچ‌چیز movesبرای هرچیز',
name: 'work_area'
} );
work_area = work_area.appendrender({);
old_area.parentNode.replaceChild( work_area, old_area );
type: 'checkbox',
break;
list: [
{
label: 'Uncontroversial technical request',
value: 'rmtr',
name: 'rmtr',
tooltip: 'Use this option when you are unable to perform this uncontroversial move yourself because of a technical reason (e.g. a page already exists at the new title, or the page is protected)',
checked: false,
event: function() {
form.newname.required = this.checked;
}
}
]
});
work_area.append({
type: 'input',
name: 'newname',
label: 'New title: ',
tooltip: 'Required for technical requests. Otherwise, if unsure of the appropriate title, you may leave it blank.'
});
 
appendReasonBox();
work_area = work_area.render();
old_area.parentNode.replaceChild(work_area, old_area);
break;
 
default:
work_area = new Morebits.quickForm.element({
type: 'field',
label: 'Nothing for anything',
name: 'work_area'
});
work_area = work_area.render();
old_area.parentNode.replaceChild(work_area, old_area);
break;
}
 
// Return to checked state when switching, but noNo creator notification for CFDS or RM
if (value === '"cfds' || value === 'rm'") {
Twinkle.xfd.previousNotify = form.notify.checked;
form.notify.checked = false;
form.notify.disabled = true;
} else {
form.notify.checked = trueTwinkle.xfd.previousNotify;
form.notify.disabled = false;
}
};
 
Twinkle.xfd.setWatchPrefcallback.ffdvenue_change = function twinklexfdsetWatchPreftwinklexfdCallbackFfdvenueChange(pageobj, prefe) {
if (e.target.values === "nfcr") {
switch (pref) {
e.target.form.notify.disabled = true;
case 'yes':
e.target.form.notify.checked = false;
pageobj.setWatchlist(true);
} else {
break;
e.target.form.notify.disabled = false;
case 'no':
e.target.form.notify.checked = true;
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
};
 
Twinkle.xfd.callbacks = {
getDiscussionWikitext: function(venue, params) {
if (venue === 'cfds') { // CfD/S takes a completely different style
return '* [[:' + Morebits.pageNameNorm + ']] to [[:' + params.target + ']]\u00A0\u2013 ' +
params.xfdcat + (params.reason ? ': ' + Morebits.string.formatReasonText(params.reason) : '.') + ' ~~~~';
// U+00A0 NO-BREAK SPACE; U+2013 EN RULE
}
if (venue === 'rm') {
// even if invoked from talk page, propose the subject page for move
var pageName = new mw.Title(Morebits.pageNameNorm).getSubjectPage().toText();
return (params.rmtr ?
'{{subst:RMassist|1=' + pageName + '|2=' + params.newname :
'{{subst:Requested move|current1=' + pageName + '|new1=' + params.newname)
+ '|reason=' + params.reason + '}}';
}
 
var text = '{{subst:' + venue + '2';
var reasonKey = venue === 'ffd' ? 'Reason' : 'text';
// Add a reason unconditionally, so that at least a signature is added
if (params.reason) {
text += '|' + reasonKey + '=' + Morebits.string.formatReasonText(params.reason) + ' ~~~~';
} else {
text += '|' + reasonKey + '=~~~~';
}
 
if (venue === 'afd' || venue === 'mfd') {
text += '|pg=' + Morebits.pageNameNorm;
if (venue === 'afd') {
text += '|cat=' + params.xfdcat;
}
} else if (venue === 'rfd') {
text += '|redirect=' + Morebits.pageNameNorm;
} else {
text += '|1=' + mw.config.get('wgTitle');
if (mw.config.get('wgPageContentModel') === 'Scribunto') {
text += '|module=Module:';
}
}
 
if (params.target) {
if (venue === 'rfd') {
text += '|target=' + params.target + (params.section ? '#' + params.section : '');
} else if (venue !== 'cfd' && venue !== 'sfd-t') {
text += '|2=' + params.target;
}
}
if (params.target2) {
text += '|3=' + params.target2;
}
if (params.uploader) {
text += '|Uploader=' + params.uploader;
}
 
text += '}}';
 
if (params.delsort_cats) { // Only for AFDs
params.delsort_cats.forEach(function (cat) {
text += '\n{{subst:delsort|' + cat + '|~~~~}}';
});
}
 
return text;
},
showPreview: function(form, venue, params) {
var templatetext = Twinkle.xfd.callbacks.getDiscussionWikitext(venue, params);
if (venue === 'rm') { // RM templates are sensitive to page title
form.previewer.beginRender(templatetext, params.rmtr ? 'Wikipedia:Requested moves/Technical requests' : mw.Title.newFromText(Morebits.pageNameNorm).getTalkPage().toText());
} else {
form.previewer.beginRender(templatetext, 'WP:TW'); // Force wikitext
}
},
preview: function(form) {
var venue = form.category.value;
var params = {
reason: form.xfdreason.value
};
 
if (form.xfdcat) {
params.xfdcat = form.xfdcat.value;
}
 
// Remove CfD or TfD namespace prefixes
if (venue === 'tfd' || venue === 'cfd') {
var namespace_re = new RegExp('^:?' + mw.config.get('wgCanonicalNamespace') + ':', 'i');
if (form.xfdtarget) { // CfD or TfD
params.target = Morebits.string.toUpperCaseFirstChar(form.xfdtarget.value.replace(namespace_re, ''));
}
if (form.xfdtarget2) { // CfD
params.target2 = Morebits.string.toUpperCaseFirstChar(form.xfdtarget2.value.replace(namespace_re, ''));
}
} else if (venue === 'cfds' && form.xfdtarget.value) { // Add namespace to CfD/S
params.target = /^Category:/.test(form.xfdtarget.value) ? form.xfdtarget.value : 'Category:' + form.xfdtarget.value;
}
 
params.delsort_cats = $(form.delsort).val();
if (form.rmtr) {
params.rmtr = form.rmtr.checked;
}
if (form.newname) {
params.newname = form.newname.value;
}
 
if (venue === 'ffd') {
// Fetch the uploader
var page = new Morebits.wiki.page(mw.config.get('wgPageName'));
page.lookupCreation(function() {
params.uploader = page.getCreator();
Twinkle.xfd.callbacks.showPreview(form, venue, params);
});
} else if (venue === 'rfd') { // Find the target
Twinkle.xfd.callbacks.rfd.findTarget(params, function(params) {
Twinkle.xfd.callbacks.showPreview(form, venue, params);
});
} else if (venue === 'cfd') { // Swap in CfD subactions
Twinkle.xfd.callbacks.showPreview(form, params.xfdcat, params);
} else {
Twinkle.xfd.callbacks.showPreview(form, venue, params);
}
},
addToLog: function(params, initialContrib) {
var usl = new Morebits.userspaceLogger(Twinkle.getPref('xfdLogPageName'));// , 'Adding entry to userspace log');
 
usl.initialText =
"This is a log of all [[WP:XFD|deletion discussion]] nominations made by this user using [[WP:TW|Twinkle]]'s XfD 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 XfD-related deletions made using Twinkle.' : '');
 
var editsummary = 'Logging ' + params.venue + ' nomination of [[:' + Morebits.pageNameNorm + ']].';
// Provide Wikipedian TLA style: AfD, RfD, CfDS, RM, SfD, etc.
var toTLACase = function(str) {
// return str.toString().toUpperCase().replace(/\BF/, 'f');
return str.toString().toUpperCase().replace(/(.)F(.)(?:-.)?/, '$1f$2');
};
// If a logged file is deleted but exists on commons, the wikilink will be blue, so provide a link to the log
var fileLogLink = mw.config.get('wgNamespaceNumber') === 6 ? ' ([{{fullurl:Special:Log|page=' + mw.util.wikiUrlencode(mw.config.get('wgPageName')) + '}} log])' : '';
 
var appendText = '# [[:' + Morebits.pageNameNorm + ']]' + fileLogLink + ' nominated at [[WP:' + params.venue.toUpperCase() + '|' + toTLACase(params.venue) + ']]';
var extraInfo = '';
 
switch (params.venue) {
case 'tfd':
if (params.xfdcat === 'tfm') {
appendText += ' (merge)';
if (params.target) {
var contentModel = mw.config.get('wgPageContentModel') === 'Scribunto' ? 'Module:' : 'Template:';
extraInfo += '; Other ' + contentModel.toLowerCase() + ' [[';
if (!/^:?(?:template|module):/i.test(params.target)) {
extraInfo += contentModel;
}
extraInfo += params.target + ']]';
}
}
break;
case 'mfd':
if (initialContrib && params.notifyuserspace && params.userspaceOwner !== initialContrib) {
extraInfo += ' and {{user|1=' + params.userspaceOwner + '}}';
}
break;
case 'cfd':
appendText += ' (' + toTLACase(params.xfdcat) + ')';
if (params.target) {
var categoryOrTemplate = params.xfdcat.charAt(0) === 's' ? 'Template:' : ':Category:';
extraInfo += '; ' + params.action + ' to: [[' + categoryOrTemplate + params.target + ']]';
if (params.xfdcat === 'cfs' && params.target2) {
extraInfo += ', [[' + categoryOrTemplate + params.target2 + ']]';
}
}
break;
case 'cfds':
appendText += ' (' + toTLACase(params.xfdcat) + ')';
// Ensure there's more than just 'Category:'
if (params.target && params.target.length > 9) {
extraInfo += '; New name: [[:' + params.target + ']]';
}
break;
case 'rfd':
if (params.target) {
extraInfo += '; Target: [[:' + params.target + ']]';
if (params.relatedpage) {
extraInfo += ' (notified)';
}
}
break;
case 'rm':
if (params.rmtr) {
appendText += ' (technical)';
}
if (params.newname) {
extraInfo += '; New name: [[:' + params.newname + ']]';
}
break;
case 'ffd':
case 'afd':
default:
break;
}
 
if (initialContrib) {
appendText += '; notified {{user|1=' + initialContrib + '}}';
}
if (extraInfo) {
appendText += extraInfo;
}
appendText += ' ~~~~~';
if (params.reason) {
appendText += "\n#* '''Reason''': " + params.reason;
}
 
usl.log(appendText, editsummary + Twinkle.getPref('summaryAd'));
},
 
afd: {
main: function(apiobj) {
السطر 827 ⟵ 464:
 
// There has been no earlier entries with this prefix, just go on.
if ( titles.length <= 0 ) {
apiobj.params.numbering = apiobj.params.number = '';
} else {
var number = 0;
for ( var i = 0; i < titles.length; ++i ) {
var title = titles[i].getAttribute('title');
 
// First, simple test, is there an instance with this exact name?
if ( title === 'ويكيبيديا:نقاش الحذف/' + Morebits.pageNameNorm ) {
number = Math.max( number, 1 );
continue;
}
 
var order_re = new RegExp( '^' +
window.RegExp.escape( 'ويكيبيديا:نقاش الحذف/' + Morebits.pageNameNorm, true ) +
'\\s*\\(\\s*(\\d+)(?:(?:th|nd|rd|st) nom(?:ination)?)?\\s*\\)\\s*$');
var match = order_re.exec( title );
 
// No match; A non-good value
if ( !match ) {
continue;
}
 
// A match, set number to the max of current
number = Math.max( number, Number(match[1]) );
}
apiobj.params.number = Twinkle.xfd.num2order( parseInt( number, 10 ) + 1);
apiobj.params.numbering = number > 0 ? ' (' + apiobj.params.number + ' nomination)' : '';
}
apiobj.params.discussionpage = 'ويكيبيديا:نقاش الحذف/' + Morebits.pageNameNorm + apiobj.params.numbering;
 
Morebits.status.info(' "Next discussion page'", '"[['" + apiobj.params.discussionpage + '"]]'" );
 
// Updating data for the action completed event
Morebits.wiki.actionCompleted.redirect = apiobj.params.discussionpage;
Morebits.wiki.actionCompleted.notice = 'Nomination"نامزد completed,کردن nowکامل redirectingشد، toدر theحال discussionانتقال page'به صفحه نظرخواهی";
 
// Tagging article
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Adding"افزودن deletionبرچسب tagحذف toبه article'مقاله");
wikipedia_page.setFollowRedirect(true); // should never be needed, but if the article is moved, we would want to follow the redirect
wikipedia_page.setCallbackParameters(apiobj.params);
السطر 877 ⟵ 514:
 
if (!pageobj.exists()) {
statelem.error("Itبه seemsنظر thatمی‌رسد theکه pageاین doesn'tصفحه exist;قبلاً perhapsحذف itشده has already been deletedاست.");
return;
}
 
// Check for existing AfD tag, for the benefit of new page patrollers
var textNoAfd = text.replace(/<!--.*AfD.*\n\{\{\s*(?:Article for deletion\/dated|پیشنهاد حذف|AfDM).*\}\}\n<!--.s*(\|(?:\n<!--.{\{[^{}]*\}\}|[^{}])?AfD.*()?:\}\}\s*\n)?/g, ''"");
if (text !== textNoAfd) {
if (confirm("مقاله دارای برچسب حذف سریع است آیا قصد جایگزینی آن با نظرخواهی برای حذف دارید؟. \nبا زدن دکمه تائید برچسب نظرخواهی برای حذف جایگزین می‌گردد.")) {
if (confirm('An AfD tag was found on this article. Maybe someone beat you to it. \nClick OK to replace the current AfD tag (not recommended), or Cancel to abandon your nomination.')) {
text = textNoAfd;
} else {
statelem.error('Article"مقاله alreadyبرای taggedنظرخواهی withحذف AfDپیشنهاد tag,شده‌است andدرخواست youشما choseلغو to abort'شد.");
window.location.reload();
return;
السطر 894 ⟵ 531:
 
// Now we know we want to go ahead with it, trigger the other AJAX requests
 
// Mark the page as curated/patrolled, if wanted
if (Twinkle.getPref('markXfdPagesAsPatrolled')) {
pageobj.triage();
}
 
// Starting discussion page
var wikipedia_page = new Morebits.wiki.page(params.discussionpage, 'Creating"ایجاد articleصفحه deletionنظرخواهی discussionحذف page'مقاله");
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.afd.discussionPage);
 
// Today's list
var date = new Morebits.dateDate(pageobj.getLoadTime());
wikipedia_page = new Morebits.wiki.page('ويكيبيديا:نقاش الحذف/سجل/', +"افزودن نظرخواهی به فهرست نظرخواهی‌ها");
date.format('YYYY MMMM D', 'utc'), "Adding discussion to today's list");
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.afd.todaysList);
 
// Notification to first contributor
if (params.usertalk) {
var thispage = new Morebits.wiki.page(mw.config.get('wgPageName'));
thispage.setCallbackParameters(params);
thispage.lookupCreator(Twinkle.xfd.callbacks.afd.userNotification);
thispage.setLookupNonRedirectCreator(true); // Look for author of first non-redirect revision
thispage.lookupCreation(Twinkle.xfd.callbacks.afd.userNotification);
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
} else if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
 
// List at deletion sorting pages
if (params.delsort_cats) {
params.delsort_cats.forEach(function(cat) {
var delsortPage = new Morebits.wiki.page('Wikipedia:WikiProject Deletion sorting/' + cat, 'Adding to list of ' + cat + '-related deletion discussions');
delsortPage.setFollowRedirect(true); // In case a category gets renamed
delsortPage.setCallbackParameters({discussionPage: params.discussionpage});
delsortPage.load(Twinkle.xfd.callbacks.afd.delsortListing);
});
}
 
// Remove some tags that should always be removed on AfD.
text = text.replace(/\{\{\s*(dated prod|dated prod blp|Prod blp\/dated|حذف زماندار|حذف زمان\u200cدار|حذف سریع|حذف زمان‌دار|Proposed deletion\/dated|prod2|Proposed deletion endorsed|New unreviewed article|Unreviewed|Userspace draft)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/ig, ''"");
// Then, test if there are speedy deletion-related templates on the article.
var textNoSd = text.replace(/\{\{\s*(db(-\w*)?|delete|حذف زماندار|حذف زمان\u200cدار|حذف سریع|حذف زمان‌دار|(?:hang|hold)[\- ]?on)\s*(\|(?:\{\{[^{}]*\}\}|[^{}])*)?\}\}\s*/ig, ''"");
if (text !== textNoSd && confirm('A"برچسب speedyحذف deletionزماندار tagدر wasمقاله foundیافت onشده‌است thisآیا page.باید Shouldاین itبرچسب beجایگزین removed?'شود؟")) {
text = textNoSd;
}
 
pageobj.setPageText((params.noinclude ? '"<noinclude>{{'" : '"{{'") + (params.number === '' ? '"subst:afd|help=off'" : ('subst:afdx|' +
params.number + '"|help=off'")) + (params.noinclude ? '"}}</noinclude>\n'" : '"}}\n'") + text);
pageobj.setEditSummary('Nominated"برای forحذف deletion;نامزد seeشد؛ بنگرید به [[:'" + params.discussionpage + '"]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchPage')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('nocreate');
pageobj.save();
السطر 951 ⟵ 579:
var params = pageobj.getCallbackParameters();
 
pageobj.setPageText(Twinkle"{{subst:afd2|text=" + Morebits.xfdstring.callbacks.getDiscussionWikitextformatReasonText('afd', params.reason)); +
pageobj.setEditSummary('Creating deletion discussion page for " [[:'~~~~|pg=" + Morebits.pageNameNorm + ']]"|cat=" + params.'xfdcat + Twinkle.getPref('summaryAd')"}}\n");
pageobj.setEditSummary("ساخت صفحهٔ نظرخواهی حذف برای [[" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPref(pageobj, Twinkle.getPref('xfdWatchDiscussion'));
switch (Twinkle.getPref('xfdWatchDiscussion')) {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('createonly');
pageobj.save(function() {
السطر 960 ⟵ 599:
},
todaysList: function(pageobj) {
var old_text = pageobj.getPageText() + '"\n'"; // MW strips trailing blanks, but we like them, so we add a fake one
var params = pageobj.getCallbackParameters();
var statelem = pageobj.getStatusElement();
 
var text = old_text.replace(/\n*(<\!-- Add new entries to the TOP of the following listتوینکل -->)\n+)*/, '$1"\n{{subst:afd3|pg='" + Morebits.pageNameNorm + params.numbering + '"}}\n'" + "$1");
if ( text === old_text ) {
var linknode = document.createElement('a');
linknode.setAttribute('"href'", mw.util.getUrl('"Wikipedia:Twinkle/Fixing AFD'") + '"?action=purge'" );
linknode.appendChild(document.createTextNode('How to fix AFD'));
statelem.error( [ 'Could not find the target spot for the discussion. To fix this problem, please see ', linknode, '.' ] );
return;
}
pageobj.setPageText(text);
pageobj.setEditSummary('Adding"افزودن [[:'" + params.discussionpage + '"]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchList')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate');
pageobj.save();
السطر 984 ⟵ 633:
// Disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
pageobj.getStatusElement().warn('"You ('" + initialContrib + '") created this page; skipping user notification'");
return;
}
 
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, 'Notifying"آگاه‌سازی initialنخستین contributorمشارکت کننده ('" + initialContrib + '")'");
var notifytext = '"\n{{subst:Afd noticeAFDWarning|1='" + Morebits.pageNameNorm + ( params.numbering !== '' ? '|order=&#32;' + params.numbering : '' ) + '"}} ~~~~'";
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary('Notification"آگاه‌سازی: فهرست‌شدن در [['وپ:نبح|نظرخواهی +برای params.discussionpage + '|nominationحذف]]؛ ofمقاله: [[:'" + Morebits.pageNameNorm + ']] at [[WP:AFD|articles for deletion"]].'" + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
Twinkle.xfd.setWatchPrefswitch (usertalkpage, Twinkle.getPref('xfdWatchUser')); {
case 'yes':
usertalkpage.setWatchlist(true);
break;
case 'no':
usertalkpage.setWatchlistFromPreferences(false);
break;
default:
usertalkpage.setWatchlistFromPreferences(true);
break;
}
usertalkpage.setFollowRedirect(true);
usertalkpage.append(function onNotifySuccess() {;
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, initialContrib);
}
}, function onNotifyError() {
// if user could not be notified, log nomination without mentioning that notification was sent
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
});
},
delsortListing: function(pageobj) {
var discussionPage = pageobj.getCallbackParameters().discussionPage;
var text = pageobj.getPageText().replace('directly below this line -->', 'directly below this line -->\n{{' + discussionPage + '}}');
pageobj.setPageText(text);
pageobj.setEditSummary('Listing [[:' + discussionPage + ']].' + Twinkle.getPref('summaryAd'));
pageobj.setCreateOption('nocreate');
pageobj.save();
}
},
السطر 1٬022 ⟵ 663:
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
var tableNewline = params.tfdtype === 'standard' || params.tfdtype === 'sidebar' ? '\n' : ''; // No newline for inline
 
pageobj.setPageText((params.noinclude ? '"<noinclude>'" : ''"") + '"{{subst:template for discussion|help=off'|" +
(params.tfdtype !== 'standard'tfdinline ? '|"type='inline|" : "") + paramsmw.tfdtype : config.get('wgTitle') + (params.noinclude ? '"}}</noinclude>'" : '"}}'\n") + tableNewline + text);
pageobj.setEditSummary('Nominated"برای forحذف deletion;نامزد seeشد؛ بنگرید به [[:'" + params.discussionpagelogpage + "#" + Morebits.pageNameNorm + '"]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchPage')); {
case 'yes':
if (params.scribunto) {
pageobj.setCreateOptionsetWatchlist('recreate'true); // Module /doc might not exist
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('nocreate');
pageobj.save();
},
السطر 1٬036 ⟵ 684:
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
var tableNewline = params.tfdtype === 'standard' || params.tfdtype === 'sidebar' ? '\n' : ''; // No newline for inline
 
pageobj.setPageText((params.noinclude ? '"<noinclude>'" : ''"") + '"{{subst:tfm|help=off|'" +
(params.tfdtype !== 'standard'tfdinline ? '"type=' + params.tfdtype + 'inline|'1=" : '') + '"1='") + params.otherTemplateName.replace(/^(?:Template|Module):/, ''"") +
(params.noinclude ? '"}}</noinclude>'" : '"}}'\n") + tableNewline + text);
pageobj.setEditSummary('Listed"نامزدی forبرای merging withحذفِ [[:'" + params.otherTemplateName + '"]];؛ seeبنگرید به [[:'" + params.discussionpage + ']].' + Twinkle.getPref('summaryAd'));
Twinkle params.xfdlogpage + "#" + Morebits.setWatchPref(pageobj,pageNameNorm + "]]." + Twinkle.getPref('xfdWatchPagesummaryAd'));
switch (Twinkle.getPref('xfdWatchPage')) {
if (params.scribunto) {
case 'yes':
pageobj.setCreateOption('recreate'); // Module /doc might not exist
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('nocreate');
pageobj.save();
},
السطر 1٬053 ⟵ 709:
var statelem = pageobj.getStatusElement();
 
var added_data = Twinkle.xfd.callbacks.getDiscussionWikitext(params.xfdcat, params)"";
switch( params.xfdcat ) {
case 'tfd':
added_data = "{{subst:tfd2|text=" + Morebits.string.formatReasonText(params.reason) +
" ~~~~|1=" + mw.config.get('wgTitle') + "}}";
break;
case 'tfm':
added_data = "{{subst:tfm2|text=" + Morebits.string.formatReasonText(params.reason) +
" ~~~~|1=" + mw.config.get('wgTitle') + "|2=" + params.target + "}}";
break;
default:
alert("twinklexfd in todaysList: unknown TFD action");
break;
}
 
var text = old_text.replace( '-->', '"-->\n'" + added_data );
if ( text === old_text ) {
statelem.error( 'failed to find target spot for the discussion' );
return;
}
pageobj.setPageText(text);
pageobj.setEditSummary('Adding"افزودن '[[الگو:" + mw.config.get(params.xfdcat === 'tfd' ? 'deletion nomination' : 'merge listingwgTitle') + ' of [[:' + Morebits.pageNameNorm + '"]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchDiscussion')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate');
pageobj.save(function() {
السطر 1٬074 ⟵ 753:
// Disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
pageobj.getStatusElement().warn('"You ('" + initialContrib + '") created this page; skipping user notification'");
return;
}
 
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, 'Notifying"آگاه‌سازی initialنخستین contributorمشارکت کننده ('" + initialContrib + '")'");
var notifytext = '"\n'";
var modNotice = mw.config.get('wgPageContentModel') === 'Scribunto' ? '|module=yes' : '';
switch (params.xfdcat) {
case 'tfd':
notifytext += '"{{subst:Tfd noticetfdnotice|1='" + mw.config.get('wgTitle') + modNotice + '"}} ~~~~'";
break;
case 'tfm':
notifytext += "{{subst:tfmnotice|1=" + mw.config.get('wgTitle') + "|2=" + params.target + "}} ~~~~";
break;
default:
alert("twinklexfd in userNotification: unknown TFD action");
break;
}
 
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary("آگاه‌سازی: نامزدی در [[وپ:نبح|نظرخواهی برای حذف الگوها]] برای [[" + pageobj.getPageName() + "]]." + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
switch (Twinkle.getPref('xfdWatchUser')) {
case 'yes':
usertalkpage.setWatchlist(true);
break;
case 'tfmno':
usertalkpage.setWatchlistFromPreferences(false);
notifytext += '{{subst:Tfm notice|1=' + mw.config.get('wgTitle') + '|2=' + params.target + modNotice + '}} ~~~~';
break;
default:
usertalkpage.setWatchlistFromPreferences(true);
alert('twinklexfd in userNotification: unknown TFD action');
break;
}
 
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary('Notification: [[' + params.discussionpage + '|listing]] of [[:' + pageobj.getPageName() + ']] at [[WP:TFD|templates for discussion]].' + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
Twinkle.xfd.setWatchPref(usertalkpage, Twinkle.getPref('xfdWatchUser'));
usertalkpage.setFollowRedirect(true);
usertalkpage.append();
 
// Add this nomination to user's userspace log, if the user has enabled it
// and it isn't the second template in a TfM nomination
if ((params.xfdcat === 'tfd' || pageobj.getPageName() === Morebits.pageNameNorm) && params.lognomination) {
usertalkpage.append(function onNotifySuccess() {
Twinkle.xfd.callbacks.addToLog(params, initialContrib);
}, function onNotifyError() {
// if user could not be notified, log without mentioning notification
Twinkle.xfd.callbacks.addToLog(params, null);
});
} else {
usertalkpage.append();
}
}
},
السطر 1٬121 ⟵ 797:
 
// There has been no earlier entries with this prefix, just go on.
if ( titles.length <= 0 ) {
apiobj.params.numbering = apiobj.params.number = '';
} else {
var number = 0;
for ( var i = 0; i < titles.length; ++i ) {
var title = titles[i].getAttribute('title');
 
// First, simple test, is there an instance with this exact name?
if ( title === 'Wikipedia:Miscellany for deletion/' + Morebits.pageNameNorm ) {
number = Math.max( number, 1 );
continue;
}
 
var order_re = new RegExp( '^' +
window.RegExp.escape( 'Wikipedia:Miscellany for deletion/' + Morebits.pageNameNorm, true ) +
'\\s*\\(\\s*(\\d+)(?:(?:th|nd|rd|st) nom(?:ination)?)?\\s*\\)\\s*$' );
var match = order_re.exec( title );
 
// No match; A non-good value
if ( !match ) {
continue;
}
 
// A match, set number to the max of current
number = Math.max( number, Number(match[1]) );
}
apiobj.params.number = Twinkle.xfd.num2order( parseInt( number, 10 ) + 1);
apiobj.params.numbering = number > 0 ? ' (' + apiobj.params.number + ' nomination)' : '';
}
apiobj.params.discussionpage = '"Wikipedia:Miscellany for deletion/'" + Morebits.pageNameNorm + apiobj.params.numbering;
 
apiobj.statelem.info(' "next in order is [['" + apiobj.params.discussionpage + ']]');
 
// Tagging page
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), '"Tagging page with deletion tag'");
wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect
wikipedia_page.setCallbackParameters(apiobj.params);
السطر 1٬162 ⟵ 838:
// Updating data for the action completed event
Morebits.wiki.actionCompleted.redirect = apiobj.params.discussionpage;
Morebits.wiki.actionCompleted.notice = 'Nomination"نامزد completed,کردن nowکامل redirectingشد، toدر theحال discussionانتقال page'به صفحه بحث";
 
// Discussion page
wikipedia_page = new Morebits.wiki.page(apiobj.params.discussionpage, 'Creating"ایجاد deletionصفحه discussionنظرخواهی page'حذف");
wikipedia_page.setCallbackParameters(apiobj.params);
wikipedia_page.load(Twinkle.xfd.callbacks.mfd.discussionPage);
 
// Today's list
wikipedia_page = new Morebits.wiki.page('Wikipedia"ويكيبيديا:Miscellanyنقاش for deletion'الحذف", "Addingافزودن discussionنظرخواهی toبه today'sفهرست listنظرخواهی‌ها");
//wikipedia_page.setPageSection(2);
// pageSection has been disabled - the API seems to throw up with nonexistent edit conflicts
wikipedia_page.setFollowRedirect(true);
// it can be turned on again once the problem is fixed, to save bandwidth
//wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(apiobj.params);
wikipedia_page.load(Twinkle.xfd.callbacks.mfd.todaysList);
السطر 1٬180 ⟵ 858:
var thispage = new Morebits.wiki.page(mw.config.get('wgPageName'));
thispage.setCallbackParameters(apiobj.params);
thispage.lookupCreationlookupCreator(Twinkle.xfd.callbacks.mfd.userNotification);
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
} else if (apiobj.params.lognomination) {
Twinkle.xfd.callbacks.addToLog(apiobj.params, null);
}
},
السطر 1٬190 ⟵ 865:
var params = pageobj.getCallbackParameters();
 
pageobj.setPageText((params.noinclude ? '"<noinclude>'" : ''"") + '"{{" + ((params.number === '') ? "mfd}}\n" : ('mfdx|' + params.number + "}}\n")) +
(params.number === ''noinclude ? 'mfd'"</noinclude>" : 'mfdx|'"") + params.numbertext) + '|help=off}}\n' +;
pageobj.setEditSummary("برای حذف نامزد شد؛ بنگرید به [[" + params.discussionpage + "]]." + Twinkle.getPref('summaryAd'));
(params.noinclude ? '</noinclude>' : '') + text);
switch (Twinkle.getPref('xfdWatchPage')) {
pageobj.setEditSummary('Nominated for deletion; see [[:' + params.discussionpage + ']].' + Twinkle.getPref('summaryAd'));
case 'yes':
Twinkle.xfd.setWatchPref(pageobj, Twinkle.getPref('xfdWatchPage'));
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('nocreate');
pageobj.save();
السطر 1٬201 ⟵ 885:
var params = pageobj.getCallbackParameters();
 
pageobj.setPageText(Twinkle"{{subst:mfd2|text=" + Morebits.xfdstring.callbacks.getDiscussionWikitextformatReasonText('mfd', params.reason)); +
pageobj.setEditSummary('Creating " deletion discussion page for [[:'~~~~|pg=" + Morebits.pageNameNorm + ']].' + Twinkle.getPref('summaryAd')"}}\n");
pageobj.setEditSummary("ساخت صفحهٔ نظرخواهی حذف برای [[" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPref(pageobj, Twinkle.getPref('xfdWatchDiscussion'));
switch (Twinkle.getPref('xfdWatchDiscussion')) {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('createonly');
pageobj.save(function() {
السطر 1٬214 ⟵ 909:
var statelem = pageobj.getStatusElement();
 
var date = new Morebits.dateDate(pageobj.getLoadTime());
var date_header = "===" + date.formatgetUTCMonthName() + '===MMMM D' + date.getUTCDate() + ', YYYY' + date.getUTCFullYear() + "===\n', 'utc')";
var date_header_regex = new RegExp(date.format(' "(===[\\s]*MMMM[" + date.getUTCMonthName() + '\\s]+D' + date.getUTCDate() + ',[\\s]+YYYY[' + date.getUTCFullYear() + "\\s]*===)'," 'utc'));
var new_data = '"{{subst:mfd3|pg='" + Morebits.pageNameNorm + params.numbering + '"}}'";
 
if ( date_header_regex.test( text ) ) { // we have a section already
statelem.info( 'Found today\'s section, proceeding to add new entry' );
text = text.replace( date_header_regex, '"$1\n'" + new_data );
} else { // we need to create a new section
statelem.info( 'No section for today found, proceeding to create one' );
text = text.replace('"==='", date_header + new_data + '"\n\n==='");
}
 
pageobj.setPageText(text);
pageobj.setEditSummary('Adding"افزودن [[:'" + params.discussionpage + '"]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchList')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate');
pageobj.save();
السطر 1٬236 ⟵ 941:
var initialContrib = pageobj.getCreator();
var params = pageobj.getCallbackParameters();
 
// Also notify the user who owns the subpage if they are not the creator
params.userspaceOwner = mw.config.get('wgRelevantUserName');
if (params.notifyuserspace && params.userspaceOwner !== initialContrib) {
Twinkle.xfd.callbacks.mfd.userNotificationMain(params, params.userspaceOwner, 'Notifying owner of userspace');
}
 
// Disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
pageobj.getStatusElement().warn('"You ('" + initialContrib + '") created this page; skipping user notification'");
} else {
// Used to ensure we only add to the userspace
// log once, after notifying the initial creator
params.initialContrib = initialContrib;
// Really notify the creator
Twinkle.xfd.callbacks.mfd.userNotificationMain(params, initialContrib, 'Notifying"آگاه‌سازی initialنخستین contributor'مشارکت کننده");
}
 
// Also notify the user who owns the subpage if they are not the creator
if (params.notifyuserspace) {
var userspaceOwner = ((mw.config.get('wgTitle').indexOf('/') === -1) ? mw.config.get('wgTitle') : mw.config.get('wgTitle').substring(0, mw.config.get('wgTitle').indexOf('/')));
if (userspaceOwner !== initialContrib) {
Twinkle.xfd.callbacks.mfd.userNotificationMain(params, userspaceOwner, "آگاه‌سازی صاحب فضای کاربری");
}
}
},
userNotificationMain: function(params, userTargetinitialContrib, actionName) {
{
var usertalkpage = new Morebits.wiki.page('User talk:' + userTarget, actionName + ' (' + userTarget + ')');
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, actionName + " (" + initialContrib + ")");
var notifytext = '\n{{subst:Mfd notice|1=' + Morebits.pageNameNorm + (params.numbering !== '' ? '|order=&#32;' + params.numbering : '') + '}} ~~~~';
var notifytext = "\n{{subst:MFDWarning|1=" + Morebits.pageNameNorm + ( params.numbering !== '' ? '|order=&#32;' + params.numbering : '' ) + "}} ~~~~";
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary('Notification"آگاه‌سازی: [['فهرست‌شدن +در params.discussionpageنظرخواهی +حذف؛ '|nomination]] ofصفحه: [[:'" + Morebits.pageNameNorm + ']] at [[WP:MFD|miscellany for deletion"]].'" + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
Twinkle.xfd.setWatchPrefswitch (usertalkpage, Twinkle.getPref('xfdWatchUser')); {
case 'yes':
usertalkpage.setFollowRedirect(true);
usertalkpage.setWatchlist(true);
// Only log once, using the initial creator's notification as our barometer
break;
if (params.initialContrib === userTarget && params.lognomination) {
case 'no':
usertalkpage.append(function onNotifySuccess() {
usertalkpage.setWatchlistFromPreferences(false);
Twinkle.xfd.callbacks.addToLog(params, userTarget);
break;
}, function onNotifyError() {
default:
// if user could not be notified, log without mentioning notification
usertalkpage.setWatchlistFromPreferences(true);
Twinkle.xfd.callbacks.addToLog(params, null);
}) break;
} else {
usertalkpage.append();
}
usertalkpage.setFollowRedirect(true);
 
usertalkpage.append();
}
},
السطر 1٬280 ⟵ 984:
ffd: {
main: function(pageobj) {
// this is coming in from lookupCreationlookupCreator...!
var params = pageobj.getCallbackParameters();
var initialContrib = pageobj.getCreator();
السطر 1٬286 ⟵ 990:
 
// Adding discussion
var wikipedia_page = new Morebits.wiki.page(params.logpage, "Addingافزودن discussionنظرخواهی toبه today'sفهرست listنظرخواهی‌ها");
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
السطر 1٬295 ⟵ 999:
// Disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
pageobj.getStatusElement().warn('"You ('" + initialContrib + '") created this page; skipping user notification'");
} else {
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, '"Notifying initial contributor ('" + initialContrib + '")'");
var notifytext = '"\n{{subst:Ffd noticeidw|1='" + mw.config.get('wgTitle') + '"}}'";
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary('Notification"آگاه‌سازی: [['فهرست‌شدن +در params.discussionpageنظرخواهی +برای '|listing]]حذف؛ ofصفحه: [[:'" + Morebits.pageNameNorm + ']] at [[WP:FFD|files for discussion"]].'" + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
Twinkle.xfd.setWatchPrefswitch (usertalkpage, Twinkle.getPref('xfdWatchUser')); {
case 'yes':
usertalkpage.setWatchlist(true);
break;
case 'no':
usertalkpage.setWatchlistFromPreferences(false);
break;
default:
usertalkpage.setWatchlistFromPreferences(true);
break;
}
usertalkpage.setFollowRedirect(true);
usertalkpage.append(function onNotifySuccess() {;
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, initialContrib);
}
}, function onNotifyError() {
// if user could not be notified, log nomination without mentioning that notification was sent
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
});
}
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
} else if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
},
السطر 1٬325 ⟵ 1٬026:
var params = pageobj.getCallbackParameters();
 
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi, ''"");
 
pageobj.setPageText('"{{ffd|log='" + params.date + '|help=off"}}\n'" + text);
pageobj.setEditSummary('Listed"برای forحذف discussionنامزد atشد؛ بنگرید به [[:'" + params.discussionpagelogpage + "#" + Morebits.pageNameNorm + '"]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchPage')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate'); // it might be possible for a file to exist without a description page
pageobj.save();
السطر 1٬339 ⟵ 1٬050:
// add date header if the log is found to be empty (a bot should do this automatically, but it sometimes breaks down)
if (!pageobj.exists()) {
text = '"{{subst:Ffd log}}'";
}
 
pageobj.setPageText(text + '"\n\n'{{subst:ffd2|Reason=" + TwinkleMorebits.xfdstring.callbacks.getDiscussionWikitextformatReasonText('ffd', params.reason)); +
"|Uploader=" + params.uploader + "|1=" + mw.config.get('wgTitle') + "}} ~~~~");
pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']].' + Twinkle.getPref('summaryAd'));
Twinklepageobj.xfd.setWatchPrefsetEditSummary(pageobj,"افزودن [[" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('xfdWatchDiscussionsummaryAd'));
switch (Twinkle.getPref('xfdWatchDiscussion')) {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate');
pageobj.save(function() {
السطر 1٬353 ⟵ 1٬075:
 
 
cfdpuf: {
taggingCategorytaggingImage: function(pageobj) {
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
 
text = text.replace(/\{\{(mtc|(copy |move )?to ?commons|move to wikimedia commons|copy to wikimedia commons)[^}]*\}\}/gi, "");
var added_data = '{{subst:' + params.xfdcat;
 
var editsummary = (mw.config.get('wgNamespaceNumber') === 14 ? 'Category' : 'Stub template') +
pageobj.setPageText("{{puf|help=off|log=" + params.date + "}}\n" + text);
' being considered for ' + params.action;
pageobj.setEditSummary("فهرست شد در [[وپ:نبح|پرونده‌های احتمالاً ناآزاد]]: [[" + params.logpage + "#" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd'));
switch (params.xfdcat) {
switch (Twinkle.getPref('xfdWatchPage')) {
case 'cfd':
case 'sfd-tyes':
pageobj.setWatchlist(true);
break;
case 'cfcno':
pageobj.setWatchlistFromPreferences(false);
editsummary += ' to an article';
// falls throughbreak;
case 'cfm'default:
pageobj.setWatchlistFromPreferences(true);
case 'cfr':
case 'sfr-t': break;
}
added_data += '|' + params.target;
pageobj.setCreateOption('recreate'); // it might be possible for a file to exist without a description page
pageobj.save();
},
todaysList: function(pageobj) {
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
 
pageobj.setPageText(text + "\n{{subst:puf2|reason=" + Morebits.string.formatReasonText(params.reason) +
"|image=" + mw.config.get('wgTitle') + "}} ~~~~");
pageobj.setEditSummary("افزودن [[" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd'));
switch (Twinkle.getPref('xfdWatchDiscussion')) {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'cfsno':
pageobj.setWatchlistFromPreferences(false);
added_data += '|' + params.target + '|' + params.target2;
break;
default:
pageobj.setWatchlistFromPreferences(true);
alert('twinklexfd in taggingCategory(): unknown CFD action');
break;
}
pageobj.setCreateOption('recreate');
added_data += '}}';
pageobj.save(function() {
editsummary += '; see [[:' + params.discussionpage + ']].';
Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki
});
},
userNotification: function(pageobj) {
var initialContrib = pageobj.getCreator();
 
// Disallow warning yourself
pageobj.setPageText(added_data + '\n' + text);
if (initialContrib === mw.config.get('wgUserName')) {
pageobj.getStatusElement().warn("You (" + initialContrib + ") created this page; skipping user notification");
return;
}
 
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, "Notifying initial contributor (" + initialContrib + ")");
var notifytext = "\n{{subst:idw-puf|1=" + mw.config.get('wgTitle') + "}} ~~~~";
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary("Notification: listing at [[WP:PUF|possibly unfree files]] of [[" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
switch (Twinkle.getPref('xfdWatchUser')) {
case 'yes':
usertalkpage.setWatchlist(true);
break;
case 'no':
usertalkpage.setWatchlistFromPreferences(false);
break;
default:
usertalkpage.setWatchlistFromPreferences(true);
break;
}
usertalkpage.setFollowRedirect(true);
usertalkpage.append();
}
},
 
 
// NOTE: NFCR doesn't have any callbacks here, everything happens in callback.evaluate
 
 
cfd: {
taggingCategory: function(pageobj) {
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
 
var added_data = "";
var editsummary = "";
switch( params.xfdcat ) {
case 'cfd':
added_data = "{{subst:cfd}}";
editsummary = "Category being considered for deletion; see [[" + params.logpage + "#" + Morebits.pageNameNorm + "]].";
break;
case 'cfm':
added_data = "{{subst:cfm|" + params.target + "}}";
editsummary = "Category being considered for merging; see [[" + params.logpage + "#" + Morebits.pageNameNorm + "]].";
break;
case 'cfr':
added_data = "{{subst:cfr|" + params.target + "}}";
editsummary = "Category being considered for renaming; see [[" + params.logpage + "#" + Morebits.pageNameNorm + "]].";
break;
case 'cfs':
added_data = "{{subst:cfs|" + params.target + "|" + params.target2 + "}}";
editsummary = "Category being considered for splitting; see [[" + params.logpage + "#" + Morebits.pageNameNorm + "]].";
break;
case 'cfc':
added_data = "{{subst:cfc|" + params.target + "}}";
editsummary = "Category being considered for conversion to an article; see [[" + params.logpage + "#" + Morebits.pageNameNorm + "]].";
break;
default:
alert("twinklexfd in taggingCategory(): unknown CFD action");
break;
}
 
pageobj.setPageText(added_data + "\n" + text);
pageobj.setEditSummary(editsummary + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchPage')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title
pageobj.save();
السطر 1٬394 ⟵ 1٬209:
var statelem = pageobj.getStatusElement();
 
var added_data = Twinkle.xfd.callbacks.getDiscussionWikitext(params.xfdcat, params)"";
var editsummary = 'Adding ' + params.action + ' nomination of [[:' + Morebits.pageNameNorm + ']].'"";
switch( params.xfdcat ) {
case 'cfd':
added_data = "{{subst:cfd2|text=" + Morebits.string.formatReasonText(params.reason) +
" ~~~~|1=" + mw.config.get('wgTitle') + "}}";
editsummary = "Added delete nomination of [[:" + Morebits.pageNameNorm + "]].";
break;
case 'cfm':
added_data = "{{subst:cfm2|text=" + Morebits.string.formatReasonText(params.reason) +
" ~~~~|1=" + mw.config.get('wgTitle') + "|2=" + params.target + "}}";
editsummary = "Added merge nomination of [[:" + Morebits.pageNameNorm + "]].";
break;
case 'cfr':
added_data = "{{subst:cfr2|text=" + Morebits.string.formatReasonText(params.reason) +
" ~~~~|1=" + mw.config.get('wgTitle') + "|2=" + params.target + "}}";
editsummary = "Added rename nomination of [[:" + Morebits.pageNameNorm + "]].";
break;
case 'cfs':
added_data = "{{subst:cfs2|text=" + Morebits.string.formatReasonText(params.reason) +
" ~~~~|1=" + mw.config.get('wgTitle') + "|2=" + params.target + "|3=" + params.target2 + "}}";
editsummary = "Added split nomination of [[:" + Morebits.pageNameNorm + "]].";
break;
case 'cfc':
added_data = "{{subst:cfc2|text=" + Morebits.string.formatReasonText(params.reason) +
" ~~~~|1=" + mw.config.get('wgTitle') + "|2=" + params.target + "}}";
editsummary = "Added convert nomination of [[:" + Morebits.pageNameNorm + "]].";
break;
default:
alert("twinklexfd in todaysList: unknown CFD action");
break;
}
 
var text = old_text.replace( 'below this line -->', '"below this line -->\n'" + added_data );
if ( text === old_text ) {
statelem.error( 'failed to find target spot for the discussion' );
return;
}
السطر 1٬405 ⟵ 1٬250:
pageobj.setPageText(text);
pageobj.setEditSummary(editsummary + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchDiscussion')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate');
pageobj.save(function() {
السطر 1٬413 ⟵ 1٬268:
userNotification: function(pageobj) {
var initialContrib = pageobj.getCreator();
var params = pageobj.getCallbackParameters();
 
// Disallow warning yourself
if (initialContrib === mw.config.get('wgUserName')) {
pageobj.getStatusElement().warn('"You ('" + initialContrib + '") created this page; skipping user notification'");
return;
}
 
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, '"Notifying initial contributor ('" + initialContrib + '")'");
var notifytext = '"\n{{subst:Cfd noticeCFDNote|1='" + Morebits.pageNameNorm + '|action=' + params.action + (mw.config.get('wgNamespaceNumber') === 10 ? '|stub=yes' : '') + '"}} ~~~~'";
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary('"Notification: listing at [['WP:CFD|categories +for params.discussionpage + '|listingdiscussion]] of [[:'" + Morebits.pageNameNorm + ']] at [[WP:CFD|categories for discussion"]].'" + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
Twinkle.xfd.setWatchPrefswitch (usertalkpage, Twinkle.getPref('xfdWatchUser')); {
case 'yes':
usertalkpage.setWatchlist(true);
break;
case 'no':
usertalkpage.setWatchlistFromPreferences(false);
break;
default:
usertalkpage.setWatchlistFromPreferences(true);
break;
}
usertalkpage.setFollowRedirect(true);
usertalkpage.append(function onNotifySuccess() {;
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, initialContrib);
}
}, function onNotifyError() {
// if user could not be notified, log nomination without mentioning that notification was sent
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
});
}
},
السطر 1٬448 ⟵ 1٬302:
var params = pageobj.getCallbackParameters();
 
pageobj.setPageText('"{{subst:cfr-speedy|1='" + params.target.replace(/^:?Category:/, '') + '"}}\n'" + text);
pageobj.setEditSummary('Listed"Nominated for speedy renaming; see [[WP:CFDS|Categories for discussion/Speedy]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchPage')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate'); // since categories can be populated without an actual page at that title
pageobj.save(function() {;
if (params.lognomination) {
// No user notification for CfDS, so just add this nomination to the user's userspace log
Twinkle.xfd.callbacks.addToLog(params, null);
}
});
},
addToList: function(pageobj) {
السطر 1٬464 ⟵ 1٬323:
var statelem = pageobj.getStatusElement();
 
var newcatname = (/^Category:/.test(params.target) ? params.target : ("Category:" + params.target));
var text = old_text.replace('BELOW THIS LINE -->', 'BELOW THIS LINE -->\n' + Twinkle.xfd.callbacks.getDiscussionWikitext('cfds', params));
var text = old_text.replace( 'BELOW THIS LINE -->', "BELOW THIS LINE -->\n* [[:" + Morebits.pageNameNorm + "]] to [[:" +
if (text === old_text) {
newcatname + "]]\u00A0\u2013 " + params.xfdcat + (params.reason ? (": " + Morebits.string.formatReasonText(params.reason)) : ".") +
statelem.error('failed to find target spot for the discussion');
" ~~~~" );
// U+00A0 NO-BREAK SPACE; U+2013 EN RULE
if( text === old_text ) {
statelem.error( 'failed to find target spot for the discussion' );
return;
}
 
pageobj.setPageText(text);
pageobj.setEditSummary('Adding"أضف [[:'" + Morebits.pageNameNorm + '"]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchDiscussion')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate');
pageobj.save(function() {
السطر 1٬482 ⟵ 1٬355:
 
rfd: {
// This getsis calleda bothcallback onfrom submitan andAPI previewrequest, towhich determinegets the redirect target of the redirect
findTargetfindTargetCallback: function(params, callbackapiobj) {
var xmlDoc = apiobj.responseXML;
// Used by regular redirects to find the target, but for all redirects,
var target = $(xmlDoc).find('redirects r').first().attr('to');
// avoid relying on the client clock to build the log page
varif( query!target =) {
apiobj.statelem.error( "This page is currently not a redirect, aborting" );
'action': 'query',
return;
'curtimestamp': true
};
if (document.getElementById('softredirect')) {
// For soft redirects, define the target early
// to skip target checks in findTargetCallback
params.target = document.getElementById('softredirect').textContent.replace(/^:+/, '');
} else {
// Find current target of redirect
query.titles = mw.config.get('wgPageName');
query.redirects = true;
}
apiobj.params.target = target;
var wikipedia_api = new Morebits.wiki.api('Finding target of redirect', query, Twinkle.xfd.callbacks.rfd.findTargetCallback(callback));
Twinkle.xfd.callbacks.rfd.main(apiobj.params);
wikipedia_api.params = params;
wikipedia_api.post();
},
// This is a closure for the callback from the above API request, which gets the target of the redirect
findTargetCallback: function(callback) {
return function(apiobj) {
var $xmlDoc = $(apiobj.responseXML);
var curtimestamp = $xmlDoc.find('api').attr('curtimestamp');
apiobj.params.curtimestamp = curtimestamp;
if (!apiobj.params.target) { // Not a softredirect
var target = $xmlDoc.find('redirects r').first().attr('to');
if (!target) {
var message = 'This page does not appear to be a redirect, aborting';
if (mw.config.get('wgAction') === 'history') {
message += '. If this is a soft redirect, try again from the content page, not the page history.';
}
apiobj.statelem.error(message);
return;
}
apiobj.params.target = target;
var section = $xmlDoc.find('redirects r').first().attr('tofragment');
apiobj.params.section = section;
}
callback(apiobj.params);
};
},
main: function(params) {
var date = new Morebits.dateDate(params.curtimestamp);
params.logpage = 'Wikipedia:Redirects for discussion/Log/' + date.formatgetUTCFullYear('YYYY) MMMM+ D', 'utc + date.getUTCMonthName() + ' ' + date.getUTCDate();
params.discussionpage = params.logpage + '#' + Morebits.pageNameNorm;
 
// Tagging redirect
var wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), '"Adding deletion tag to redirect'");
wikipedia_page.setFollowRedirect(false);
wikipedia_page.setCallbackParameters(params);
السطر 1٬547 ⟵ 1٬386:
wikipedia_page.load(Twinkle.xfd.callbacks.rfd.todaysList);
 
// Notifying initial contributor
// Notifications
if (params.usertalk || params.relatedpage) {
var thispage = new Morebits.wiki.page(mw.config.get('wgPageName'));
thispage.setCallbackParameters(params);
thispage.lookupCreationlookupCreator(Twinkle.xfd.callbacks.rfd.sendNotificationsuserNotification);
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
} else if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
},
السطر 1٬560 ⟵ 1٬396:
var text = pageobj.getPageText();
var params = pageobj.getCallbackParameters();
 
pageobj.setPageText('{{subst:rfd|' + (mw.config.get('wgNamespaceNumber') === 10 ? 'showontransclusion=1|' : '') + 'content=\n' + text + '\n}}');
pageobj.setPageText("{{subst:rfd|content=\n" + text + "\n}}");
pageobj.setEditSummary('Listed for discussion at [[:' + params.discussionpage + ']].' + Twinkle.getPref('summaryAd'));
pageobj.setEditSummary("فهرست شد: [[" + params.logpage + "#" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPref(pageobj, Twinkle.getPref('xfdWatchPage'));
switch (Twinkle.getPref('xfdWatchPage')) {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('nocreate');
pageobj.save();
السطر 1٬571 ⟵ 1٬418:
var statelem = pageobj.getStatusElement();
 
var text = old_text.replace( /(<\!-- Add new entries directly below this line\.? -->)/, "$1\n{{subst:rfd2|text=" +
// params.target + sectionHash + "}} ~~~~\n" );
Morebits.string.formatReasonText(params.reason) + "|redirect="+ Morebits.pageNameNorm + "|target=" +
var added_data = Twinkle.xfd.callbacks.getDiscussionWikitext('rfd', params);
params.target + "}} ~~~~\n" );
var text = old_text.replace(/(<!-- Add new entries directly below this line\.? -->)/, '$1\n' + added_data);
if ( text === old_text ) {
statelem.error( 'failed to find target spot for the discussion' );
return;
}
 
pageobj.setPageText(text);
pageobj.setEditSummary('Adding"افزودن [[:'" + Morebits.pageNameNorm + '"]].'" + Twinkle.getPref('summaryAd'));
Twinkle.xfd.setWatchPrefswitch (pageobj, Twinkle.getPref('xfdWatchDiscussion')); {
case 'yes':
pageobj.setWatchlist(true);
break;
case 'no':
pageobj.setWatchlistFromPreferences(false);
break;
default:
pageobj.setWatchlistFromPreferences(true);
break;
}
pageobj.setCreateOption('recreate');
pageobj.save(function() {
السطر 1٬587 ⟵ 1٬444:
});
},
sendNotificationsuserNotification: function(pageobj) {
var initialContrib = pageobj.getCreator();
var params = pageobj.getCallbackParameters();
var statelem = pageobj.getStatusElement();
 
// NotifyingDisallow initialwarning contributoryourself
if (initialContrib === mw.config.get('wgUserName')) {
if (params.usertalk) {
pageobj.getStatusElement().warn("You (" + initialContrib + ") created this page; skipping user notification");
// Disallow warning yourself
return;
if (initialContrib === mw.config.get('wgUserName')) {
statelem.warn('You (' + initialContrib + ') created this page; skipping user notification');
} else {
Twinkle.xfd.callbacks.rfd.userNotification(params, initialContrib);
}
}
 
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, "Notifying initial contributor (" + initialContrib + ")");
// Notifying target page's watchers, if not a soft redirect
var notifytext = "\n{{subst:RFDNote|1=" + Morebits.pageNameNorm + "}} ~~~~";
if (params.relatedpage) {
var targetTalk = new mw.Title(params.target).getTalkPage();
 
// On the offchance it's a circular redirect
if (params.target === mw.config.get('wgPageName')) {
statelem.warn('Circular redirect; skipping target page notification');
} else if (document.getElementById('softredirect')) {
statelem.warn('Soft redirect; skipping target page notification');
} else if (targetTalk.getNamespaceId() === 3) {
// Don't issue if target talk is the initial contributor's talk or your own
if (targetTalk.getNameText() === initialContrib) {
statelem.warn('Target is initial contributor; skipping target page notification');
} else if (targetTalk.getNameText() === mw.config.get('wgUserName')) {
statelem.warn('You (' + mw.config.get('wgUserName') + ') are the target; skipping target page notification');
}
} else {
Twinkle.xfd.callbacks.rfd.targetNotification(params, targetTalk);
}
}
},
userNotification: function(params, initialContrib) {
var usertalkpage = new Morebits.wiki.page('User talk:' + initialContrib, 'Notifying initial contributor (' + initialContrib + ')');
var notifytext = '\n{{subst:Rfd notice|1=' + Morebits.pageNameNorm + '}} ~~~~';
usertalkpage.setAppendText(notifytext);
usertalkpage.setEditSummary('Notification: [[' + params.discussionpage + '|listingnomination]] of [[:' + Morebits.pageNameNorm + ']] at [[WP:RFDMFD|redirectsmiscellany for discussiondeletion]].' + Twinkle.getPref('summaryAd'));
usertalkpage.setCreateOption('recreate');
Twinkle.xfd.setWatchPrefswitch (usertalkpage, Twinkle.getPref('xfdWatchUser')); {
case 'yes':
usertalkpage.setWatchlist(true);
break;
case 'no':
usertalkpage.setWatchlistFromPreferences(false);
break;
default:
usertalkpage.setWatchlistFromPreferences(true);
break;
}
usertalkpage.setFollowRedirect(true);
usertalkpage.append(function onNotifySuccess() {;
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, initialContrib);
}
}, function onNotifyError() {
// if user could not be notified, log nomination without mentioning that notification was sent
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
});
},
targetNotification: function(params, targetTalk) {
var targettalkpage = new Morebits.wiki.page(targetTalk, 'Notifying redirect target of the discussion');
var notifytext = '\n{{subst:Rfd notice|1=' + Morebits.pageNameNorm + '}} ~~~~';
targettalkpage.setAppendText(notifytext);
targettalkpage.setEditSummary('Notification: [[' + params.discussionpage + '|listing]] of [[:' + Morebits.pageNameNorm + ']] at [[WP:RFD|redirects for discussion]].' + Twinkle.getPref('summaryAd'));
targettalkpage.setCreateOption('recreate');
Twinkle.xfd.setWatchPref(targettalkpage, Twinkle.getPref('xfdWatchRelated'));
targettalkpage.setFollowRedirect(true);
// Add to userspace log even if not notifying the creator
if (params.lognomination && !params.usertalk) {
targettalkpage.append(function() {
Twinkle.xfd.callbacks.addToLog(params, null);
});
} else {
targettalkpage.append();
}
}
},
};
 
rm: {
listAtTalk: function(pageobj) {
var params = pageobj.getCallbackParameters();
 
pageobj.setAppendText('\n\n' + Twinkle.xfd.callbacks.getDiscussionWikitext('rm', params));
pageobj.setEditSummary('Proposing move' + (params.newname ? ' to [[:' + params.newname + ']]' : '') + Twinkle.getPref('summaryAd'));
pageobj.setCreateOption('recreate'); // since the talk page need not exist
Twinkle.xfd.setWatchPref(pageobj, Twinkle.getPref('xfdWatchDiscussion'));
pageobj.append(function() {
Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
});
},
 
listAtRMTR:Twinkle.xfd.callback.evaluate = function(pageobje) {
var texttype = pageobje.getPageText()target.category.value;
var usertalk = e.target.notify.checked;
var params = pageobj.getCallbackParameters();
var reason = e.target.xfdreason.value;
var statelem = pageobj.getStatusElement();
var xfdcat, xfdtarget, xfdtarget2, ffdvenue, noinclude, tfdinline, notifyuserspace;
 
if( type === "afd" || type === "cfd" || type === "cfds" || type === "tfd" ) {
var hiddenCommentRE = /---- and enter on a new line.* -->/;
xfdcat = e.target.xfdcat.value;
var newtext = text.replace(hiddenCommentRE, '$&\n' + Twinkle.xfd.callbacks.getDiscussionWikitext('rm', params));
}
if (text === newtext) {
if( type === "cfd" || type === "cfds" ) {
statelem.error('failed to find target spot for the entry');
xfdtarget = e.target.xfdtarget.value;
return;
if (e.target.xfdtarget2) {
xfdtarget2 = e.target.xfdtarget2.value;
}
}
if( type === 'ffd' ) {
var ffdvenues = e.target.ffdvenue;
for( var i = 0; i < ffdvenues.length; i++ )
{
if( !ffdvenues[i].checked ) {
continue;
}
ffdvenue = ffdvenues[i].values;
pageobj.setPageText(newtext);
break;
pageobj.setEditSummary('Adding [[:' + Morebits.pageNameNorm + ']].' + Twinkle.getPref('summaryAd'));
pageobj.save(function() {
Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki
// add this nomination to the user's userspace log, if the user has enabled it
if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
});
}
}
if( type === "afd" || type === "mfd" || type === "tfd" ) {
};
noinclude = e.target.noinclude.checked;
}
if( type === 'tfd' ) {
tfdinline = e.target.tfdinline.checked;
if (e.target.xfdtarget) {
xfdtarget = e.target.xfdtarget.value;
}
}
if( type === 'mfd' ) {
notifyuserspace = e.target.notifyuserspace && e.target.notifyuserspace.checked;
}
 
Morebits.simpleWindow.setButtonsEnabled( false );
 
Morebits.status.init( e.target );
 
Twinkle.xfd.callback.evaluate = function(e) {
var form = e.target;
 
var type = form.category.value;
var usertalk = form.notify.checked;
var reason = form.xfdreason.value;
var delsort_cats = $(form.delsort).val(); // afd
var xfdcat = form.xfdcat && form.xfdcat.value; // afd, cfd, cfds, tfd
var xfdtarget = form.xfdtarget && form.xfdtarget.value; // cfd, cfds, tfd
var xfdtarget2 = form.xfdtarget2 && form.xfdtarget2.value; // cfd
var noinclude = form.noinclude && form.noinclude.checked; // afd, mfd, tfd
var tfdtype = form.templatetype && form.templatetype.value; // tfd
var notifyuserspace = form.notifyuserspace && form.notifyuserspace.checked; // mfd
var relatedpage = form.relatedpage && form.relatedpage.checked; // rfd
var newname = form.newname && form.newname.value; // rm
var rmtr = form.rmtr && form.rmtr.checked; // rm
var lognomination = Twinkle.getPref('logXfdNominations') && Twinkle.getPref('noLogOnXfdNomination').indexOf(type) === -1;
 
Morebits.simpleWindow.setButtonsEnabled(false);
Morebits.status.init(form);
 
Twinkle.xfd.currentRationale = reason;
Morebits.status.onError(Twinkle.xfd.printRationale);
 
if ( !type ) {
Morebits.status.error( 'Error', 'no action given' );
return;
}
 
var query, wikipedia_page, wikipedia_api, logpage, params;
var date = new Date();
var params = { reason: reason, venue: type, lognomination: lognomination }; // Common params
switch( type ) {
var date = new Morebits.date(); // XXX: avoid use of client clock, still used by TfD, FfD and CfD
switch (type) {
 
case 'afd': // AFD
query = {
'action': 'query',
'list': 'allpages',
'apprefix': 'Articlesنقاش for deletionالحذف/' + Morebits.pageNameNorm,
'apnamespace': 4,
'apfilterredir': 'nonredirects',
'aplimit': Morebits.userIsInGroup( 'maxsysop' //) 500 is max for normal users,? 5000 for: bots and sysops500
};
wikipedia_api = new Morebits.wiki.api( 'Tagging article with deletion tag', query, Twinkle.xfd.callbacks.afd.main );
wikipedia_api.params = $.extend(params, { usertalk: usertalk, noincludereason:reason, noinclude:noinclude, xfdcat:xfdcat };
wikipedia_api.post();
xfdcat: xfdcat, delsort_cats: delsort_cats });
break;
wikipedia_api.post();
break;
 
case 'tfd': // TFD
Morebits.wiki.addCheckpoint();
if (xfdtarget) {
var tfdNamespace_re = new RegExp('^:?' + mw.config.get('wgCanonicalNamespace') + ':', 'i');
xfdtarget = Morebits.string.toUpperCaseFirstChar(xfdtarget.replace(tfdNamespace_re, ''));
} else {
xfdtarget = '';
}
 
if (xfdtarget) {
logpage = 'Wikipedia:Templates for discussion/Log/' + date.format('YYYY MMMM D', 'utc');
xfdtarget = Morebits.string.toUpperCaseFirstChar(xfdtarget.replace(/^\:?Template\:/i, ''));
} else {
xfdtarget = '';
}
 
logpage = 'Wikipedia:Templates for discussion/Log/' + date.getUTCFullYear() + ' ' + date.getUTCMonthName() + ' ' + date.getUTCDate();
$.extend(params, { tfdtype: tfdtype, logpage: logpage, noinclude: noinclude, xfdcat: xfdcat, target: xfdtarget });
params = { tfdinline: tfdinline, logpage: logpage, noinclude: noinclude, xfdcat: xfdcat, target: xfdtarget, reason: reason };
params.discussionpage = params.logpage + '#' + Morebits.pageNameNorm;
 
// Tagging template(s)
// Modules can't be tagged, TfD instructions are to place
if (xfdcat === "tfm") {
// on /doc subpage, so need to tag and watch specially
// Tag this template
params.scribunto = mw.config.get('wgPageContentModel') === 'Scribunto';
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "Tagging this template with merge tag");
var watch_query = {
wikipedia_page.setFollowRedirect(true);
action: 'watch',
params.otherTemplateName = "Template:" + xfdtarget;
titles: mw.config.get('wgPageName'),
wikipedia_page.setCallbackParameters(params);
token: mw.user.tokens.get('watchToken')
wikipedia_page.load(Twinkle.xfd.callbacks.tfd.taggingTemplateForMerge);
};
// Tagging template(s)/module(s)
if (xfdcat === 'tfm') { // Merge
var wikipedia_otherpage;
 
// Tag thisother template/module
wikipedia_page = new Morebits.wiki.page("Template:" + xfdtarget, "Tagging other template with merge tag");
if (params.scribunto) {
wikipedia_page.setFollowRedirect(true);
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName') + '/doc', 'Tagging this module documentation with merge tag');
params.otherTemplateName = 'Module:' + xfdtarget$.extend(params);
params.otherTemplateName = Morebits.pageNameNorm;
wikipedia_otherpage = new Morebits.wiki.page(params.otherTemplateName + '/doc', 'Tagging other module documentation with merge tag');
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.tfd.taggingTemplateForMerge);
} else {
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "Tagging template with deletion tag");
wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.tfd.taggingTemplate);
}
 
// Updating data for the action completed event
// Watch tagged module pages as well
Morebits.wiki.actionCompleted.redirect = logpage;
if (Twinkle.getPref('xfdWatchPage') !== 'no') {
Morebits.wiki.actionCompleted.notice = "Nomination completed, now redirecting to today's log";
watch_query.titles += '|' + params.otherTemplateName;
new Morebits.wiki.api('Adding Modules to watchlist', watch_query).post();
}
} else {
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging this template with merge tag');
params.otherTemplateName = 'Template:' + xfdtarget;
wikipedia_otherpage = new Morebits.wiki.page(params.otherTemplateName, 'Tagging other template with merge tag');
}
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.tfd.taggingTemplateForMerge);
 
// Adding discussion
// Tag other template/module
wikipedia_page = new Morebits.wiki.page(logpage, "Adding discussion to today's log");
wikipedia_otherpage.setFollowRedirect(true);
wikipedia_page.setFollowRedirect(true);
var otherParams = $.extend({}, params);
wikipedia_page.setCallbackParameters(params);
otherParams.otherTemplateName = Morebits.pageNameNorm;
wikipedia_page.load(Twinkle.xfd.callbacks.tfd.todaysList);
wikipedia_otherpage.setCallbackParameters(otherParams);
wikipedia_otherpage.load(Twinkle.xfd.callbacks.tfd.taggingTemplateForMerge);
} else { // delete
if (params.scribunto) {
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName') + '/doc', 'Tagging module documentation with deletion tag');
 
// Notification to first contributor
// Watch tagged module page as well
if (usertalk) {
if (Twinkle.getPref('xfdWatchPage') !== 'no') {
var thispage = new Morebits.wiki.apipage(mw.config.get('Adding Module to watchlistwgPageName', watch_query).post();
thispage.setCallbackParameters(params);
}
thispage.lookupCreator(Twinkle.xfd.callbacks.tfd.userNotification);
} else {
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging template with deletion tag');
}
wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.tfd.taggingTemplate);
}
 
// Nice try, but what if the two page creators are the same user?
// Updating data for the action completed event
// Also, other XFD types don't do this... yet!
Morebits.wiki.actionCompleted.redirect = logpage;
//if (xfdcat === "tfm") {
Morebits.wiki.actionCompleted.notice = "Nomination completed, now redirecting to today's log";
// thispage = new Morebits.wiki.page("Template:" + xfdtarget);
// thispage.setCallbackParameters(params);
// thispage.lookupCreator(Twinkle.xfd.callbacks.tfd.userNotification);
//}
}
 
Morebits.wiki.removeCheckpoint();
// Adding discussion
break;
wikipedia_page = new Morebits.wiki.page(logpage, "Adding discussion to today's log");
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.tfd.todaysList);
 
case 'mfd': // MFD
// Notification to first contributors
ifquery (usertalk)= {
'action': 'query',
var involvedpages = [];
'list': 'allpages',
var seenusers = [];
'apprefix': 'نقاش الحذف/' + Morebits.pageNameNorm,
involvedpages.push(new Morebits.wiki.page(mw.config.get('wgPageName')));
'apnamespace': 4,
if (xfdcat === 'tfm') {
'apfilterredir': 'nonredirects',
if (params.scribunto) {
involvedpages.push(new'aplimit': Morebits.wiki.pageuserIsInGroup( 'Module:sysop' + xfdtarget)); ? 5000 : 500
} else {;
wikipedia_api = new Morebits.wiki.api( "Looking for prior nominations of this page", query, Twinkle.xfd.callbacks.mfd.main );
involvedpages.push(new Morebits.wiki.page('Template:' + xfdtarget));
wikipedia_api.params = { usertalk: usertalk, notifyuserspace: notifyuserspace, reason: reason, noinclude: noinclude, xfdcat: xfdcat };
}
wikipedia_api.post();
}
break;
involvedpages.forEach(function(page) {
page.setCallbackParameters(params);
page.lookupCreation(function(innerpage) {
var username = innerpage.getCreator();
if (seenusers.indexOf(username) === -1) {
seenusers.push(username);
Twinkle.xfd.callbacks.tfd.userNotification(innerpage);
}
});
});
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
} else if (params.lognomination) {
Twinkle.xfd.callbacks.addToLog(params, null);
}
 
case 'ffd': // FFD/PUF/NFCR
Morebits.wiki.removeCheckpoint();
var dateString = date.getUTCFullYear() + ' ' + date.getUTCMonthName() + ' ' + date.getUTCDate();
break;
logpage = 'Wikipedia:Files for deletion/' + dateString;
params = { usertalk: usertalk, reason: reason, date: dateString, logpage: logpage };
 
Morebits.wiki.addCheckpoint();
case 'mfd': // MFD
queryswitch( =ffdvenue ) {
case 'actionpuf': 'query',
params.logpage = logpage = 'Wikipedia:Possibly unfree files/' + dateString;
'list': 'allpages',
'apprefix': 'Miscellany for deletion/' + Morebits.pageNameNorm,
'apnamespace': 4,
'apfilterredir': 'nonredirects',
'aplimit': 'max' // 500 is max for normal users, 5000 for bots and sysops
};
wikipedia_api = new Morebits.wiki.api('Looking for prior nominations of this page', query, Twinkle.xfd.callbacks.mfd.main);
wikipedia_api.params = $.extend(params, { usertalk: usertalk, notifyuserspace: notifyuserspace, noinclude: noinclude, xfdcat: xfdcat });
wikipedia_api.post();
break;
 
// Updating data for the action completed event
case 'ffd': // FFD
Morebits.wiki.actionCompleted.redirect = logpage;
var dateString = date.format('YYYY MMMM D', 'utc');
Morebits.wiki.actionCompleted.notice = "Nomination completed, now redirecting to today's list";
logpage = 'Wikipedia:Files for discussion/' + dateString;
$.extend(params, { usertalk: usertalk, date: dateString, logpage: logpage });
params.discussionpage = params.logpage + '#' + Morebits.pageNameNorm;
 
// Tagging file
Morebits.wiki.addCheckpoint();
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "Tagging file with PUF tag");
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.puf.taggingImage);
 
// Adding discussion
// Updating data for the action completed event
wikipedia_page = new Morebits.wiki.page(params.logpage, "إضافة مناقشة إلى قائمة اليوم");
Morebits.wiki.actionCompleted.redirect = logpage;
wikipedia_page.setFollowRedirect(true);
Morebits.wiki.actionCompleted.notice = 'Nomination completed, now redirecting to the discussion page';
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.puf.todaysList);
 
// Notification to first contributor
// Tagging file
if (usertalk) {
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Adding deletion tag to file page');
wikipedia_page = new Morebits.setFollowRedirectwiki.page(mw.config.get(true'wgPageName'));
wikipedia_page.setCallbackParameters(params);
wikipedia_page.loadlookupCreator(Twinkle.xfd.callbacks.ffdpuf.taggingImageuserNotification);
}
 
Morebits.wiki.removeCheckpoint();
// Contributor specific edits
break;
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'));
wikipedia_page.setCallbackParameters(params);
wikipedia_page.lookupCreation(Twinkle.xfd.callbacks.ffd.main);
 
case 'nfcr':
Morebits.wiki.removeCheckpoint();
// Updating data for the action completed event
break;
Morebits.wiki.actionCompleted.redirect = "Wikipedia:Non-free content review";
Morebits.wiki.actionCompleted.notice = "Nomination completed, now redirecting to the discussion page";
 
// Tagging file
case 'cfd':
if (mw.config.get('wgNamespaceNumber') === 6) {
Morebits.wiki.addCheckpoint();
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "Tagging file with review tag");
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setPrependText("{{non-free review}}\n");
wikipedia_page.setEditSummary("هذا الملف" +
" مدرج للمراجعة: [[:en:Wikipedia:Non-free content review#" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd'));
switch (Twinkle.getPref('xfdWatchPage')) {
case 'yes':
wikipedia_page.setWatchlist(true);
break;
case 'no':
wikipedia_page.setWatchlistFromPreferences(false);
break;
default:
wikipedia_page.setWatchlistFromPreferences(true);
break;
}
wikipedia_page.setCreateOption('recreate'); // it might be possible for a file to exist without a description page
wikipedia_page.prepend();
}
 
// Adding discussion
var cfdNamespace_re = new RegExp('^:?' + mw.config.get('wgCanonicalNamespace') + ':', 'i');
wikipedia_page = new Morebits.wiki.page("Wikipedia:Non-free content review", "Adding discussion to the NFCR page");
if (xfdtarget) {
wikipedia_page.setFollowRedirect(true);
xfdtarget = xfdtarget.replace(cfdNamespace_re, '');
wikipedia_page.setAppendText("\n\n== [[:" + Morebits.pageNameNorm + "]] ==\n\n" +
} else {
Morebits.string.formatReasonText(params.reason) + " ~~~~");
xfdtarget = '';
wikipedia_page.setEditSummary("افزودن [[" + Morebits.pageNameNorm + "]]." + Twinkle.getPref('summaryAd'));
}
switch (Twinkle.getPref('xfdWatchDiscussion')) {
if (xfdtarget2) {
case 'yes':
xfdtarget2 = xfdtarget2.replace(cfdNamespace_re, '');
wikipedia_page.setWatchlist(true);
}
break;
case 'no':
wikipedia_page.setWatchlistFromPreferences(false);
break;
default:
wikipedia_page.setWatchlistFromPreferences(true);
break;
}
wikipedia_page.setCreateOption('recreate');
wikipedia_page.append(function() {
Twinkle.xfd.currentRationale = null; // any errors from now on do not need to print the rationale, as it is safely saved on-wiki
});
 
// can't notify user on NFCR, so don't
logpage = 'Wikipedia:Categories for discussion/Log/' + date.format('YYYY MMMM D', 'utc');
 
Morebits.wiki.removeCheckpoint();
$.extend(params, { xfdcat: xfdcat, target: xfdtarget, target2: xfdtarget2, logpage: logpage });
break;
params.discussionpage = params.logpage + '#' + Morebits.pageNameNorm;
 
default:
// Useful for customized actions in edit summaries and the notification template
// Updating data for the action completed event
var summaryActions = {
Morebits.wiki.actionCompleted.redirect = logpage;
cfd: 'deletion',
Morebits.wiki.actionCompleted.notice = "Nomination completed, now redirecting to the discussion page";
'sfd-t': 'deletion',
cfm: 'merging',
cfr: 'renaming',
'sfr-t': 'renaming',
cfs: 'splitting',
cfc: 'conversion'
};
params.action = summaryActions[params.xfdcat];
 
// Tagging file
// Updating data for the action completed event
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "Adding deletion tag to file page");
Morebits.wiki.actionCompleted.redirect = logpage;
wikipedia_page.setFollowRedirect(true);
Morebits.wiki.actionCompleted.notice = "Nomination completed, now redirecting to today's log";
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.ffd.taggingImage);
 
// TaggingContributor categoryspecific edits
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging category with ' + params.action + ' tag');
wikipedia_page.setFollowRedirect(true); // should never be needed, but if the page is moved, we would want to follow the redirect
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.cfd.taggingCategory);
 
// Adding discussion to list
wikipedia_page = new Morebits.wiki.page(logpage, "Adding discussion to today's list");
wikipedia_page.setPageSection(2);
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.cfd.todaysList);
 
// Notification to first contributor
if (usertalk) {
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'));
wikipedia_page.setCallbackParameters(params);
wikipedia_page.lookupCreationlookupCreator(Twinkle.xfd.callbacks.cfdffd.userNotificationmain);
break;
// or, if not notifying, add this nomination to the user's userspace log without the initial contributor's name
}
} else if (params.lognomination) {
Morebits.wiki.removeCheckpoint();
Twinkle.xfd.callbacks.addToLog(params, null);
}break;
 
case 'cfd':
Morebits.wiki.removeCheckpoint();
Morebits.wiki.addCheckpoint();
break;
 
if( xfdtarget ) {
case 'cfds':
xfdtarget = xfdtarget.replace( /^\:?Category\:/.test(xfdtarget) ? xfdtarget :i, 'Category:' + xfdtarget);
} else {
xfdtarget = '';
}
 
if( xfdtarget2 ) {
logpage = 'Wikipedia:Categories for discussion/Speedy';
xfdtarget2 = xfdtarget2.replace( /^\:?Category\:/i, '' );
$.extend(params, { xfdcat: xfdcat, target: xfdtarget });
}
 
logpage = 'Wikipedia:Categories for discussion/Log/' + date.getUTCFullYear() + ' ' + date.getUTCMonthName() + ' ' + date.getUTCDate();
// Updating data for the action completed event
Morebits.wiki.actionCompleted.redirect = logpage;
Morebits.wiki.actionCompleted.notice = 'Nomination completed, now redirecting to the discussion page';
 
params = { reason: reason, xfdcat: xfdcat, target: xfdtarget, target2: xfdtarget2, logpage: logpage };
// Tagging category
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), 'Tagging category with rename tag');
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.cfds.taggingCategory);
 
// Updating data for the action completed event
// Adding discussion to list
Morebits.wiki.actionCompleted.redirect = logpage;
wikipedia_page = new Morebits.wiki.page(logpage, 'Adding discussion to the list');
Morebits.wiki.actionCompleted.notice = "Nomination completed, now redirecting to today's log";
wikipedia_page.setFollowRedirect(true);
 
// Tagging category
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "Tagging category with deletion tag");
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.cfd.taggingCategory);
 
// Adding discussion to list
wikipedia_page = new Morebits.wiki.page(logpage, "إضافة المناقشة إلى سجل اليوم");
//wikipedia_page.setPageSection(2);
// pageSection has been disabled - the API seems to throw up with nonexistent edit conflicts
// it can be turned on again once the problem is fixed, to save bandwidth
//wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.cfd.todaysList);
 
// Notification to first contributor
if (usertalk) {
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'));
wikipedia_page.setCallbackParameters(params);
wikipedia_page.loadlookupCreator(Twinkle.xfd.callbacks.cfdscfd.addToListuserNotification);
}
 
Morebits.wiki.removeCheckpoint();
break;
break;
 
case 'rfdcfds':
xfdtarget = xfdtarget.replace( /^\:?Category\:/, '' );
$.extend(params, { usertalk: usertalk, relatedpage: relatedpage });
// find target and pass main as the callback
Twinkle.xfd.callbacks.rfd.findTarget(params, Twinkle.xfd.callbacks.rfd.main);
break;
 
logpage = "Wikipedia:Categories for discussion/Speedy";
case 'rm':
$.extend(params, = { newnamereason: reason, xfdcat: newnamexfdcat, rmtrtarget: rmtrxfdtarget });
var nomPageName = rmtr ?
'Wikipedia:Requested moves/Technical requests' :
new mw.Title(Morebits.pageNameNorm).getTalkPage().toText();
 
// Updating data for the action completed event
Morebits.wiki.actionCompleted.redirect = nomPageName;
Morebits.wiki.actionCompleted.redirect = logpage;
Morebits.wiki.actionCompleted.notice = '"Nomination completed, now redirecting to the discussion page'";
 
// Tagging category
wikipedia_page = new Morebits.wiki.page(nomPageName, rmtr ? 'Adding entry at WP:RM/TR' : 'Adding entry on talk page');
wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "Tagging category with rename tag");
wikipedia_page.setFollowRedirect(true);
wikipedia_page.setCallbackParameters(params);
wikipedia_page.load(Twinkle.xfd.callbacks.cfds.taggingCategory);
 
// Adding discussion to list
if (rmtr) {
wikipedia_page = new Morebits.setPageSectionwiki.page(2logpage, "Adding discussion to the list");
wikipedia_page.loadsetCallbackParameters(Twinkle.xfd.callbacks.rm.listAtRMTRparams);
wikipedia_page.load(Twinkle.xfd.callbacks.cfds.addToList);
} else {
// listAtTalk uses .append(), so no need to load the page
Twinkle.xfd.callbacks.rm.listAtTalk(wikipedia_page);
}
break;
 
break;
default:
 
alert('twinklexfd: unknown XFD discussion venue');
case 'rfd':
break;
params = { usertalk: usertalk, reason: reason };
if (document.getElementById("softredirect")) {
// For soft redirects, skip straight to the callback
params.target = document.getElementById("softredirect").textContent.replace(/^\:+/, "");
Twinkle.xfd.callbacks.rfd.main(params);
} else {
// Find current target of redirect
query = {
'action': 'query',
'titles': mw.config.get('wgPageName'),
'redirects': true
};
wikipedia_api = new Morebits.wiki.api( "Finding target of redirect", query, Twinkle.xfd.callbacks.rfd.findTargetCallback );
wikipedia_api.params = params;
wikipedia_api.post();
}
break;
default:
alert("twinklexfd: unknown XFD discussion venue");
break;
}
};
السطر 2٬022 ⟵ 1٬824:
 
 
// </nowiki>