وتووێژی میدیاویکی:Gadget-twinkleprotect.js

ناوەڕۆکی پەڕە بە زمانەکانی تر پشتگیریی لێ ناکرێت.
لە ئینسایکڵۆپیدیای ئازادی ویکیپیدیاوە

داواکاریی دەستکاری لە ١٢ی ئەیلوولی ٢٠٢٠[دەستکاری]

بیلا زەحمەت کاک @Aram: ئەم پەڕەیە بەم کۆدەی خوارەوە ئەپدەیت بکە.

ناوەڕۆک نیشان بدە

// (function($){ /* **************************************** *** twinkleprotect.js: Protect/RPP module **************************************** * Mode of invocation: Tab ("PP"/"RPP") * Active on: Non-special pages * Config directives in: TwinkleConfig */ // Note: a lot of code in this module is re-used/called by batchprotect. Twinkle.protect = function twinkleprotect() { if ( mw.config.get('wgNamespaceNumber') < 0 ) { return; } Twinkle.addPortletLink(Twinkle.protect.callback, Morebits.userIsInGroup('sysop') ? "پاراستنی پەڕە" : "RPP", "tw-rpp", Morebits.userIsInGroup('sysop') ? "پاراستنی پەڕە" : "داواکردنی پاراستن" ); }; Twinkle.protect.callback = function twinkleprotectCallback() { var Window = new Morebits.simpleWindow( 620, 530 ); Window.setTitle( Morebits.userIsInGroup( 'sysop' ) ? "پاراستن، دانانی تاگ یان داواکردنی پاراستن" : "داواکردن یان دانانی تاگی پاراستن" ); Window.setScriptName( "توینکڵ" ); Window.addFooterLink( "داڕێژەکانی پاراستن", "داڕيژە:داڕێژەکانی پاراستن" ); Window.addFooterLink( "سیاسەتی پاراستن", "وپ:سیاسەتی پاراستن" ); Window.addFooterLink( "یارمەتیی توینکڵ", "وپ:تو/DOC#پاراستن" ); var form = new Morebits.quickForm( Twinkle.protect.callback.evaluate ); var actionfield = form.append( { type: 'field', label: 'جۆری کردەوە' } ); if( Morebits.userIsInGroup( 'sysop' ) ) { actionfield.append( { type: 'radio', name: 'actiontype', event: Twinkle.protect.callback.changeAction, list: [ { label: 'پاراستنی پەڕە', value: 'protect', tooltip: 'پاراستنی پەڕەکە بە کرداری.', checked: true } ] } ); } actionfield.append( { type: 'radio', name: 'actiontype', event: Twinkle.protect.callback.changeAction, list: [ { label: 'داواکردنی پاراستنی پەڕە', value: 'request', tooltip: 'ئەگەر دەتەوێت داوای پاراستنی پەڕەکە بکەیت' + (Morebits.userIsInGroup('sysop') ? ' لەجیاتی ئەنجامدانی پاراستنەکە.' : '.'), checked: !Morebits.userIsInGroup('sysop') }, { label: 'تاگکردنی پەڕەکە بە داڕێژەی پاراستن', value: 'tag', tooltip: 'ئەگەر بەڕێوەبەری پارێزەر بیری چووبوو داڕێژەی شیاو دابنێت، دەتوانیت بەمە تاگی لێ بدەیت.', disabled: mw.config.get('wgArticleId') === 0 } ] } ); form.append({ type: 'field', label: 'حازرەکان', name: 'field_preset' }); form.append({ type: 'field', label: '1', name: 'field1' }); form.append({ type: 'field', label: '2', name: 'field2' }); form.append( { type:'submit', label: 'ناردن' } ); var result = form.render(); Window.setContent( result ); Window.display(); // We must init the controls var evt = document.createEvent( "Event" ); evt.initEvent( 'change', true, true ); result.actiontype[0].dispatchEvent( evt ); Morebits.wiki.actionCompleted.postfix = false; // avoid Action: completed notice // get current protection level asynchronously Twinkle.protect.fetchProtectionLevel(); }; // Contains the current protection level in an object // Once filled, it will look something like: // { edit: { level: "sysop", expiry: <some date>, cascade: true }, ... } Twinkle.protect.currentProtectionLevels = {}; Twinkle.protect.fetchProtectionLevel = function twinkleprotectFetchProtectionLevel() { var api = new mw.Api(); var protectDeferred = api.get({ format: 'json', indexpageids: true, action: 'query', list: 'logevents', letype: 'protect', letitle: mw.config.get('wgPageName'), prop: 'info|flagged', inprop: 'protection', titles: mw.config.get('wgPageName') }); var stableDeferred = api.get({ format: 'json', action: 'query', list: 'logevents', letype: 'stable', letitle: mw.config.get('wgPageName') }); $.when.apply($, [protectDeferred, stableDeferred]).done(function(protectData, stableData){ var pageid = protectData[0].query.pageids[0]; var page = protectData[0].query.pages[pageid]; var current = {}; $.each(page.protection, function( index, protection ) { if (protection.type !== "aft") { current[protection.type] = { level: protection.level, expiry: protection.expiry, cascade: protection.cascade === '' }; } }); if (page.flagged) { current.stabilize = { level: page.flagged.protection_level, expiry: page.flagged.protection_expiry }; } // show the protection level and log info Twinkle.protect.hasProtectLog = !!protectData[0].query.logevents.length; Twinkle.protect.hasStableLog = !!stableData[0].query.logevents.length; Twinkle.protect.currentProtectionLevels = current; Twinkle.protect.callback.showLogAndCurrentProtectInfo(); }); }; Twinkle.protect.callback.showLogAndCurrentProtectInfo = function twinkleprotectCallbackShowLogAndCurrentProtectInfo() { var currentlyProtected = !$.isEmptyObject(Twinkle.protect.currentProtectionLevels); if (Twinkle.protect.hasProtectLog || Twinkle.protect.hasStableLog) { var $linkMarkup = $("<span>"); if (Twinkle.protect.hasProtectLog) $linkMarkup.append( $( '<a target="_blank" href="' + mw.util.getUrl('Special:Log', {action: 'view', page: mw.config.get('wgPageName'), type: 'protect'}) + '">protection log</a>' ), Twinkle.protect.hasStableLog ? $("<span> • </span>") : null ); if (Twinkle.protect.hasStableLog) $linkMarkup.append($( '<a target="_blank" href="' + mw.util.getUrl('Special:Log', {action: 'view', page: mw.config.get('wgPageName'), type: 'stable'}) + '">pending changes log</a>)' )); Morebits.status.init($('div[name="hasprotectlog"] span')[0]); Morebits.status.warn( currentlyProtected ? 'پاراستنەکانی پێشوو' : 'ئەم پەڕەیە لە پێشوودا پارێزراو بووە', $linkMarkup[0] ); } Morebits.status.init($('div[name="currentprot"] span')[0]); var protectionNode = [], statusLevel = 'زانیاری'; if (currentlyProtected) { $.each(Twinkle.protect.currentProtectionLevels, function(type, settings) { var label = type === 'stabilize' ? 'گۆڕانکارییە ھەڵواسراوەکان' : Morebits.string.toUpperCaseFirstChar(type); protectionNode.push($("<b>" + label + ": " + settings.level + "</b>")[0]); if (settings.expiry === 'infinity') { protectionNode.push(" (بێکۆتا) "); } else { protectionNode.push(" (لە " + new Date(settings.expiry).toUTCString() + ") بەسەر دەچێت "); } if (settings.cascade) { protectionNode.push("(تاڤگەیی) "); } }); statusLevel = 'warn'; } else { protectionNode.push($("<b>نەپارێزراو</b>")[0]); } Morebits.status[statusLevel]("ئاستی پاراستنی ئێستا", protectionNode); }; Twinkle.protect.callback.changeAction = function twinkleprotectCallbackChangeAction(e) { var field_preset; var field1; var field2; var isTemplate = mw.config.get("wgNamespaceNumber") === 10 || mw.config.get("wgNamespaceNumber") === 828; switch (e.target.values) { case 'protect': field_preset = new Morebits.quickForm.element({ type: 'field', label: 'حازر', name: 'field_preset' }); field_preset.append({ type: 'select', name: 'category', label: 'ھەڵبژاردنی نموونەیەک:', event: Twinkle.protect.callback.changePreset, list: (mw.config.get('wgArticleId') ? Twinkle.protect.protectionTypes.filter(function(v) { return isTemplate || v.label !== 'داڕێژەی پاراستن'; }) : Twinkle.protect.protectionTypesCreate) }); field2 = new Morebits.quickForm.element({ type: 'field', label: 'ھەڵبژاردەکانی پاراستن', name: 'field2' }); field2.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback field2.append({ type: 'div', name: 'hasprotectlog', label: ' ' }); // for existing pages if (mw.config.get('wgArticleId')) { field2.append({ type: 'checkbox', name: 'editmodify', event: Twinkle.protect.formevents.editmodify, list: [ { label: 'گۆڕینی پاراستنی دەستکاری', value: 'editmodify', tooltip: 'ئەگەر ئەمە چالاک نییە، ماوەی بەسەرچوون و ھەڵبژاردەکانی تر وەک حاڵەتی خۆیان دەمێننەوە.', checked: true } ] }); var editlevel = field2.append({ type: 'select', name: 'editlevel', label: 'پاراستنی دەستکاری:', event: Twinkle.protect.formevents.editlevel }); editlevel.append({ type: 'option', label: 'ھەموو', value: 'all' }); editlevel.append({ type: 'option', label: 'پەسەندکراوی خۆگەڕ', value: 'autoconfirmed' }); editlevel.append({ type: 'option', label: 'زێدەپەسەندکراو', value: 'extendedconfirmed' }); if (isTemplate) { editlevel.append({ type: 'option', label: 'دەستکاریکەری داڕێژە', value: 'templateeditor' }); } editlevel.append({ type: 'option', label: 'بەڕێوەبەر', value: 'sysop', selected: true }); field2.append({ type: 'select', name: 'editexpiry', label: 'بەسەرچوون:', event: function(e) { if (e.target.value === 'custom') { Twinkle.protect.doCustomExpiry(e.target); } }, // default expiry selection is conditionally set in Twinkle.protect.callback.changePreset list: [ { label: '١ سەعات', value: '1 hour' }, { label: '٢ سەعات', value: '2 hours' }, { label: '٣ سەعات', value: '3 hours' }, { label: '٦ سەعات', value: '6 hours' }, { label: '١٢ سەعات', value: '12 hours' }, { label: '١ ڕۆژ', value: '1 day' }, { label: '٢ ڕۆژ', value: '2 days' }, { label: '٣ ڕۆژ', value: '3 days' }, { label: '٤ ڕۆژ', value: '4 days' }, { label: '١ حەفتە', value: '1 week' }, { label: '٢ حەفتە', value: '2 weeks' }, { label: '١ مانگ', value: '1 month' }, { label: '٢ مانگ', value: '2 months' }, { label: '٣ مانگ', value: '3 months' }, { label: '١ ساڵ', value: '1 year' }, { label: 'بێکۆتا', value:'indefinite' }, { label: 'ھی تر...', value: 'custom' } ] }); field2.append({ type: 'checkbox', name: 'movemodify', event: Twinkle.protect.formevents.movemodify, list: [ { label: 'دەستکاریکردنی پاراستنی گواستنەوە', value: 'movemodify', tooltip: 'ئەگەر ئەمە بە کوژاوەیی جێھێڵدرا، ھەڵبژاردەکانی ئاستی پاراستن و بەسەرچوون وەک خۆیان دەمێننەوە.', checked: true } ] }); var movelevel = field2.append({ type: 'select', name: 'movelevel', label: 'پاراستنی گواستنەوە:', event: Twinkle.protect.formevents.movelevel }); movelevel.append({ type: 'option', label: 'ھەموو', value: 'all' }); movelevel.append({ type: 'option', label: 'پەسەندکراوی خۆگەڕ', value: 'autoconfirmed' }); movelevel.append({ type: 'option', label: 'زێدەپەسەندکراو', value: 'extendedconfirmed' }); if (isTemplate) { movelevel.append({ type: 'option', label: 'دەستکاریکەری داڕێژە', value: 'templateeditor' }); } movelevel.append({ type: 'option', label: 'بەڕێوەبەر', value: 'sysop', selected: true }); field2.append({ type: 'select', name: 'moveexpiry', label: 'بەسەرچوون:', event: function(e) { if (e.target.value === 'custom') { Twinkle.protect.doCustomExpiry(e.target); } }, // default expiry selection is conditionally set in Twinkle.protect.callback.changePreset list: [ { label: '١ سەعات', value: '1 hour' }, { label: '٢ سەعات', value: '2 hours' }, { label: '٣ سەعات', value: '3 hours' }, { label: '٦ سەعات', value: '6 hours' }, { label: '١٢ سەعات', value: '12 hours' }, { label: '١ ڕۆژ', value: '1 day' }, { label: '٢ ڕۆژ', value: '2 days' }, { label: '٣ ڕۆژ', value: '3 days' }, { label: '٤ ڕۆژ', value: '4 days' }, { label: '١ حەفتە', value: '1 week' }, { label: '٢ حەفتە', value: '2 weeks' }, { label: '١ مانگ', value: '1 month' }, { label: '٢ مانگ', value: '2 months' }, { label: '٣ مانگ', value: '3 months' }, { label: '١ ساڵ', value: '1 year' }, { label: 'بێکۆتا', value:'indefinite' }, { label: 'ھی تر...', value: 'custom' } ] }); field2.append({ type: 'checkbox', name: 'pcmodify', event: Twinkle.protect.formevents.pcmodify, list: [ { label: 'دەستکاریکردنی پاراستنی وەشانی جێگیر', value: 'pcmodify', tooltip: 'ئەگەر ئەمە بە کوژاوەیی جێھێڵدرا، ھەڵبژاردەکانی ئاستی پاراستن و بەسەرچوون وەک خۆیان دەمێننەوە.', checked: true } ] }); var pclevel = field2.append({ type: 'select', name: 'pclevel', label: 'گۆڕانکارییە ھەڵواسراوەکان:', event: Twinkle.protect.formevents.pclevel }); pclevel.append({ type: 'option', label: 'ھیچ', value: 'none' }); pclevel.append({ type: 'option', label: 'ئاستی ١', value: 'autoconfirmed', selected: true }); pclevel.append({ type: 'option', label: 'ئاستی ٢ (بەکاری مەھێنە)', value: 'review' }); field2.append({ type: 'select', name: 'pcexpiry', label: 'بەسەرچوون:', event: function(e) { if (e.target.value === 'custom') { Twinkle.protect.doCustomExpiry(e.target); } }, list: [ { label: '١ سەعات', value: '1 hour' }, { label: '٢ سەعات', value: '2 hours' }, { label: '٣ سەعات', value: '3 hours' }, { label: '٦ سەعات', value: '6 hours' }, { label: '١٢ سەعات', value: '12 hours' }, { label: '١ ڕۆژ', value: '1 day' }, { label: '٢ ڕۆژ', value: '2 days' }, { label: '٣ ڕۆژ', value: '3 days' }, { label: '٤ ڕۆژ', value: '4 days' }, { label: '١ حەفتە', value: '1 week' }, { label: '٢ حەفتە', value: '2 weeks' }, { label: '١ مانگ', value: '1 month' }, { label: '٢ مانگ', value: '2 months' }, { label: '٣ مانگ', value: '3 months' }, { label: '١ ساڵ', value: '1 year' }, { label: 'بێکۆتا', value:'indefinite' }, { label: 'ھی تر...', value: 'custom' } ] }); } else { // for non-existing pages var createlevel = field2.append({ type: 'select', name: 'createlevel', label: 'دروستکردنی پاراستن:', event: Twinkle.protect.formevents.createlevel }); createlevel.append({ type: 'option', label: 'ھەموو', value: 'all' }); createlevel.append({ type: 'option', label: 'پەسەندکراوی خۆگەڕ', value: 'autoconfirmed' }); if (isTemplate) { createlevel.append({ type: 'option', label: 'دەستکاریکەری داڕێژە', value: 'templateeditor' }); } createlevel.append({ type: 'option', label: 'زێدەپەسەندکراو', value: 'extendedconfirmed', selected: true }); createlevel.append({ type: 'option', label: 'بەڕێوەبەر', value: 'sysop' }); field2.append({ type: 'select', name: 'createexpiry', label: 'بەسەرچوون:', event: function(e) { if (e.target.value === 'custom') { Twinkle.protect.doCustomExpiry(e.target); } }, list: [ { label: '١ سەعات', value: '1 hour' }, { label: '٢ سەعات', value: '2 hours' }, { label: '٣ سەعات', value: '3 hours' }, { label: '٦ سەعات', value: '6 hours' }, { label: '١٢ سەعات', value: '12 hours' }, { label: '١ ڕۆژ', value: '1 day' }, { label: '٢ ڕۆژ', value: '2 days' }, { label: '٣ ڕۆژ', value: '3 days' }, { label: '٤ ڕۆژ', value: '4 days' }, { label: '١ حەفتە', value: '1 week' }, { label: '٢ حەفتە', value: '2 weeks' }, { label: '١ مانگ', value: '1 month' }, { label: '٢ مانگ', value: '2 months' }, { label: '٣ مانگ', value: '3 months' }, { label: '١ ساڵ', value: '1 year' }, { label: 'بێکۆتا', value:'indefinite' }, { label: 'ھی تر...', value: 'custom' } ] }); } field2.append({ type: 'textarea', name: 'protectReason', label: 'ھۆکار (بۆ لۆگی پاراستن):' }); if (!mw.config.get('wgArticleId')) { // tagging isn't relevant for non-existing pages break; } /* falls through */ case 'tag': field1 = new Morebits.quickForm.element({ type: 'field', label: 'ھەڵبژاردەکانی تاگکردن', name: 'field1' }); field1.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback field1.append({ type: 'div', name: 'hasprotectlog', label: ' ' }); field1.append( { type: 'select', name: 'tagtype', label: 'ھەڵبژاردنی داڕێژەی پاراستن:', list: Twinkle.protect.protectionTags, event: Twinkle.protect.formevents.tagtype } ); field1.append( { type: 'checkbox', list: [ { name: 'small', label: 'کردن بە نیشانە', tooltip: 'وەشانی بچووکی داڕێژەکە بەکار دەبات کە لەجیاتی دەق قوفڵێک لە بەشی ڕاستی وتارەکە دادەنێت', checked: true }, { name: 'noinclude', label: 'ئاڵانی داڕێژەی پاراستن لە <noinclude>', tooltip: 'داڕێژەکە لە تاگی <noinclude&gt دەئاڵێنێت ، تاکوو تێکەڵ نەبێت بە ناوەڕۆک ', checked: (mw.config.get('wgNamespaceNumber') === 10) } ] } ); break; case 'request': field_preset = new Morebits.quickForm.element({ type: 'field', label: 'جۆری پاراستن', name: 'field_preset' }); field_preset.append({ type: 'select', name: 'category', label: 'جۆر و ھۆکار:', event: Twinkle.protect.callback.changePreset, list: (mw.config.get('wgArticleId') ? Twinkle.protect.protectionTypes : Twinkle.protect.protectionTypesCreate) }); field1 = new Morebits.quickForm.element({ type: 'field', label: 'ھەڵبژاردەکان', name: 'field1' }); field1.append({ type: 'div', name: 'currentprot', label: ' ' }); // holds the current protection level, as filled out by the async callback field1.append({ type: 'div', name: 'hasprotectlog', label: ' ' }); field1.append( { type: 'select', name: 'expiry', label: 'ماوە: ', list: [ { label: 'کاتی', value: 'temporary' }, { label: 'بێکۆتا', value: 'indefinite' }, { label: '', selected: true, value: '' } ] } ); field1.append({ type: 'textarea', name: 'reason', label: 'ھۆکار: ' }); break; default: alert("ھەڵبژاردەی پاراستنی توینکڵ کێشەیەکی ھەیە"); break; } var oldfield; if (field_preset) { oldfield = $(e.target.form).find('fieldset[name="field_preset"]')[0]; oldfield.parentNode.replaceChild(field_preset.render(), oldfield); } else { $(e.target.form).find('fieldset[name="field_preset"]').css('display', 'none'); } if (field1) { oldfield = $(e.target.form).find('fieldset[name="field1"]')[0]; oldfield.parentNode.replaceChild(field1.render(), oldfield); } else { $(e.target.form).find('fieldset[name="field1"]').css('display', 'none'); } if (field2) { oldfield = $(e.target.form).find('fieldset[name="field2"]')[0]; oldfield.parentNode.replaceChild(field2.render(), oldfield); } else { $(e.target.form).find('fieldset[name="field2"]').css('display', 'none'); } if (e.target.values === 'protect') { // fake a change event on the preset dropdown var evt = document.createEvent( "Event" ); evt.initEvent( 'change', true, true ); e.target.form.category.dispatchEvent( evt ); // reduce vertical height of dialog $(e.target.form).find('fieldset[name="field2"] select').parent().css({ display: 'inline-block', marginRight: '0.5em' }); } // re-add protection level and log info, if it's available Twinkle.protect.callback.showLogAndCurrentProtectInfo(); }; Twinkle.protect.formevents = { editmodify: function twinkleprotectFormEditmodifyEvent(e) { e.target.form.editlevel.disabled = !e.target.checked; e.target.form.editexpiry.disabled = !e.target.checked || (e.target.form.editlevel.value === 'all'); e.target.form.editlevel.style.color = e.target.form.editexpiry.style.color = (e.target.checked ? "" : "ڕوون"); }, editlevel: function twinkleprotectFormEditlevelEvent(e) { e.target.form.editexpiry.disabled = (e.target.value === 'all'); }, movemodify: function twinkleprotectFormMovemodifyEvent(e) { // sync move settings with edit settings if applicable if (e.target.form.movelevel.disabled && !e.target.form.editlevel.disabled) { e.target.form.movelevel.value = e.target.form.editlevel.value; e.target.form.moveexpiry.value = e.target.form.editexpiry.value; } else if (e.target.form.editlevel.disabled) { e.target.form.movelevel.value = 'sysop'; e.target.form.moveexpiry.value = 'indefinite'; } e.target.form.movelevel.disabled = !e.target.checked; e.target.form.moveexpiry.disabled = !e.target.checked || (e.target.form.movelevel.value === 'all'); e.target.form.movelevel.style.color = e.target.form.moveexpiry.style.color = (e.target.checked ? "" : "ڕوون"); }, movelevel: function twinkleprotectFormMovelevelEvent(e) { e.target.form.moveexpiry.disabled = (e.target.value === 'all'); }, pcmodify: function twinkleprotectFormPcmodifyEvent(e) { e.target.form.pclevel.disabled = !e.target.checked; e.target.form.pcexpiry.disabled = !e.target.checked || (e.target.form.pclevel.value === 'none'); e.target.form.pclevel.style.color = e.target.form.pcexpiry.style.color = (e.target.checked ? "" : "ڕوون"); }, pclevel: function twinkleprotectFormPclevelEvent(e) { e.target.form.pcexpiry.disabled = (e.target.value === 'none'); }, createlevel: function twinkleprotectFormCreatelevelEvent(e) { e.target.form.createexpiry.disabled = (e.target.value === 'all'); }, tagtype: function twinkleprotectFormTagtypeEvent(e) { e.target.form.small.disabled = e.target.form.noinclude.disabled = (e.target.value === 'none') || (e.target.value === 'noop'); } }; Twinkle.protect.doCustomExpiry = function twinkleprotectDoCustomExpiry(target) { var custom = prompt('کاتێکی بەسەرچوونی جیاواز دابنێ. \nدەبێت بە ئینگلیزی بینووسیت، نم: 31 minutes', ''); if (custom) { var option = document.createElement('option'); option.setAttribute('value', custom); option.textContent = custom; target.appendChild(option); target.value = custom; } else { target.selectedIndex = 0; } }; Twinkle.protect.protectionTypes = [ { label: 'لابردنی پاراستن', value: 'unprotect' }, { label: 'پاراستنی تەواو', list: [ { label: 'سادە (تەواو)', value: 'pp-protected' }, { label: 'ناکۆکیی ناوەڕۆک/شەڕەدەستکاری (تەواو)', value: 'pp-dispute' }, { label: 'خراپکاریی بەردەوام (تەواو)', value: 'pp-vandalism' }, { label: 'پەڕەی لێدوانی بەکارھێنەری بەربەستکراو (تەواو)', value: 'pp-usertalk' } ] }, { label: 'داڕێژەی پاراستن', list: [ { label: 'داڕێژەی زۆربینراو (ھەستیار)', value: 'pp-template' } ] }, { label: 'پاراستنی زێدەپەسەندکراو', list: [ { label: 'سەپاندنی لیژنەی ناوبژی', selected: true, value: 'pp-30-500-arb' }, { label: 'خراپکاریی بەردەوام', value: 'pp-30-500-vandalism' }, { label: 'دەستکاریی تێکدەر', value: 'pp-30-500-disruptive' }, { label: 'پێشێلکردنی سیاسەتی ژکز', value: 'pp-30-500-blp' }, { label: 'بووکەڵەکاری', value: 'pp-30-500-sock' } ] }, { label: 'نیمچە پاراستن', list: [ { label: 'سادە (نیمچە)', value: 'pp-semi-protected' }, { label: 'خراپکاریی بەردەوام (نیمچە)', selected: true, value: 'pp-semi-vandalism' }, { label: 'دەستکاریی تێکدەر (نیمچە)', value: 'pp-semi-disruptive' }, { label: 'زیادکردنی ناوەڕۆکی بێسەرچاوە (نیمچە)', value: 'pp-semi-unsourced' }, { label: 'پێشێلکردنی سیاسەتی ژکز (نیمچە)', value: 'pp-semi-blp' }, { label: 'بووکەڵەکاری (نیمچە)', value: 'pp-semi-sock' }, { label: 'پەڕەی لێدوانی بەکارھێنەری بەربەستکراو (نیمچە)', value: 'pp-semi-usertalk' } ] }, { label: 'گۆڕانکارییە ھەڵواسراوەکان', list: [ { label: 'سادە (گھ)', value: 'pp-pc-protected' }, { label: 'خراپکاریی بەردەوام (گھ)', value: 'pp-pc-vandalism' }, { label: 'دەستکاریی تێکدەر (گھ)', value: 'pp-pc-disruptive' }, { label: 'زیادکردنی ناوەڕۆکی بێسەرچاوە (گھ)', value: 'pp-pc-unsourced' }, { label: 'پێشێلکردنی سیاسەتەکانی ژکز (گھ)', value: 'pp-pc-blp' } ] }, { label: 'پاراستنی گواستنەوە', list: [ { label: 'سادە (گواستنەوە)', value: 'pp-move' }, { label: 'شەڕەگواستنەوە (گواستنەوە)', value: 'pp-move-dispute' }, { label: 'خراپکاریی گواستنەوەی پەڕە (گواستنەوە)', value: 'pp-move-vandalism' }, { label: 'پەڕەی زۆر بینراو (گواستنەوە)', value: 'pp-move-indef' } ] } ]; Twinkle.protect.protectionTypesCreate = [ { label: 'لابردنی پاراستن', value: 'unprotect' }, { label: 'دروستکردنی پاراستن', list: [ { label: 'سادە ({{pp-create}})', value: 'pp-create' }, { label: 'ناوی خراپ', value: 'pp-create-offensive' }, { label: 'بەردەوام دروستکردن', selected: true, value: 'pp-create-salt' }, { label: 'ژکزی بەم دواییانە سڕدراوە', value: 'pp-create-blp' } ] } ]; // A page with both regular and PC protection will be assigned its regular // protection weight plus 2 (for PC1) or 7 (for PC2) Twinkle.protect.protectionWeight = { sysop: 40, templateeditor: 30, extendedconfirmed: 20, flaggedrevs_review: 15, // Pending Changes level 2 protection alone autoconfirmed: 10, flaggedrevs_autoconfirmed: 5, // Pending Changes level 1 protection alone all: 0, flaggedrevs_none: 0 // just in case }; // NOTICE: keep this synched with [[MediaWiki:Protect-dropdown]] // Also note: stabilize = Pending Changes level Twinkle.protect.protectionPresetsInfo = { 'pp-protected': { edit: 'sysop', move: 'sysop', reason: null }, 'pp-dispute': { edit: 'sysop', move: 'sysop', reason: '[[وپ:ناکۆکی|شەڕە دەستکاری / ناکۆکیی ناوەڕۆک]]' }, 'pp-vandalism': { edit: 'sysop', move: 'sysop', reason: '[[وپ:خراپکاری|خراپکاریی]] بەردەوام' }, 'pp-usertalk': { edit: 'sysop', move: 'sysop', reason: '[[وپ:پپ#پەڕەی لێدوان|بەکارھێنانی نەشیاوی پەڕەی لێدوان لەکاتی بەربەستبوون]]' }, 'pp-template': { edit: 'templateeditor', move: 'templateeditor', reason: '[[وپ:داڕێژە ھەستیارەکان|داڕێژەی زۆر بینراو]]' }, 'pp-30-500-arb': { edit: 'extendedconfirmed', move: 'extendedconfirmed', reason: '[[وپ:٣٠/٥٠٠|سەپاندنی لیژنەی ناوبژی]]', template: 'pp-30-500' }, 'pp-30-500-vandalism': { edit: 'extendedconfirmed', move: 'extendedconfirmed', reason: 'خراپکاریی بەردەوام لەلایەن ھەژمارە پەسەندکراوە خۆگەڕەکان', template: 'pp-30-500' }, 'pp-30-500-disruptive': { edit: 'extendedconfirmed', move: 'extendedconfirmed', reason: '[[وپ:دەستکاریی تێکدەر|دەستکاریی تێکدەر]]ی بەردەوام ەردەوام لەلایەن ھەژمارە پەسەندکراوە خۆگەڕەکانەوە', template: 'pp-30-500' }, 'pp-30-500-blp': { edit: 'extendedconfirmed', move: 'extendedconfirmed', reason: 'پێشێلکاریی بەردەوامی سیاسەتی [[وپ:ژکز|ژیاننامەی کەسایەتییە زیندووەکان]] لەلایەن بەکارھێنەرە پەسەندکراوە خۆگەڕەکانەوە', template: 'pp-30-500' }, 'pp-30-500-sock': { edit: 'extendedconfirmed', move: 'extendedconfirmed', reason: '[[وپ:بووکەڵەکاری|بووکەڵەکاریی بەردەوام]]', template: 'pp-30-500' }, 'pp-semi-vandalism': { edit: 'autoconfirmed', reason: '[[وپ:خراپکاری|خراپکاریی بەردەوام]]', template: 'pp-vandalism' }, 'pp-semi-disruptive': { edit: 'autoconfirmed', reason: '[[وپ:دەستکاریی تێکدەر|دەستکاریی تێکدەری بەردەوام]]', template: 'pp-protected' }, 'pp-semi-unsourced': { edit: 'autoconfirmed', reason: 'زیادکردنی بەردەوامی دەقی بێسەرچاوە', template: 'pp-protected' }, 'pp-semi-blp': { edit: 'autoconfirmed', reason: 'پێشێلکاری لە سیاسەتی [[وپ:ژکز|ژیاننامەی کەسایەتییە زیندووەکان]]', template: 'pp-blp' }, 'pp-semi-usertalk': { edit: 'autoconfirmed', move: 'autoconfirmed', reason: 'بەکارھێنانی نەشیاوی پەڕەی لێدوان لەکاتی بەربەستبووندا', template: 'pp-usertalk' }, 'pp-semi-template': { // removed for now edit: 'autoconfirmed', move: 'autoconfirmed', reason: '[[en:WP:High-risk templates|داڕێژەی ھەستیار]]', template: 'pp-template' }, 'pp-semi-sock': { edit: 'autoconfirmed', reason: '[[وپ:بووکەڵەکاری|بووکەڵەکاریی بەردەوام]]', template: 'pp-sock' }, 'pp-semi-protected': { edit: 'autoconfirmed', reason: null, template: 'pp-protected' }, 'pp-pc-vandalism': { stabilize: 'autoconfirmed', // stabilize = Pending Changes reason: '[[وپ:خراپکاری|خراپکاریی بەردەوام]]', template: 'pp-pc1' }, 'pp-pc-disruptive': { stabilize: 'autoconfirmed', reason: '[[وپ:دەستکاریی تێکدەر|دەستکاریی تێکدەری بەردەوام]]', template: 'pp-pc1' }, 'pp-pc-unsourced': { stabilize: 'autoconfirmed', reason: 'زیادکردنی بەردەوامی دەقی بێسەرچاوە', template: 'pp-pc1' }, 'pp-pc-blp': { stabilize: 'autoconfirmed', reason: 'پێشێلکاری لە سیاسەتی [[وپ:ژکز|ژیاننامەی کەسایەتییە زیندووەکان]]', template: 'pp-pc1' }, 'pp-pc-protected': { stabilize: 'autoconfirmed', reason: null, template: 'pp-pc1' }, 'pp-move': { move: 'sysop', reason: null }, 'pp-move-dispute': { move: 'sysop', reason: 'شەڕە گواستنەوە' }, 'pp-move-vandalism': { move: 'sysop', reason: 'خراپکاریی گواستنەوەی پەڕە' }, 'pp-move-indef': { move: 'sysop', reason: 'پەڕەی زۆر بینراو' }, 'unprotect': { edit: 'all', move: 'all', stabilize: 'none', create: 'all', reason: null, template: 'none' }, 'pp-create-offensive': { create: 'sysop', reason: 'ناوی خراپ' }, 'pp-create-salt': { create: 'extendedconfirmed', reason: 'دووبارە دروستکردنەوە' }, 'pp-create-blp': { create: 'extendedconfirmed', reason: 'ژکزی بەم دواییانە سڕدراوە' }, 'pp-create': { create: 'extendedconfirmed', reason: '{{pp-create}}' } }; Twinkle.protect.protectionTags = [ { label: 'ھیچ (لابردنی داڕێژەکانی پاراستنی ئێستا)', value: 'none' }, { label: 'ھیچ (داڕێژەکانی پاراستنی ئێستا لامەدە)', value: 'noop' }, { label: 'داڕێژەکانی پاراستن', list: [ { label: '{{pp-vandalism}}: خراپکاری', value: 'pp-vandalism' }, { label: '{{pp-dispute}}: ناکۆکی/شەڕە دەستکاری', value: 'pp-dispute', selected: true }, { label: '{{pp-blp}}: پێشێلکاریی ژکز', value: 'pp-blp' }, { label: '{{pp-sock}}: بووکەڵەکاری', value: 'pp-sock' }, { label: '{{pp-template}}: داڕێژەی ھەستیار', value: 'pp-template' }, { label: '{{pp-usertalk}}: لێدوانی بەکارھێنەری بەربەستکراو', value: 'pp-usertalk' }, { label: '{{pp-protected}}: پاراستنی گشتی', value: 'pp-protected' }, { label: '{{pp-semi-indef}}: پاراستنی گشتیی درێژ', value: 'pp-semi-indef' }, { label: '{{pp-30-500}}: پاراستنی زێدەپارێزراو', value: 'pp-30-500' } ] }, { label: 'داڕێژەکانی وەشانی جێگیر', list: [ { label: '{{pp-pc1}}: ئاستی ١ی وەشانی جێگیر', value: 'pp-pc1' } ] }, { label: 'داڕێژەکانی گواستنەوەی پەڕە', list: [ { label: '{{pp-move-dispute}}: ناکۆکی/شەڕە گواستنەوە', value: 'pp-move-dispute' }, { label: '{{pp-move-vandalism}}: خراپکاریی گواستنەوە', value: 'pp-move-vandalism' }, { label: '{{pp-move-indef}}: گشتیی زۆر', value: 'pp-move-indef' }, { label: '{{pp-move}}: ھی تر', value: 'pp-move' } ] } ]; Twinkle.protect.callback.changePreset = function twinkleprotectCallbackChangePreset(e) { var form = e.target.form; var actiontypes = form.actiontype; var actiontype; for( var i = 0; i < actiontypes.length; i++ ) { if( !actiontypes[i].checked ) { continue; } actiontype = actiontypes[i].values; break; } if (actiontype === 'protect') { // actually protecting the page var item = Twinkle.protect.protectionPresetsInfo[form.category.value]; if (mw.config.get('wgArticleId')) { if (item.edit) { form.editmodify.checked = true; Twinkle.protect.formevents.editmodify({ target: form.editmodify }); form.editlevel.value = item.edit; Twinkle.protect.formevents.editlevel({ target: form.editlevel }); form.editexpiry.value = '2 days'; } else { form.editmodify.checked = false; Twinkle.protect.formevents.editmodify({ target: form.editmodify }); } if (item.move) { form.movemodify.checked = true; Twinkle.protect.formevents.movemodify({ target: form.movemodify }); form.movelevel.value = item.move; Twinkle.protect.formevents.movelevel({ target: form.movelevel }); form.moveexpiry.value = '2 days'; } else { form.movemodify.checked = false; Twinkle.protect.formevents.movemodify({ target: form.movemodify }); } if (item.stabilize) { form.pcmodify.checked = true; Twinkle.protect.formevents.pcmodify({ target: form.pcmodify }); form.pclevel.value = item.stabilize; Twinkle.protect.formevents.pclevel({ target: form.pclevel }); } else { form.pcmodify.checked = false; Twinkle.protect.formevents.pcmodify({ target: form.pcmodify }); } } else { if (item.create) { form.createlevel.value = item.create; Twinkle.protect.formevents.createlevel({ target: form.createlevel }); } } var reasonField = (actiontype === "protect" ? form.protectReason : form.reason); if (item.reason) { reasonField.value = item.reason; } else { reasonField.value = ''; } // sort out tagging options if (mw.config.get('wgArticleId')) { if( form.category.value === 'unprotect' ) { form.tagtype.value = 'none'; } else { form.tagtype.value = (item.template ? item.template : form.category.value); } Twinkle.protect.formevents.tagtype({ target: form.tagtype }); if( /template/.test( form.category.value ) ) { form.noinclude.checked = true; form.editexpiry.value = form.moveexpiry.value = form.pcexpiry.value = "indefinite"; } else if( mw.config.get('wgNamespaceNumber') !== 10 ) { form.noinclude.checked = false; } } } else { // RPP request if( form.category.value === 'unprotect' ) { form.expiry.value = ''; form.expiry.disabled = true; } else { form.expiry.value = ''; form.expiry.disabled = false; } } }; Twinkle.protect.callback.evaluate = function twinkleprotectCallbackEvaluate(e) { var form = e.target; var actiontypes = form.actiontype; var actiontype; for( var i = 0; i < actiontypes.length; i++ ) { if( !actiontypes[i].checked ) { continue; } actiontype = actiontypes[i].values; break; } var tagparams; if( actiontype === 'tag' || (actiontype === 'protect' && mw.config.get('wgArticleId')) ) { tagparams = { tag: form.tagtype.value, reason: ((form.tagtype.value === 'pp-protected' || form.tagtype.value === 'pp-semi-protected' || form.tagtype.value === 'pp-move') && form.protectReason) ? form.protectReason.value : null, expiry: (actiontype === 'protect') ? (form.editmodify.checked ? form.editexpiry.value : (form.movemodify.checked ? form.moveexpiry.value : (form.pcmodify.checked ? form.pcexpiry.value : null) ) ) : null, small: form.small.checked, noinclude: form.noinclude.checked }; } switch (actiontype) { case 'protect': // protect the page Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName'); Morebits.wiki.actionCompleted.notice = "پاراستن سەرکەوتوو بوو"; var statusInited = false; var thispage; var allDone = function twinkleprotectCallbackAllDone() { if (thispage) { thispage.getStatusElement().info("کرا"); } if (tagparams) { Twinkle.protect.callbacks.taggingPageInitial(tagparams); } }; var stabilizeValues = {}; if (form.pclevel) { stabilizeValues = { pclevel: form.pclevel.value, pcexpiry: form.pcexpiry.value, protectReason: form.protectReason.value }; } var protectIt = function twinkleprotectCallbackProtectIt(next) { thispage = new Morebits.wiki.page(mw.config.get('wgPageName'), "پاراستنی پەڕە"); if (mw.config.get('wgArticleId')) { if (form.editmodify.checked) { thispage.setEditProtection(form.editlevel.value, form.editexpiry.value); } if (form.movemodify.checked) { thispage.setMoveProtection(form.movelevel.value, form.moveexpiry.value); } } else { thispage.setCreateProtection(form.createlevel.value, form.createexpiry.value); thispage.setWatchlist(false); } if (form.protectReason.value) { thispage.setEditSummary(form.protectReason.value); } else { alert("دەبێت ھۆکارێکی پاراستن بدەیت بۆ لۆگی پاراستن."); return; } if (!statusInited) { Morebits.simpleWindow.setButtonsEnabled( false ); Morebits.status.init( form ); statusInited = true; } thispage.protect(next); }; var stabilizeIt = function twinkleprotectCallbackStabilizeIt() { if (thispage) { thispage.getStatusElement().info("کرا"); } thispage = new Morebits.wiki.page(mw.config.get('wgPageName'), "پاراستنی وەشانی جێگیر دادەنرێت"); thispage.setFlaggedRevs(stabilizeValues.pclevel, stabilizeValues.pcexpiry); if (stabilizeValues.protectReason) { thispage.setEditSummary(stabilizeValues.protectReason); } else { alert("دەبێت ھۆکارێکی پاراستن بدەیت بۆ لۆگی پاراستن."); return; } if (!statusInited) { Morebits.simpleWindow.setButtonsEnabled(false); Morebits.status.init(form); statusInited = true; } thispage.stabilize(allDone); }; if ((form.editmodify && form.editmodify.checked) || (form.movemodify && form.movemodify.checked) || !mw.config.get('wgArticleId')) { if (form.pcmodify && form.pcmodify.checked) { protectIt(stabilizeIt); } else { protectIt(allDone); } } else if (form.pcmodify && form.pcmodify.checked) { stabilizeIt(); } else { alert("تکایە فرمانێک بدە! \nIf you just want to tag the page, you can choose the 'Tag page with protection template' option at the top."); } break; case 'tag': // apply a protection template Morebits.simpleWindow.setButtonsEnabled( false ); Morebits.status.init( form ); Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName'); Morebits.wiki.actionCompleted.followRedirect = false; Morebits.wiki.actionCompleted.notice = "تاگکردن سەرکەوتوو بوو"; Twinkle.protect.callbacks.taggingPageInitial(tagparams); break; case 'request': // file request at RFPP var typename, typereason; switch( form.category.value ) { case 'pp-dispute': case 'pp-vandalism': case 'pp-usertalk': case 'pp-protected': typename = 'تەواوپارێزراو'; break; case 'pp-template': typename = 'پاراستنی داڕێژە'; break; case 'pp-30-500-arb': case 'pp-30-500-vandalism': case 'pp-30-500-disruptive': case 'pp-30-500-blp': case 'pp-30-500-sock': typename = 'زێدەپەسەندکراو'; break; case 'pp-semi-vandalism': case 'pp-semi-disruptive': case 'pp-semi-unsourced': case 'pp-semi-usertalk': case 'pp-semi-sock': case 'pp-semi-blp': case 'pp-semi-protected': typename = 'نیوەپارێزراو'; break; case 'pp-pc-vandalism': case 'pp-pc-blp': case 'pp-pc-protected': case 'pp-pc-unsourced': case 'pp-pc-disruptive': typename = 'وەشانی جێگیر'; break; case 'pp-move': case 'pp-move-dispute': case 'pp-move-indef': case 'pp-move-vandalism': typename = 'پاراستنی گواستنەوە'; break; case 'pp-create': case 'pp-create-offensive': case 'pp-create-blp': case 'pp-create-salt': typename = 'پاراستنی دروستکردن'; break; case 'unprotect': /* falls through */ default: typename = 'لابردنی پاراستن'; break; } switch (form.category.value) { case 'pp-dispute': typereason = 'ناکۆکیی ناوەڕۆک/شەڕەدەستکاری'; break; case 'pp-vandalism': case 'pp-semi-vandalism': case 'pp-pc-vandalism': case 'pp-30-500-vandalism': typereason = '[[وپ:خراپکاری|خراپکاریی بەردەوام]]'; break; case 'pp-semi-disruptive': case 'pp-pc-disruptive': case 'pp-30-500-disruptive': typereason = '[[وپ:دەستکاریی تێکدەر|دەستکاریی تێکدەری بەردەوام]]'; break; case 'pp-semi-unsourced': case 'pp-pc-unsourced': typereason = 'زیادکردنی بەردەوامی ناوەڕۆکی بێسەرچاوە'; break; case 'pp-template': typereason = '[[:en:WP:HIGHRISK|داڕێژەی ھەستیار]]'; break; case 'pp-30-500-arb': typereason = '[[وپ:٣٠/٥٠٠|سەپاندنی لیژنەی ناوبژی]]'; break; case 'pp-usertalk': case 'pp-semi-usertalk': typereason = 'بەکارھێنانی نادروستی پەڕەی لێدوان لەکاتی بەربەستبوون'; break; case 'pp-semi-sock': case 'pp-30-500-sock': typereason = '[[وپ:بووکەڵەکاری|بووکەڵەکاریی بەردەوام]]'; break; case 'pp-semi-blp': case 'pp-pc-blp': case 'pp-30-500-blp': typereason = 'پێشێلکاریی [[وپ:ژکز]]'; break; case 'pp-move-dispute': typereason = 'ناکۆکی ناوی پەڕە/شەڕەگواستنەوە'; break; case 'pp-move-vandalism': typereason = 'خراپکاریی گواستنەوەی پەڕە'; break; case 'pp-move-indef': typereason = 'پەڕەی زۆر بینراو'; break; case 'pp-create-offensive': typereason = 'ناوی خراپ'; break; case 'pp-create-blp': typereason = 'ژکزی بەم دواییانە سڕدراوە'; break; case 'pp-create-salt': typereason = 'دووبارە دروستکردنەوە'; break; default: typereason = ''; break; } var reason = typereason; if( form.reason.value !== '') { if ( typereason !== '' ) { reason += "\u00A0\u2013 "; // U+00A0 NO-BREAK SPACE; U+2013 EN RULE } reason += form.reason.value; } if( reason !== '' && reason.charAt( reason.length - 1 ) !== '.' ) { reason += '.'; } var rppparams = { reason: reason, typename: typename, category: form.category.value, expiry: form.expiry.value }; Morebits.simpleWindow.setButtonsEnabled( false ); Morebits.status.init( form ); var rppName = 'ویکیپیدیا: داواکردنی پاراستنی پەڕە'; // Updating data for the action completed event Morebits.wiki.actionCompleted.redirect = rppName; Morebits.wiki.actionCompleted.notice = "کاندیدکردن تەواو بوو، ئێستا پەڕەی لێدوان دەکرێتەوە"; var rppPage = new Morebits.wiki.page( rppName, 'پاراستنی پەڕە داوا دەکرێت'); rppPage.setFollowRedirect( true ); rppPage.setCallbackParameters( rppparams ); rppPage.load( Twinkle.protect.callbacks.fileRequest ); break; default: alert("کرداری نەناسراو"); break; } }; Twinkle.protect.callbacks = { taggingPageInitial: function( tagparams ) { if (tagparams.tag === 'noop') { Morebits.status.info("دانانی پاراستن", "ھیچ نییە بۆ کردن"); return; } var protectedPage = new Morebits.wiki.page( mw.config.get('wgPageName'), 'تاگگکردنی پەڕە'); protectedPage.setCallbackParameters( tagparams ); protectedPage.load( Twinkle.protect.callbacks.taggingPage ); }, taggingPage: function( protectedPage ) { var params = protectedPage.getCallbackParameters(); var text = protectedPage.getPageText(); var tag, summary; var oldtag_re = /\s*(?:<noinclude>)?\s*\{\{\s*(pp-[^{}]*?|protected|(?:t|v|s|p-|usertalk-v|usertalk-s|sb|move)protected(?:2)?|protected template|privacy protection)\s*?\}\}\s*(?:<\/noinclude>)?\s*/gi; var re_result = oldtag_re.exec(text); if (re_result) { if (confirm("{{" + re_result[1] + "}} لەسەر پەڕەکە دۆزرایەوە. \nکرتە لەسەر باشە بکە بۆ لابردنی یاخود پاشگەزبوونەوە تاکوو لە شوێنی خۆی بێت.")) { text = text.replace( oldtag_re, '' ); } } if ( params.tag !== 'none' ) { tag = params.tag; if( params.reason ) { tag += '|reason=' + params.reason; } if( ['indefinite', 'infinite', 'never', null].indexOf(params.expiry) === -1 ) { tag += '|expiry={{subst:#time:H:i, j F Y|' + (/^\s*\d+\s*$/.exec(params.expiry) ? params.expiry : '+' + params.expiry) + '}}'; } if( params.small ) { tag += '|small=yes'; } } if( params.tag === 'none' ) { summary = 'لابردنی داڕێژەی پاراستن' + Twinkle.getPref('summaryAd'); } else { if( params.noinclude ) { text = "<noinclude>{{" + tag + "}}</noinclude>" + text; } else if( Morebits.wiki.isPageRedirect() ) { text = text + "\n{{" + tag + "}}"; } else { text = "{{" + tag + "}}\n" + text; } summary = "زیادکردنی {{" + params.tag + "}}" + Twinkle.getPref('summaryAd'); } protectedPage.setEditSummary( summary ); protectedPage.setPageText( text ); protectedPage.setCreateOption( 'nocreate' ); protectedPage.suppressProtectWarning(); // no need to let admins know they are editing through protection protectedPage.save(); }, fileRequest: function( rppPage ) { var params = rppPage.getCallbackParameters(); var text = rppPage.getPageText(); var statusElement = rppPage.getStatusElement(); var rppRe = new RegExp( '===\\s*(\\[\\[)?\s*:?\s*' + RegExp.escape( Morebits.pageNameNorm, true ) + '\s*(\\]\\])?\\s*===', 'm' ); var tag = rppRe.exec( text ); var rppLink = document.createElement('a'); rppLink.setAttribute('href', mw.util.getUrl(rppPage.getPageName()) ); rppLink.appendChild(document.createTextNode(rppPage.getPageName())); if ( tag ) { statusElement.error( [ 'پێش تۆ یەکێک داوای پاراستنی کردووە لە ', rppLink, '. پڕۆسەکە ھەڵوەشایەوە.' ] ); return; } var newtag = '=== [[:' + Morebits.pageNameNorm + ']] ===\n'; if( ( new RegExp( '^' + RegExp.escape( newtag ).replace( /\s+/g, '\\s*' ), 'm' ) ).test( text ) ) { statusElement.error( [ 'پێش تۆ یەکێک داوای پاراستنی کردووە لە ', rppLink, '. پڕۆسەکە ھەڵوەشایەوە.' ] ); return; } newtag += '* {{pagelinks|' + Morebits.pageNameNorm + '}}\n\n'; var words; switch( params.expiry ) { case 'temporary': words = "Temporary "; break; case 'indefinite': words = "Indefinite "; break; default: words = ""; break; } words += params.typename; newtag += "'''" + Morebits.string.toUpperCaseFirstChar(words) + ( params.reason !== '' ? ( ":''' " + Morebits.string.formatReasonText(params.reason) ) : ".'''" ) + " ~~~~"; // If either protection type results in a increased status, then post it under increase // else we post it under decrease var increase = false; var protInfo = Twinkle.protect.protectionPresetsInfo[params.category]; // function to compute protection weights (see comment at Twinkle.protect.protectionWeight) var computeWeight = function(mainLevel, stabilizeLevel) { var result = Twinkle.protect.protectionWeight[mainLevel || 'all']; if (stabilizeLevel) { if (result) { if (stabilizeLevel.level === "autoconfirmed") { result += 2; } else if (stabilizeLevel.level === "review") { result += 7; } } else { result = Twinkle.protect.protectionWeight["flaggedrevs_" + stabilizeLevel]; } } return result; }; // compare the page's current protection weights with the protection we are requesting var editWeight = computeWeight(Twinkle.protect.currentProtectionLevels.edit && Twinkle.protect.currentProtectionLevels.edit.level, Twinkle.protect.currentProtectionLevels.stabilize && Twinkle.protect.currentProtectionLevels.stabilize.level); if (computeWeight(protInfo.edit, protInfo.stabilize) > editWeight || computeWeight(protInfo.move) > computeWeight(Twinkle.protect.currentProtectionLevels.move && Twinkle.protect.currentProtectionLevels.move.level) || computeWeight(protInfo.create) > computeWeight(Twinkle.protect.currentProtectionLevels.create && Twinkle.protect.currentProtectionLevels.create.level)) { increase = true; } var reg; if ( increase ) { reg = /(\n==\s*داواکارداواکارییەکانی زیادکردنی ئاستی پاراستن\s*==)/; } else { reg = /(\n==\s*داواکارداواکارییەکانی کەمکردنەوەی ئاستی پاراستن\s*==)/; } var originalTextLength = text.length; text = text.replace( reg, "\n" + newtag + "\n$1"); if (text.length === originalTextLength) { var linknode = document.createElement('a'); linknode.setAttribute("href", mw.util.getUrl("ویکیپیدیا:توینکڵ\چاککردنی دپپ") ); linknode.appendChild(document.createTextNode('How to fix RPP')); statusElement.error( [ 'نەتواندرا سەرنووسی پەیوەندیدار بدۆزرێتەوە. بۆ چاککردنی ئەمە بنۆڕە ', linknode, '.' ] ); return; } statusElement.status( 'زیادکردنی داواکاریی نوێ...' ); rppPage.setEditSummary( "داواکردنی " + params.typename + (params.typename === "گۆڕانکارییە ھەڵواسراوەکان" ? ' بۆ [[' : ' لە [[') + Morebits.pageNameNorm + ']].' + Twinkle.getPref('summaryAd') ); rppPage.setPageText( text ); rppPage.setCreateOption( 'recreate' ); rppPage.save(); } }; })(jQuery); //

