「MediaWiki:Gadget-twinkleprotect.js」:修訂間差異

跳至導覽 跳至搜尋
繁簡轉換
(已匯入 1 筆修訂:Twinkle)
(繁簡轉換)
 
}
 
Twinkle.addPortletLink(Twinkle.protect.callback, Morebits.userIsInGroup('sysop') ? "保" : "保", "tw-rpp",
Morebits.userIsInGroup('sysop') ? "保护页護頁面" : "求保护页護頁面" );
};
 
 
var Window = new Morebits.simpleWindow( 620, 530 );
Window.setTitle( Morebits.userIsInGroup( 'sysop' ) ? "施行或求保护页護頁面" : "求保护页護頁面" );
Window.setScriptName( "Twinkle" );
Window.addFooterLink( "保模板", "Template:Protection templates" );
Window.addFooterLink( "保", "WP:PROT" );
Window.addFooterLink( "Twinkle助", "WP:TW/DOC#protect" );
 
var form = new Morebits.quickForm( Twinkle.protect.callback.evaluate );
var actionfield = form.append( {
type: 'field',
label: '操作型'
} );
if( Morebits.userIsInGroup( 'sysop' ) ) {
list: [
{
label: '保护页護頁面',
value: 'protect',
checked: true
list: [
{
label: '求保护页護頁面',
value: 'request',
tooltip: '如果您想在WP:RFPP求保' + (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' });
result.push(boldnode);
if (expiry === 'infinity') {
result.push("(限期)");
} else {
result.push("(期:" + new Date(expiry).toUTCString() + ")");
}
if (cascade) {
result.push("(联锁聯鎖)");
}
}
if (!result.length) {
var boldnode = document.createElement('b');
boldnode.textContent = "";
result.push(boldnode);
}
Twinkle.protect.protectionLevel = result;
Morebits.status.init($('div[name="currentprot"] span').last()[0]);
Morebits.status.info("前保", Twinkle.protect.protectionLevel);
}
 
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') ?
});
 
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
// for existing pages
list: [
{
label: '修改编辑权編輯權限',
value: 'editmodify',
tooltip: '如果此关闭關閉编辑权編輯權不被修改。',
checked: true
}
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: 'sysop',
selected: true
type: 'select',
name: 'editexpiry',
label: '时间時間:',
event: function(e) {
if (e.target.value === 'custom') {
},
list: [
{ label: '1小', value: '1 hour' },
{ label: '2小', value: '2 hours' },
{ label: '3小', value: '3 hours' },
{ label: '6小', value: '6 hours' },
{ label: '1日', value: '1 day' },
{ label: '3日', value: '3 days' },
{ label: '6月', value: '6 months' },
{ label: '1年', value: '1 year' },
{ label: '限期', value: 'indefinite' },
{ label: '自定…', value: 'custom' }
]
});
list: [
{
label: '修改移动权動權限',
value: 'movemodify',
tooltip: '如果此关闭關閉,移动权動權不被修改。',
checked: true
}
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: 'sysop',
selected: true
type: 'select',
name: 'moveexpiry',
label: '时间時間:',
event: function(e) {
if (e.target.value === 'custom') {
},
list: [
{ label: '1小', value: '1 hour' },
{ label: '2小', value: '2 hours' },
{ label: '3小', value: '3 hours' },
{ label: '6小', value: '6 hours' },
{ label: '1日', value: '1 day' },
{ label: '3日', value: '3 days' },
{ label: '6月', value: '6 months' },
{ label: '1年', value: '1 year' },
{ label: '限期', value: 'indefinite' },
{ label: '自定…', value: 'custom' }
]
});
type: 'select',
name: 'createlevel',
label: '限:',
event: Twinkle.protect.formevents.createlevel
});
createlevel.append({
type: 'option',
label: '禁止未注册註冊',
value: 'autoconfirmed'
});
createlevel.append({
type: 'option',
label: '管理',
value: 'sysop',
selected: true
type: 'select',
name: 'createexpiry',
label: '时间時間:',
event: function(e) {
if (e.target.value === 'custom') {
},
list: [
{ label: '1小', value: '1 hour' },
{ label: '2小', value: '2 hours' },
{ label: '3小', value: '3 hours' },
{ label: '6小', value: '6 hours' },
{ label: '1日', value: '1 day' },
{ label: '3日', value: '3 days' },
{ label: '6月', value: '6 months' },
{ label: '1年', selected: true, value: '1 year' },
{ label: '限期', value: 'indefinite' },
{ label: '自定…', value: 'custom' }
]
});
type: 'textarea',
name: 'protectReason',
label: '理由(保):'
});
if (!mw.config.get('wgArticleId')) { // tagging isn't relevant for non-existing pages
/* falls through */
case 'tag':
field1 = new Morebits.quickForm.element({ type: 'field', label: '标记选项標記選項', name: 'field1' });
field1.append( {
type: 'select',
name: 'tagtype',
label: '选择選擇模板:',
list: Twinkle.protect.protectionTags,
event: Twinkle.protect.formevents.tagtype
{
name: 'small',
label: '使用图标圖標(small=yes)',
tooltip: '将给將給模板加上|small=yes参数參數示成右上角的一把挂锁掛鎖。'
},
{
name: 'noinclude',
label: '用<noinclude>包裹保模板',
tooltip: '模板包裹在&lt;noinclude&gt;中',
checked: (mw.config.get('wgNamespaceNumber') === 10)
}
 
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: 'select',
name: 'expiry',
label: '时长時長:',
list: [
{ label: '临时臨時', value: 'temporary' },
{ label: '永久', value: 'indefinite' },
{ label: '', selected: true, value: '' }
break;
default:
alert("玩意儿坏兒壞掉了!");
break;
}
if (Twinkle.protect.protectionLevel) {
Morebits.status.init($('div[name="currentprot"] span').last()[0]);
Morebits.status.info("前保", Twinkle.protect.protectionLevel);
}
 
 
Twinkle.protect.doCustomExpiry = function twinkleprotectDoCustomExpiry(target) {
var custom = prompt('入自定义终義終时间時間。\n您可以使用相对时间對時間,如“1「1 minute”minute」“19「19 days”,days」,绝对时间“yyyymmddhhmm”(絕對時間「yyyymmddhhmm」(“200602011405”「200602011405」是2006年02月01日14:05(UTC))', '');
if (custom) {
var option = document.createElement('option');
 
Twinkle.protect.protectionTypes = [
{ label: '解除保', value: 'unprotect' },
{
label: '全保',
list: [
{ label: '常(全)', value: 'pp-protected' },
{ label: '争议爭議编辑战編輯戰(全)', value: 'pp-dispute' },
{ label: '期破(全)', value: 'pp-vandalism' },
{ label: '高风险風險模板(全)', value: 'pp-template' },
{ label: '已封禁用讨论页討論頁(全)', value: 'pp-usertalk' }
]
},
{
label: '半保',
list: [
{ label: '常(半)', value: 'pp-semi-protected' },
{ label: '期破(半)', value: 'pp-semi-vandalism' },
{ label: '反生者传记傳記(半)', value: 'pp-semi-blp' },
{ label: '傀儡破(半)', value: 'pp-semi-sock' },
{ label: '高风险風險模板(半)', value: 'pp-semi-template' },
{ label: '已封禁用讨论页討論頁(半)', value: 'pp-semi-usertalk' }
]
},
{
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: '常', value: 'pp-create' }
]
}
edit: 'sysop',
move: 'sysop',
reason: '编辑战編輯戰'
},
'pp-vandalism': {
edit: 'sysop',
move: 'sysop',
reason: '被自动确认動確認'
},
'pp-template': {
edit: 'sysop',
move: 'sysop',
reason: '高风险風險模板'
},
'pp-usertalk': {
edit: 'sysop',
move: 'sysop',
reason: '已封禁用户滥戶濫用其对话页對話頁'
},
'pp-semi-vandalism': {
edit: 'autoconfirmed',
reason: '被IP用或新用',
template: 'pp-vandalism'
},
'pp-semi-blp': {
edit: 'autoconfirmed',
reason: 'IP用或新用户违戶違反生者传记傳記'
},
'pp-semi-usertalk': {
edit: 'autoconfirmed',
move: 'sysop',
reason: '已封禁用户滥戶濫用其对话页對話頁'
},
'pp-semi-template': { // removed for now
edit: 'autoconfirmed',
move: 'sysop',
reason: '高风险風險模板',
template: 'pp-template'
},
'pp-semi-sock': {
edit: 'autoconfirmed',
reason: '持的傀儡破'
},
'pp-semi-protected': {
'pp-move-dispute': {
move: 'sysop',
reason: '面移动战動戰'
},
'pp-move-vandalism': {
move: 'sysop',
reason: '移'
},
'pp-move-indef': {
move: 'sysop',
reason: '高风险页風險頁面'
},
'unprotect': {
Twinkle.protect.protectionTags = [
{
label: '(移除有模板)',
value: 'none'
},
{
label: '(不移除有模板)',
value: 'noop'
},
{
label: '全保模板',
list: [
{ label: '{{pp-dispute}}: 争议爭議', value: 'pp-dispute', selected: true },
{ label: '{{pp-usertalk}}: 封禁的用', value: 'pp-usertalk' }
]
},
{
label: '全、半保模板',
list: [
{ label: '{{pp-vandalism}}: 破', value: 'pp-vandalism' },
{ label: '{{pp-template}}: 高风险風險模板', value: 'pp-template' },
{ label: '{{pp-protected}}: 常', value: 'pp-protected' }
]
},
{
label: '半保模板',
list: [
{ label: '{{pp-semi-usertalk}}: 封禁的用', value: 'pp-semi-usertalk' },
{ label: '{{pp-semi-sock}}: 傀儡', value: 'pp-semi-sock' },
{ label: '{{pp-semi-blp}}: 生者传记傳記', value: 'pp-semi-blp' },
{ label: '{{pp-semi-indef}}: 期', value: 'pp-semi-indef' }
]
},
{
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' }
]
}
 
Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.wiki.actionCompleted.notice = "保完成";
 
var statusInited = false;
 
var protectIt = function twinkleprotectCallbackProtectIt(next) {
thispage = new Morebits.wiki.page(mw.config.get('wgPageName'), "保护页護頁面");
if (mw.config.get('wgArticleId')) {
if (form.editmodify.checked) {
thispage.setEditSummary(form.protectReason.value + Twinkle.getPref('protectionSummaryAd'));
} else {
alert("您必须输須輸入保理由,这将這將记录記錄在保中。");
return;
}
protectIt(allDone);
} else {
alert("Twinkle要做什!\n如果您只是想标记该页標記該頁请选择請選擇上面的用保模板标记標記页”选项頁」選項。");
}
 
Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
Morebits.wiki.actionCompleted.followRedirect = false;
Morebits.wiki.actionCompleted.notice = "标记標記完成";
 
Twinkle.protect.callbacks.taggingPageInitial(tagparams);
case 'pp-usertalk':
case 'pp-protected':
typename = '全保';
break;
case 'pp-semi-vandalism':
case 'pp-semi-blp':
case 'pp-semi-protected':
typename = '半保';
break;
case 'pp-move':
case 'pp-move-indef':
case 'pp-move-vandalism':
typename = '移';
break;
case 'pp-create':
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':
typereason = '期破';
break;
case 'pp-template':
case 'pp-semi-template': // removed for now
typereason = '高风险風險模板';
break;
case 'pp-usertalk':
case 'pp-semi-usertalk':
typereason = '已封禁用讨论页討論頁';
break;
case 'pp-semi-sock':
typereason = '傀儡破';
break;
case 'pp-semi-blp':
typereason = '反生者传记傳記';
break;
case 'pp-move-dispute':
typereason = '争议爭議、移动战動戰';
break;
case 'pp-move-vandalism':
typereason = '移';
break;
case 'pp-move-indef':
typereason = '高风险页風險頁面';
break;
default:
Morebits.status.init( form );
 
var rppName = 'Wikipedia:求保护页護頁面';
 
// 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 );
break;
default:
alert("twinkleprotect: 未知操作型");
break;
}
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 );
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' ) {
summary = '移除保模板' + Twinkle.getPref('summaryAd');
} else {
if( params.noinclude ) {
 
if ( tag ) {
statusElement.error( [ '已有目的保提名,在 ', rppLink, ',取消操作。' ] );
return;
}
var newtag = '=== [[:' + mw.config.get('wgPageName') + ']] ===' + "\n";
if( ( new RegExp( '^' + RegExp.escape( newtag ).replace( /\s+/g, '\\s*' ), 'm' ) ).test( text ) ) {
statusElement.error( [ '已有目的保提名,在 ', rppLink, ',取消操作。' ] );
return;
}
switch( params.expiry ) {
case 'temporary':
words = "临时臨時";
break;
case 'indefinite':
words += params.typename;
 
newtag += "求" + Morebits.string.toUpperCaseFirstChar(words) + ( params.reason !== '' ? ":" +
Morebits.string.formatReasonText(params.reason) : "。" ) + "--~~~~";
 
 
if ( params.category === 'unprotect' ) {
reg = /(==\s*求解除保\s*==\n)/;
} else {
reg = /({{\/header}}\n)/;
{
var linknode = document.createElement('a');
linknode.setAttribute("href", mw.util.getUrl("Wikipedia:Twinkle/修RFPP") );
linknode.appendChild(document.createTextNode('如何修RFPP'));
statusElement.error( [ '法在WP:RFPP上找到相点标记點標記,要修问题問題请参见請參見', linknode, '。' ] );
return;
}
statusElement.status( '添加新提名…' );
rppPage.setEditSummary( '[[' + Morebits.pageNameNorm + ']]' + params.typename + Twinkle.getPref('summaryAd') );
rppPage.setPageText( text );
rppPage.setCreateOption( 'recreate' );
1,975

次編輯

導覽選單