跳转到内容

User:Tohd8BohaithuGh1/twinklewarn.js

维基百科,自由的百科全书
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
// If TwinkleConfig aint exist.
if( typeof( TwinkleConfig ) == 'undefined' ) {
	TwinkleConfig = {};
}

/**
 TwinkleConfig.defaultGroup (int)
 if true, watch the page which has been dispatched an warning or notice, if false, default applies
 */
if( typeof( TwinkleConfig.defaultWarningGroup ) == 'undefined' ) {
	TwinkleConfig.defaultWarningGroup = 1;
}

/**
 TwinkleConfig.showSharedIPNotice may take arguments:
 true: to show shared ip notice if an IP address
 false: to not print the notice
 */
if( typeof( TwinkleConfig.showSharedIPNotice ) == 'undefined' ) {
	TwinkleConfig.showSharedIPNotice = true;
}

/**
 TwinkleConfig.watchWarnings (boolean)
 if true, watch the page which has been dispatched an warning or notice, if false, default applies
 */
if( typeof( TwinkleConfig.watchWarnings ) == 'undefined' ) {
	TwinkleConfig.watchWarnings = false;
}

/**
 TwinkleConfig.blankTalkpageOnIndefBlock (boolean)
 if true, blank the talk page when issuing an indef block notice (per [[WP:UW#Indefinitely blocked users]])
 */
if( typeof( TwinkleConfig.blankTalkpageOnIndefBlock ) == 'undefined' ) {
	TwinkleConfig.blankTalkpageOnIndefBlock = false;
}

/**
 TwinkleConfig.summaryAd (string)
 If ad should be added or not to summary, default [[WP:TWINKLE|TWINKLE]]
 */
if( typeof( TwinkleConfig.summaryAd ) == 'undefined' ) {
	TwinkleConfig.summaryAd = " 利用[[Wikipedia:Twinkle|TW]]";
}

function twinklewarn() {
	if( mw.config.get( 'wgNamespaceNumber' ) === 3 ) {
		mw.util.addPortletLink( 'p-cactions', (twinkleConfigExists ? "javascript:twinklewarn.callback()" : 'javascript:alert("Your account is too new to use Twinkle.");'), "警告", "tw-warn", "Warn/Notify user", "");
	}
}
$(twinklewarn);

twinklewarn.callback = function twinklewarnCallback() {
	var Window = new SimpleWindow( 600, 400 );
	Window.setTitle( "警告/通知用户" ); 
	var form = new QuickForm( twinklewarn.callback.evaluate );

	var main_select = form.append( {
			type:'field',
			label:'请选择一种警告/通知您想发表', 
			tooltip:'请选择一种警告/通知,然后在选择对的版本.'
		} );

	var main_group = main_select.append( {
			type:'select',
			name:'main_group',
			event:twinklewarn.callback.change_category 
		} );

	main_group.append( { type:'option', label:'通知 (1)', value:'level1', selected: ( TwinkleConfig.defaultWarningGroup == 1 || TwinkleConfig.defaultWarningGroup < 1 || ( userIsInGroup( 'sysop' ) ? TwinkleConfig.defaultWarningGroup > 8 : TwinkleConfig.defaultWarningGroup > 7 ) ) } );
	main_group.append( { type:'option', label:'小心 (2)', value:'level2', selected: ( TwinkleConfig.defaultWarningGroup == 2 ) } );
	main_group.append( { type:'option', label:'警告 (3)', value:'level3', selected: ( TwinkleConfig.defaultWarningGroup == 3 ) } );
	main_group.append( { type:'option', label:'最后一次的警告 (4)', value:'level4', selected: ( TwinkleConfig.defaultWarningGroup == 4 ) } );
	main_group.append( { type:'option', label:'唯一的警告 (4im)', value:'level4im', selected: ( TwinkleConfig.defaultWarningGroup == 5 ) } );
	main_group.append( { type:'option', label:'一次性通知', value:'singlenotice', selected: ( TwinkleConfig.defaultWarningGroup == 6 ) } );
	main_group.append( { type:'option', label:'一次性警告', value:'singlewarn', selected: ( TwinkleConfig.defaultWarningGroup == 7 ) } );
	if( userIsInGroup( 'sysop' ) ) {
		main_group.append( { type:'option', label:'封禁', value:'block', selected: ( TwinkleConfig.defaultWarningGroup == 8 ) } );
	}

	main_select.append( { type:'select', name:'sub_group', event:twinklewarn.callback.change_subcategory } ); //Will be empty to begin with.

	form.append( { 
			type:'input',
			name:'article',
			label:'连接条目',
			value:( QueryString.exists( 'vanarticle' ) ? QueryString.get( 'vanarticle' ) : '' ),
			tooltip:'一个链接的条目'
		} );


	var more = form.append( { type:'field', label:'請於此留下額外理由,然後再點\"发送\"' } );
	more.append( { type:'textarea', label:'More:', name:'reason', tooltip:'一個額外的理由或者更詳細的通知。' } );
	more.append( { type:'submit', label:'发送' } );
	var result = form.render();
	Window.setContent( result );
	Window.display();
	result.main_group.root = result;

	// We must init the first choice (General Note);
	var evt = document.createEvent( "Event" );
	evt.initEvent( 'change', true, true );
	result.main_group.dispatchEvent( evt );

}