ئێپین وتووێژ ‏١٥:٥٥، ١٢ی ئەیلوولی ٢٠٢٠ (UTC)[وەڵامدانەوە]

@Épine:  کرا. ⇐ئارام وتووێژ💭 ‏١٧:٥٠، ١٢ی ئەیلوولی ٢٠٢٠ (UTC)[وەڵامدانەوە]
@Aram: دەست خۆش برا، بەس ئەکیش بکێشی، ڕیزی ١٤٩٢، سلاشەکەم بە عەکسەوە نووسیوە ئەوە چاک بکە، ١٤٩٣ بکە بە (چۆنییەتی چاککردنی دپپ)؛ ئینجا سەیرێکی تری ڕیزی ١٤٨٠ بۆ ١٤٨٥ بکە، بەو پێیە بێت ئەبێت توینکڵ داواکارییە نوێکان لەژێر ئەو دوو بەشە دابنێ کەچی ڕێک ئەیباتە ژێر داڕێژەی یەکەمەوە کە لە وپ:دپپ داندراوە، بڕوانە مێژووەکەی. ئەکرێ بەدواداچوونێکی بۆ بکەیت بزانیت بۆ؟ ڕەنگە هەڵەیەک لە کۆدەکە هەبێت لە شوێنێکدا. ◂ ئێپین وتووێژ ‏١٨:٠٩، ١٢ی ئەیلوولی ٢٠٢٠ (UTC)[وەڵامدانەوە]
@Épine:  کرا. ھیچ کێشەیەکی تێدا نابینم. کەمێکی تر دووبارەی بکەرەوە و بزانە چۆنە. ⇐ئارام وتووێژ💭 ‏١٨:٢٣، ١٢ی ئەیلوولی ٢٠٢٠ (UTC)[وەڵامدانەوە]
@Aram ئەو کێشەیە هەر هەیە. سەیری مێژووی ویکیپیدیا:داواکردنی پاراستنی پەڕە بکە. ◂ ئێپین وتووێژ ‏١٨:٣١، ١٢ی ئەیلوولی ٢٠٢٠ (UTC)[وەڵامدانەوە]
دەشێ لەبەر نوێکردنەوەکان بێت کە ماوەیە پێش ئێستا دەستم بە نوێکردنەوەی پەڕەکان کرد، بەڵام ھەندێکیان ماون. بڕوانە ویکیپیدیا:توینکڵ/ئامراز. ⇐ئارام وتووێژ💭 ‏١٩:٢١، ١٢ی ئەیلوولی ٢٠٢٠ (UTC)[وەڵامدانەوە]