// This is all the messages that might be dispatched by the code
twinklewarn.messages = {
	level1: {
		"uw-vandalism1": { 
			label:"破坏", 
			summary:"通知: 破坏" 
		},
		"uw-test1": { 
			label:"编辑测试", 
			summary:"通知: 编辑测试" 
		},
		"uw-delete1": { 
			label:"无理由删除信息", 
			summary:"通知: 无理由删除信息" 
		},
		"uw-redirect1": { 
			label:"创造以破坏用的重定向", 
			summary:"通知: 创造以破坏用的重定向" 
		},
		"uw-tdel1": { 
			label:"无理由删除模板", 
			summary:"通知: 无理由删除模板" 
		},
		"uw-joke1": { 
			label:"使用不利的幽默", 
			summary:"通知: 使用不利的幽默" 
		},
		"uw-create1": { 
			label:"创造不利的页面", 
			summary:"通知: 创造不利的页面" 
		},
		"uw-upload1": { 
			label:"上传不利的图画", 
			summary:"通知: 上传不利的图画" 
		},
		"uw-image1": { 
			label:"图画破坏", 
			summary:"通知: 图画破坏" 
		},
		"uw-spam1": { 
			label:"增加广告到其他网站", 
			summary:"通知: 增加广告到其他网站" 
		},
		"uw-advert1": { 
			label:"利用维基百科促销", 
			summary:"通知: 利用维基百科促销" 
		},
		"uw-npov1": { 
			label:"不尊重中立的观点", 
			summary:"通知: 不尊重中立的观点" 
		},
		"uw-unsourced1": { 
			label:"增加无来源的信息", 
			summary:"通知: 增加无来源的信息" 
		},
		"uw-error1": { 
			label:"故意增加错误的信息", 
			summary:"通知: 故意增加错误的信息" 
		},
		"uw-nor1": { 
			label:"增加原创研究", 
			summary:"通知: 增加原创研究" 
		},
		"uw-biog1": { 
			label:"在生者传记增加无来源的信息", 
			summary:"通知: 在生者传记增加无来源的信息" 
		},
		"uw-defam1": { 
			label:"故意创造攻击", 
			summary:"通知: 故意创造攻击" 
		},
		"uw-uncen1": { 
			label:"增加过滤内容", 
			summary:"通知: 增加过滤内容" 
		},
		"uw-mos1": { 
			label:"格式手册", 
			summary:"通知: 格式手册" 
		},
		"uw-move1": { 
			label:"移动页面", 
			summary:"通知: 移动页面" 
		},
		"uw-chat1": { 
			label:"利用讨论页面作为论坛", 
			summary:"通知: 利用讨论页面作为论坛" 
		},
		"uw-tpv1": { 
			label:"改变其他维基百科人的评论", 
			summary:"通知: 改变其他维基百科人的评论" 
		},
		"uw-afd1": { 
			label:"故意删除\{\{afd\}\}模板", 
			summary:"通知: 故意删除\{\{afd\}\}模板" 
		},
		"uw-speedy1": { 
			label:"故意删除\{\{delete\}\}模板", 
			summary:"通知: 故意删除\{\{delete\}\}模板" 
		},
		"uw-npa1": { 
			label:"创造人身攻击", 
			summary:"通知: 创造人身攻击" 
		},
		"uw-agf1": { 
			label:"没有善意推定", 
			summary:"通知: 没有善意推定" 
		},
		"uw-own1": { 
			label:"拥有条目", 
			summary:"通知: 拥有条目"
		}
	},
	level2: {
		"uw-vandalism2": { 
			label:"破坏", 
			summary:"注意: 破坏" 
		},
		"uw-test2": { 
			label:"编辑测试", 
			summary:"注意: 编辑测试" 
		},
		"uw-delete2": { 
			label:"无理由删除信息", 
			summary:"注意: 无理由删除信息" 
		},
		"uw-redirect2": { 
			label:"创造以破坏用的重定向", 
			summary:"注意: 创造以破坏用的重定向" 
		},
		"uw-tdel2": { 
			label:"无理由删除模板", 
			summary:"注意: 无理由删除模板" 
		},
		"uw-joke2": { 
			label:"使用不利的幽默", 
			summary:"注意: 使用不利的幽默" 
		},
		"uw-create2": { 
			label:"创造不利的页面", 
			summary:"注意: 创造不利的页面" 
		},
		"uw-upload2": { 
			label:"上传不利的图画", 
			summary:"注意: 上传不利的图画" 
		},
		"uw-image2": { 
			label:"图画破坏", 
			summary:"注意: 图画破坏" 
		},
		"uw-spam2": { 
			label:"增加广告到其他网站", 
			summary:"注意: 增加广告到其他网站" 
		},
		"uw-advert2": { 
			label:"利用维基百科促销", 
			summary:"注意: 利用维基百科促销" 
		},
		"uw-npov2": { 
			label:"不尊重中立的观点", 
			summary:"注意: 不尊重中立的观点" 
		},
		"uw-unsourced2": { 
			label:"增加无来源的信息", 
			summary:"注意: 增加无来源的信息" 
		},
		"uw-error2": { 
			label:"故意增加错误的信息", 
			summary:"注意: 故意增加错误的信息" 
		},
		"uw-nor2": { 
			label:"增加原创研究", 
			summary:"注意: 增加原创研究"
		},
		"uw-biog2": { 
			label:"在生者传记增加无来源的信息", 
			summary:"注意: 在生者传记增加无来源的信息" 
		},
		"uw-defam2": { 
			label:"故意创造攻击", 
			summary:"注意: 故意创造攻击" 
		},
		"uw-uncen2": { 
			label:"增加过滤内容", 
			summary:"注意: 增加过滤内容" 
		},
		"uw-mos2": { 
			label:"格式手册", 
			summary:"注意: 格式手册" 
		},
		"uw-move2": { 
			label:"移动页面", 
			summary:"注意: 移动页面" 
		},
		"uw-chat2": { 
			label:"利用讨论页面作为论坛", 
			summary:"注意: 利用讨论页面作为论坛" 
		},
		"uw-tpv2": { 
			label:"改变其他维基百科人的评论", 
			summary:"注意: 改变其他维基百科人的评论" 
		},
		"uw-afd2": { 
			label:"故意删除\{\{afd\}\}模板", 
			summary:"注意: 故意删除\{\{afd\}\}模板" 
		},
		"uw-speedy2": { 
			label:"故意删除\{\{delete\}\}模板", 
			summary:"注意: 故意删除\{\{delete\}\}模板" 
		},
		"uw-npa2": { 
			label:"创造人身攻击", 
			summary:"注意: 创造人身攻击" 
		},
		"uw-agf2": { 
			label:"没有善意推定", 
			summary:"注意: 没有善意推定" 
		},
		"uw-own2": { 
			label:"拥有条目", 
			summary:"注意: 拥有条目"
		}
	},
	level3: {
		"uw-vandalism3": { 
			label:"破坏", 
			summary:"警告: 破坏" 
		},
		"uw-test3": { 
			label:"编辑测试", 
			summary:"警告: 编辑测试" 
		},
		"uw-delete3": { 
			label:"无理由删除信息", 
			summary:"警告: 无理由删除信息" 
		},
		"uw-redirect3": { 
			label:"创造以破坏用的重定向", 
			summary:"警告: 创造以破坏用的重定向" 
		},
		"uw-tdel3": { 
			label:"无理由删除模板", 
			summary:"警告: 无理由删除模板" 
		},
		"uw-joke3": { 
			label:"使用不利的幽默", 
			summary:"警告: 使用不利的幽默" 
		},
		"uw-create3": { 
			label:"创造不利的页面", 
			summary:"警告: 创造不利的页面" 
		},
		"uw-upload3": { 
			label:"上传不利的图画", 
			summary:"警告: 上传不利的图画" 
		},
		"uw-image3": { 
			label:"图画破坏", 
			summary:"警告: 图画破坏" 
		},
		"uw-spam3": { 
			label:"增加广告到其他网站", 
			summary:"警告: 增加广告到其他网站" 
		},
		"uw-advert3": { 
			label:"利用维基百科促销", 
			summary:"警告: 利用维基百科促销" 
		},
		"uw-npov3": { 
			label:"不尊重中立的观点", 
			summary:"警告: 不尊重中立的观点" 
		},
		"uw-unsourced3": { 
			label:"增加无来源的信息", 
			summary:"警告: 增加无来源的信息" 
		},
		"uw-error3": { 
			label:"增加无来源的信息", 
			summary:"警告: 增加无来源的信息" 
		},
		"uw-nor3": { 
			label:"增加原创研究", 
			summary:"警告: 增加原创研究"
		},
		"uw-biog3": { 
			label:"在生者传记增加无来源的信息", 
			summary:"警告: 在生者传记增加无来源的信息" 
		},
		"uw-defam3": { 
			label:"故意创造攻击", 
			summary:"警告: 故意创造攻击" 
		},
		"uw-uncen3": { 
			label:"增加过滤内容", 
			summary:"警告: 增加过滤内容" 
		},
		"uw-mos3": { 
			label:"Manual of style", 
			summary:"警告: Formatting, date, language, etc (Manual of style)" 
		},
		"uw-move3": { 
			label:"Page moves", 
			summary:"警告: Page moves" 
		},
		"uw-chat3": { 
			label:"Using talk page as forum", 
			summary:"警告: Using talk page as forum" 
		},
		"uw-tpv3": { 
			label:"Refactoring others' talk page comments", 
			summary:"警告: Refactoring others' talk page comments" 
		},
		"uw-afd3": { 
			label:"Removing \{\{afd\}\} templates", 
			summary:"警告: Removing \{\{afd\}\} templates" 
		},
		"uw-speedy3": { 
			label:"Removing \{\{speedy deletion\}\} templates", 
			summary:"警告: Removing \{\{speedy deletion\}\} templates" 
		},
		"uw-npa3": { 
			label:"Personal attack directed at a specific editor", 
			summary:"警告: Personal attack directed at a specific editor" 
		},
		"uw-agf3": { 
			label:"Not assuming good faith", 
			summary:"警告: Not assuming good faith" 
		},
		"uw-own3": { 
			label:"Ownership of articles", 
			summary:"警告: Ownership of articles"
		}
	},
	level4: {
		"uw-vandalism4": { 
			label:"破坏", 
			summary:"最后一次的警告: 破坏" 
		},
		"uw-test4": { 
			label:"编辑测试", 
			summary:"最后一次的警告: 编辑测试" 
		},
		"uw-delete4": { 
			label:"无理由删除信息", 
			summary:"最后一次的警告: 无理由删除信息" 
		},
		"uw-redirect4": { 
			label:"创造以破坏用的重定向", 
			summary:"最后一次的警告: 创造以破坏用的重定向" 
		},
		"uw-tdel4": { 
			label:"Removal of maintenance templates", 
			summary:"最后一次的警告: Removal of maintenance templates" 
		},
		"uw-joke4": { 
			label:"使用不利的幽默", 
			summary:"最后一次的警告: 使用不利的幽默" 
		},
		"uw-create4": { 
			label:"创造不利的页面", 
			summary:"最后一次的警告: 创造不利的页面" 
		},
		"uw-upload4": { 
			label:"上传不利的图画", 
			summary:"最后一次的警告: 上传不利的图画" 
		},
		"uw-image4": { 
			label:"图画破坏", 
			summary:"最后一次的警告: 图画破坏" 
		},
		"uw-spam4": { 
			label:"Adding spam links", 
			summary:"最后一次的警告: Adding spam links" 
		},
		"uw-advert4": { 
			label:"Using Wikipedia for advertising or promotion", 
			summary:"最后一次的警告: Using Wikipedia for advertising or promotion" 
		},
		"uw-npov4": { 
			label:"Not adhering to neutral point of view", 
			summary:"最后一次的警告: Not adhering to neutral point of view" 
		},
		"uw-unsourced4": { 
			label:"Addition of unsourced material without proper citations", 
			summary:"最后一次的警告: Addition of unsourced material without proper citations" 
		},
		"uw-error4": { 
			label:"Introducing deliberate factual errors", 
			summary:"最后一次的警告: Introducing deliberate factual errors"
		},
		"uw-nor4": { 
			label:"Adding original research, including unpublished syntheses of sourced material", 
			summary:"最后一次的警告: Adding original research, including unpublished syntheses of sourced material"
		},
		"uw-biog4": { 
			label:"Adding unreferenced controversial information about living persons", 
			summary:"最后一次的警告: Adding unreferenced controversial information about living persons" 
		},
		"uw-defam4": { 
			label:"Defamation not specifically directed", 
			summary:"最后一次的警告: Defamation not specifically directed" 
		},
		"uw-uncen4": { 
			label:"Censorship of material", 
			summary:"最后一次的警告: Censorship of material" 
		},
		"uw-move4": { 
			label:"Page moves", 
			summary:"最后一次的警告: Page moves" 
		},
		"uw-chat4": { 
			label:"Using talk page as forum", 
			summary:"最后一次的警告: Using talk page as forum" 
		},
		"uw-afd4": { 
			label:"Removing \{\{afd\}\} templates", 
			summary:"最后一次的警告: Removing \{\{afd\}\} templates" 
		},
		"uw-speedy4": { 
			label:"Removing \{\{speedy deletion\}\} templates", 
			summary:"最后一次的警告: Removing \{\{speedy deletion\}\} templates" 
		},
		"uw-npa4": { 
			label:"Personal attack directed at a specific editor", 
			summary:"最后一次的警告: Personal attack directed at a specific editor"
		}
	},
	level4im: {
		"uw-vandalism4im": { 
			label:"破坏", 
			summary:"唯一的警告: 破坏" 
		},
		"uw-delete4im": { 
			label:"无理由删除信息", 
			summary:"唯一的警告: 无理由删除信息" 
		},
		"uw-redirect4im": { 
			label:"创造以破坏用的重定向", 
			summary:"唯一的警告: 创造以破坏用的重定向" 
		},
		"uw-joke4im": { 
			label:"使用不利的幽默", 
			summary:"唯一的警告: 使用不利的幽默" 
		},
		"uw-create4im": { 
			label:"创造不利的页面", 
			summary:"唯一的警告: 创造不利的页面" 
		},
		"uw-upload4im": { 
			label:"上传不利的图画", 
			summary:"唯一的警告: 上传不利的图画" 
		},
		"uw-image4im": { 
			label:"图画破坏", 
			summary:"唯一的警告: 图画破坏" 
		},
		"uw-spam4im": { 
			label:"Adding spam links", 
			summary:"唯一的警告: Adding spam links" 
		},
		"uw-biog4im": { 
			label:"Adding unreferenced controversial information about living persons", 
			summary:"唯一的警告: Adding unreferenced controversial information about living persons" 
		},
		"uw-defam4im": { 
			label:"Defamation not specifically directed", 
			summary:"唯一的警告: Defamation not specifically directed" 
		},
		"uw-move4im": { 
			label:"Page moves", 
			summary:"唯一的警告: Page moves" 
		},
		"uw-npa4im": { 
			label:"Personal attack directed at a specific editor", 
			summary:"唯一的警告: Personal attack directed at a specific editor"
		}
	},
	singlenotice: {
		"uw-2redirect": { 
			label:"Creating double redirects through bad page moves", 
			summary:"通知: Creating double redirects through bad page moves" 
		},
		"uw-aiv": { 
			label:"Bad AIV report", 
			summary:"通知: Bad AIV report" 
		},
		"uw-articlesig": { 
			label:"Adding signatures to article space", 
			summary:"通知: Adding signatures to article space" 
		},
		"uw-autobiography": { 
			label:"Creating autobiographies", 
			summary:"通知: Creating autobiographies" 
		},
		"uw-badcat": { 
			label:"Adding incorrect categories", 
			summary:"通知: Adding incorrect categories" 
		},
		"uw-bite": { 
			label:"\"Biting\" newcomers", 
			summary:"通知: \"Biting\" newcomers" 
		},
		"uw-c&pmove": { 
			label:"Cut and paste moves", 
			summary:"通知: Cut and paste moves" 
		},
		"uw-coi": { 
			label:"Conflict of Interest", 
			summary:"通知: Conflict of Interest" 
		},
		"uw-date": { 
			label:"Unnecessarily changing date formats", 
			summary:"通知: Unnecessarily changing date formats" 
		},
		"uw-deadlink": { 
			label:"Removing proper sources containing dead links", 
			summary:"通知: Removing proper sources containing dead links" 
		},
		"uw-editsummary": { 
			label:"Not using edit summary", 
			summary:"通知: Not using edit summary" 
		},
		"uw-english": { 
			label:"Not communicating in English", 
			summary:"通知: Not communicating in English" 
		},
		"uw-hangon": { 
			label:"User forgets to place a hang-on reasoning to the talk page", 
			summary:"通知: User forgets to place a hang-on reasoning to the talk page" 
		},
		"uw-italicize": { 
			label:"Italicize books, films, albums, magazines, TV series, etc within articles", 
			summary:"通知: Italicize books, films, albums, magazines, TV series, etc within articles" 
		},
		"uw-lang": { 
			label:"Unnecessarily changing between British and American English", 
			summary:"通知: Unnecessarily changing between British and American English" 
		},
		"uw-linking": { 
			label:"For excessive addition of redlinks or repeated blue links", 
			summary:"通知: For excessive addition of redlinks or repeated blue links" 
		},
		"uw-minor": { 
			label:"Incorrect use of minor edits check box", 
			summary:"通知: Incorrect use of minor edits check box" 
		},
		"uw-nonfree": { 
			label:"Uploading replaceable non-free images", 
			summary:"通知: Uploading replaceable non-free images" 
		},
		"uw-notaiv": { 
			label:"Do not report complex abuse to AIV", 
			summary:"通知: Do not report complex abuse to AIV" 
		},
		"uw-notvote": { 
			label:"We use consensus, not voting", 
			summary:"通知: We use consensus, not voting" 
		},
		"uw-patrolled": { 
			label:"Mark newpages as patrolled when patrolling", 
			summary:"通知: Mark newpages as patrolled when patrolling" 
		},
		"uw-preview": { 
			label:"Use preview button to avoid mistakes", 
			summary:"通知: Use preview button to avoid mistakes" 
		},
		"uw-probation": { 
			label:"Article is on probation", 
			summary:"通知: Article is on probation" 
		},
		"uw-repost": { 
			label:"Recreating previously deleted material", 
			summary:"通知: Recreating previously deleted material" 
		},
		"uw-samename": { 
			label:"Rename request impossible", 
			summary:"通知: Rename request impossible"
		},
		"uw-sandbox": { 
			label:"Removal of the Sandbox header", 
			summary:"通知: Removal of the Sandbox header" 
		},
		"uw-selfrevert": { 
			label:"Reverting self tests", 
			summary:"通知: Reverting self tests" 
		},
		"uw-socialnetwork": { 
			label:"Wikipedia is not a social network", 
			summary:"通知: Wikipedia is not a social network" 
		},
		"uw-spellcheck": { 
			label:"Review spelling, etc.", 
			summary:"通知: Review spelling, etc." 
		},
		"uw-subst": { 
			label:"Remember to subst: templates", 
			summary:"通知: Remember to subst: templates" 
		},
		"uw-talkinarticle": { 
			label:"Talk in article", 
			summary:"通知: Talk in article" 
		},
		"uw-tilde": { 
			label:"Not signing posts", 
			summary:"通知: Not signing posts" 
		},
		"uw-uaa": { 
			label:"Reporting of username to WP:UAA not accepted", 
			summary:"通知: Reporting of username to WP:UAA not accepted" 
		},
		"uw-warn": { 
			label:"Warning vandals", 
			summary:"通知: Warning vandals"
		}
	},
	singlewarn: {
		"uw-3rr": { 
			label:"Potentially violating the three revert rule", 
			summary:"警告: Potentially violating the three revert rule" 
		},
		"uw-bv": { 
			label:"Blatant vandalism", 
			summary:"警告: Blatant vandalism" 
		},
		"uw-canvass": { 
			label:"Canvassing", 
			summary:"警告: Canvassing" 
		},
		"uw-copyright": { 
			label:"Copyright violation", 
			summary:"警告: Copyright violation" 
		},
		"uw-copyright-link": { 
			label:"Linking to copyrighted works violation", 
			summary:"警告: Linking to copyrighted works violation" 
		},
		"uw-hoax": { 
			label:"Creating hoaxes", 
			summary:"警告: Creating hoaxes" 
		},
		"uw-legal": { 
			label:"Making legal threats", 
			summary:"警告: Making legal threats" 
		},
		"uw-longterm": { 
			label:"Long term pattern of vandalism", 
			summary:"警告: Long term pattern of vandalism" 
		},
		"uw-multipleIPs": { 
			label:"Usage of multiple IPs", 
			summary:"警告: Usage of multiple IPs" 
		},
		"uw-pinfo": { 
			label:"Personal info", 
			summary:"警告: Personal info" 
		},
		"uw-upv": { 
			label:"Userpage vandalism", 
			summary:"警告: Userpage vandalism"
		},
		"uw-tempabuse": { 
			label:"Improper use of warning or blocking template", 
			summary:"警告: Improper use of warning or blocking template"
		},
		"uw-wrongsummary": { 
			label:"Using inaccurate or inappropriate edit summaries", 
			summary:"警告: Using inaccurate or inappropriate edit summaries"
		},
		"uw-username": { 
			label:"Username is against policy", 
			summary:"警告: Username is against policy"
		},
		"uw-userpage": { 
			label:"Userpage or subpage is against policy", 
			summary:"警告: Userpage or subpage is against policy"
		}
	},
	block: {
		"uw-block1": {
			'label':"Block level 1 (first time)",
			'summary':"You have been temporarily blocked"
		},
		"uw-block2": {
			'label':"Block level 2 (subsequent times)",
			'summary':"You have been blocked"
		},
		"uw-block3": {
			'label':"Block level 3 (indefinite)",
			'summary':"You have been indefinitely blocked"
		},
		"uw-ablock": {
			'label':"Anonymous block",
			'summary':"Your IP address has been blocked"
		},
		"uw-adblock": {
			'label':"Advertising block",
			'summary':"You have been blocked for advertising"
		},
		"uw-sblock": {
			'label':"Spam block",
			'summary':"You have been blocked for spamming"
		},
		"uw-spamublock": {
			'label':"Spam and username violation block",
			'summary':"You have been blocked for spamming and a [[WP:U|username policy]] violation"
		},
		"uw-soablock": {
			'label':"Spam/advertising-only account",
			'summary':"You have been blocked for using a spam/advertising-only account"
		},
		"uw-vblock": {
			'label':"Vandalism",
			'summary':"You have been blocked for vandalism"
		},
		"uw-vaublock": {
			'label':"Vandalism-only account and blatant username violation",
			'summary':"You have been blocked for using a vandalism-only account and a blatant [[WP:U|username policy]] violation"
		},
		"uw-voablock": {
			'label':"Vandalism-only account",
			'summary':"You have been blocked for using a vandalism-only account"
		},
		"uw-npblock": {
			'label':"Creating nonsense pages block",
			'summary':"You have been blocked for creating nonsense pages"
		},
		"uw-dblock": {
			'label':"Delete block",
			'summary':"You have been blocked for continued deletion of material"
		},
		"uw-3block": {
			'label':"3RR block",
			'summary':"You have been blocked for violation of the [[WP:3RR|3RR]] rule"
		},
		"uw-ewblock": {
			'label':"Edit warring block",
			'summary':"You have been blocked for [[WP:EW|edit warring]]"
		},
		"uw-ublock": {
			'label':"Username block",
			'summary':"You have been blocked for a violation of the [[WP:U|username policy]]"
		},
		"uw-uhblock": {
			'label':"Username hard block",
			'summary':"You have been blocked for a blatant violation of the [[WP:U|username policy]]"
		},
		"uw-lblock": {
			'label':"Legal threat block",
			'summary':"You have been blocked for [[WP:LEGAL|making legal threats]]"
		},
		"uw-hblock": {
			'label':"Harassment block",
			'summary':"You have been blocked for attempting to [[WP:HARASS|harass]] other users"
		},
		"uw-botblock": {
			'label':"Unapproved bot scripts block",
			'summary':"You have been blocked for running unapproved [[WP:BOT|bot]] scripts"
		}
	}
};


twinklewarn.callback.change_category = function twinklewarnCallbackChangeCategory(e) {
	var value = e.target.value;
	var sub_group = e.target.root.sub_group;
	var messages = twinklewarn.messages[ value ];
	sub_group.main_group = value;
	var old_subvalue = sub_group.value;
	if( old_subvalue ) {
		old_subvalue = old_subvalue.replace(/\d*(im)?$/, '' );
		var old_subvalue_re = new RegExp( RegExp.escape( old_subvalue ) + "(\\d*(?:im)?)$" );
	}

	while( sub_group.hasChildNodes() ){
		sub_group.removeChild( sub_group.firstChild );
	}

	for( var i in messages ) {
		var selected = false;
		if( old_subvalue && old_subvalue_re.test( i ) ) {
			selected = true;
		}
		var elem = new QuickForm.element( { type:'option', label:"[" + i + "]: " + messages[i].label, value:i, selected: selected } );
		
		sub_group.appendChild( elem.render() );
	}

	if( value == 'block' ) {
		var more = new QuickForm.element( {
				type: 'input',
				name: 'block_timer',
				label: 'Period of blocking: ',
				tooltip: 'The period the blocking is due for, for example 24 hours, 2 weeks, indefinite etc...'
			} );
		e.target.root.insertBefore( more.render(), e.target.root.lastChild );
		e.target.root.article.disabled = true;
	} else if( e.target.root.block_timer ) {
		e.target.root.removeChild( e.target.root.block_timer.parentNode );
		e.target.root.article.disabled = false;
	}
}

twinklewarn.callback.change_subcategory = function twinklewarnCallbackChangeSubcategory(e) {
	var value = e.target.value;
	var main_group = e.target.main_group;

	if( main_group == 'block' && ( value == 'uw-3block' || value == 'uw-ewblock' ) ) {
		e.target.form.article.disabled = false;
	} else if( main_group == 'block' && !e.target.form.article.disabled ) {
		e.target.form.article.disabled = true;
	}
}

twinklewarn.callbacks = {
	main: function( self ) {
		var form = self.responseXML.getElementById( 'editform' );
		var text = form.wpTextbox1.value;

		var history_re = /\<\!\-\-\ Template\:(uw\-.*?)\ \-\-\>.*?(\d{1,2}:\d{1,2}, \d{1,2} \w+ \d{4}) \(UTC\)/g;
		var history = {};
		var latest = { date:new Date( 0 ), type:'' };

		var current;


		while( ( current = history_re.exec( text ) ) != undefined ) {
			var current_date = new Date( current[2] + ' UTC' );
			if( !( current[1] in history ) ||  history[ current[1] ] < current_date ) {
				history[ current[1] ] = current_date;
			}
			if( current_date > latest.date ) {
				latest.date = current_date;
				latest.type = current[1];
			}
		}

		var date = new Date();

		if( self.params.sub_group in history ) {
			var temp_time = new Date( history[ self.params.sub_group ] );
			temp_time.setUTCHours( temp_time.getUTCHours() + 24 );

			if( temp_time > date ) {
				Status.info( 'Info', "an identical " + self.params.sub_group + " has been issued in the last 24 hours" );
				if( !confirm( "Will you still add a warning/notice?" ) ) {
					self.statelem.info( 'aborted per user request' );
					return;
				}
			}
		}

		latest.date.setUTCMinutes( latest.date.getUTCMinutes() + 1 ); // after long debate, one minute is max

		if( latest.date > date ) {
			Status.info('Info', "a " + latest.type + " has been issued in the last minute" );
				if( !confirm( "Will you still add a warning/notice?" ) ) {
					self.statelem.info( 'aborted per user request' );
					return;
				}
		}
		


		var mainheaderRe = /==+\\s*Warnings\\s*==+/;
		var headerRe = new RegExp( "^==+\\s*(?:" + date.getUTCMonthName() + '|' + date.getUTCMonthNameAbbrev() +  ")\\s+" + date.getUTCFullYear() + "\\s*==+", 'm' );

		if( text.length > 0 ) {
			text += "\n";
		}

		if( !headerRe.exec( text ) ) {
			Status.info( 'Info', 'Will create a new level 2 heading for the date, as none was found for this month' );
			text += "== " + date.getUTCMonthName() + " " + date.getUTCFullYear() + " ==\n";
		}
		if( self.params.main_group == 'block' ) {
			var article = '', time = null;
			
			if( TwinkleConfig.blankTalkpageOnIndefBlock && ( /indef|\*|max/.exec( self.params.block_timer ) || self.params.sub_group == 'uw-block3' || self.params.sub_group == 'uw-spamublock' || self.params.sub_group == 'uw-soablock' || self.params.sub_group == 'uw-vaublock' || self.params.sub_group == 'uw-voablock' || self.params.sub_group == 'uw-ublock' || self.params.sub_group == 'uw-uhblock' || self.params.sub_group == 'uw-lblock' ) ) {
				Status.info( 'Info', 'Blanking talk page per preferences and createing a new level 2 heading for the date' );
				text = "== " + date.getUTCMonthName() + " " + date.getUTCFullYear() + " ==\n";
			}
			
			if( ( self.params.sub_group == 'uw-3block' || self.params.sub_group == 'uw-ewblock' ) && self.params.article ) {
				article = '|1=' + self.params.article;
			}
			
			if( /te?mp|^\s*$|min/.exec( self.params.block_timer ) ) {
				time = '';
			} else if( /indef|\*|max/.exec( self.params.block_timer ) ) {
				time = '|indef=yes';
			} else {
				time = '|time=' + self.params.block_timer;
			}

			text += "\{\{subst:" + self.params.sub_group + article + time + (self.params.reason ? '|reason=' + self.params.reason : '' ) + "|sig=true\}\}";
		} else if( self.params.sub_group == 'uw-username' ) {
			// ugly hack
			text += "\{\{subst:" + self.params.sub_group + ( self.params.reason ? '|1=' + self.params.reason : '' ) + "\}\} \~\~\~\~";
		} else {
			text += "\{\{subst:" + self.params.sub_group + ( self.params.article ? '|1=' + self.params.article : '' ) + "\}\}" + (self.params.reason ? " ''" + self.params.reason + "'' ": ' ' ) + "\~\~\~\~";
		}

		if ( TwinkleConfig.showSharedIPNotice && isIPAddress( mw.config.get( 'wgTitle' ) ) ) {
			Status.info( 'Info', 'Adding a shared ip notice' );
			switch( QueryString.get( 'type' ) ) {
			case 'vand':
				text +=  "\n:''If this is a shared [[IP address]], and you didn't make any [[Wikipedia:vandalism|unconstructive]] edits, consider [[Wikipedia:Why create an account?|creating an account]] for yourself so you can avoid further irrelevant warnings.'' ";
				break;
			default:
				text +=  "\n:''If this is a shared [[IP address]], and you didn't make the edit, consider [[Wikipedia:Why create an account?|creating an account]] for yourself so you can avoid further irrelevant notices.'' ";
				break;
			}
		}
		var postData = {
			'wpMinoredit': form.wpMinoredit.checked ? 1 : undefined,
			'wpWatchthis': (form.wpWatchthis.checked || TwinkleConfig.watchWarnings) ? 1 : undefined,
			'wpStarttime': form.wpStarttime.value,
			'wpEdittime': form.wpEdittime.value,
			'wpAutoSummary': form.wpAutoSummary.value,
			'wpEditToken': form.wpEditToken.value,
			'wpSection': '',
			'wpSummary': twinklewarn.messages[self.params.main_group][self.params.sub_group].summary + ( self.params.article ? ' 在 [[' + self.params.article + ']]'  : '' ) + '.' + TwinkleConfig.summaryAd,
			'wpTextbox1': text
		};

		self.post( postData );
	}
}

twinklewarn.callback.evaluate = function twinklewarnCallbackEvaluate(e) {

	// First, grab all the values provided by the form
	
	var params = {
		reason: e.target.reason.value,
		main_group: e.target.main_group.value,
		sub_group: e.target.sub_group.value,
		article: e.target.article.value.replace( /^(Image|Category):/i, ':$1:' ),
		block_timer: e.target.block_timer ? e.target.block_timer.value : null
	}

	Status.init( e.target );

	var query = { 
		'title': mw.config.get( 'wgPageName' ), 
		'action': 'submit'
	};
	Wikipedia.actionCompleted.redirect = mw.config.get( 'wgPageName' );
	Wikipedia.actionCompleted.notice = "Warning complete, reloading talk page in some seconds";
	var wikipedia_wiki = new Wikipedia.wiki( 'User talk page modification', query, twinklewarn.callbacks.main );
	wikipedia_wiki.params = params;
	wikipedia_wiki.get();
}