User:Le Concorde/TwinkleIssues.js

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
//<nowiki>
//Version: v2.0-453-gdef530e-u10
//Original: 201207232029
//Module: xfd/copyvio/warn/tag
(function()
{
	//Refreshing article page instead of redirecting to AFD log
	function Xfd()
	{
		if(typeof(Twinkle.xfd.callback.evaluate) != 'undefined')
		{
			Twinkle.xfd.callback.evaluate = function(e) {
				mw.config.set('wgPageName', mw.config.get('wgPageName').replace(/_/g, ' '));
				var type =  e.target.category.value;
				var usertalk = e.target.notify.checked;
				var reason = e.target.xfdreason.value;
				var xfdcat, mergeinto, noinclude;
				if( type === 'afd' ) {
					xfdcat = e.target.xfdcat.value;
					if( xfdcat === 'merge' ) {
						mergeinto = e.target.mergeinto.value;
					}
				}
				Morebits.simpleWindow.setButtonsEnabled( false );
				Morebits.status.init( e.target );
				Twinkle.xfd.currentRationale = reason;
				Morebits.status.onError(Twinkle.xfd.printRationale);
				if( !type ) {
					Morebits.status.error( '错误', '未定义的动作' );
					return;
				}
				var query, wikipedia_page, wikipedia_api, logpage, params;
				var date = new Date();
				function twodigits(num) {
					return num < 10 ? '0' + num : num;
				};
				switch( type ) {
				case 'afd':
					var dateString = date.getUTCFullYear() + '/' + twodigits(date.getUTCMonth() + 1) + '/' + twodigits(date.getUTCDate());
					logpage = 'Wikipedia:頁面存廢討論/記錄/' + dateString;
					params = { usertalk: usertalk, xfdcat: xfdcat, mergeinto: mergeinto, noinclude: noinclude, reason: reason, logpage: logpage };

					Morebits.wiki.addCheckpoint();
					// Updating data for the action completed event
					Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
					Morebits.wiki.actionCompleted.notice = "提名完成,页面将在几秒后刷新";

					// Tagging file
					wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "添加存废讨论模板到页面");
					wikipedia_page.setFollowRedirect(false);
					wikipedia_page.setCallbackParameters(params);
					wikipedia_page.load(Twinkle.xfd.callbacks.afd.taggingArticle);

					// Contributor specific edits
					wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'));
					wikipedia_page.setCallbackParameters(params);
					wikipedia_page.lookupCreator(Twinkle.xfd.callbacks.afd.main);

					Morebits.wiki.removeCheckpoint();
					break;
				case 'ffd':
					var dateString = date.getUTCFullYear() + '/' + twodigits(date.getUTCMonth() + 1) + '/' + twodigits(date.getUTCDate());
					logpage = 'Wikipedia:檔案存廢討論/記錄/' + dateString;
					params = { usertalk: usertalk, reason: reason, logpage: logpage };

					Morebits.wiki.addCheckpoint();
					// Updating data for the action completed event
					Morebits.wiki.actionCompleted.redirect = mw.config.get('wgPageName');
					Morebits.wiki.actionCompleted.notice = "提名完成,页面将在几秒后刷新";

					// Tagging file
					wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'), "添加存废讨论模板到文件描述页");
					wikipedia_page.setFollowRedirect(false);
					wikipedia_page.setCallbackParameters(params);
					wikipedia_page.load(Twinkle.xfd.callbacks.ffd.taggingImage);

					// Contributor specific edits
					wikipedia_page = new Morebits.wiki.page(mw.config.get('wgPageName'));
					wikipedia_page.setCallbackParameters(params);
					wikipedia_page.lookupCreator(Twinkle.xfd.callbacks.ffd.main);

					Morebits.wiki.removeCheckpoint();
					break;
				default:
					alert("twinklexfd:未定义的类别");
					break;
				}
			};
		}
		else setTimeout(Xfd, 100);
	}

	//Automatically add a new section for a new day.
	//Stop processing when {{Copyvio}} is detected.
	function Copyvio()
	{
		if(typeof(Twinkle.copyvio.callbacks) != 'undefined' && typeof(Twinkle.copyvio.callback.evaluate) != 'undefined' && typeof(Twinkle.speedy.callbacks.user) != 'undefined')
		{
			Twinkle.copyvio.callbacks.taggingArticle = function(pageobj) {
				var params = pageobj.getCallbackParameters();
				if(/(?:\{\{\s*(copyvio|侵权|PD-CAGov)(?:\s*\||\s*\}\}))/i.exec(pageobj.getPageText()))
				{
					pageobj.getStatusElement().error('侵权模板已被置于页面中');
					return;
				}
				var tag = "{{subst:Copyvio/auto|url=" + params.source.replace(/http/g, '&#104;ttp').replace(/\n+/g, '\n').replace(/^\s*([^\*])/gm, '* $1').replace(/^\* $/m, '') + "}}";
				if ( /\/temp$/i.test( mw.config.get('wgPageName') ) ) {
					tag = "{{D|G16}}\n" + tag;
				}
				pageobj.setPageText(tag);
				pageobj.setEditSummary("本页面疑似侵犯版权" + Twinkle.getPref('summaryAd'));
				switch (Twinkle.getPref('copyvioWatchPage')) {
					case 'yes':
						pageobj.setWatchlist(true);
						break;
					case 'no':
						pageobj.setWatchlistFromPreferences(false);
						break;
					default:
						pageobj.setWatchlistFromPreferences(true);
						break;
				}
				pageobj.save();
				if( Twinkle.getPref('markCopyvioPagesAsPatrolled') ) {
					pageobj.patrol();
				}
			};
			Twinkle.copyvio.callbacks.copyvioList = function(pageobj) {
				var text = pageobj.getPageText();
				var params = pageobj.getCallbackParameters();
				var append = "\n{{subst:CopyvioVFDRecord|" + mw.config.get('wgPageName') + "}}";
				var date = new Date();
				var headerRe = new RegExp("^==+\\s*" + (date.getUTCMonth() + 1) + "\\s*月\\s*" + date.getUTCDate() + "\\s*日\\s*==+", "m");
				if (!headerRe.exec(text)) {
					append = "\n\n=== " + (date.getUTCMonth() + 1) + "月" + date.getUTCDate() + "日 ===" + append;
				}
				pageobj.setAppendText(append);
				pageobj.setEditSummary("添加[[" + mw.config.get('wgPageName') + "]]。" + Twinkle.getPref('summaryAd'));
				pageobj.setCreateOption('recreate');
				pageobj.append();
			};
		}
		else setTimeout(Copyvio, 100);
	}

	//Add {{Notability Unreferenced}} To tagging list
	//Remove the second wikify
	//COI is not supported by {{multiple issues}}
	function Tag()
	{
		if(typeof(Twinkle.tag.article.tags) != 'undefined' && typeof(Twinkle.tag.article.tagCategories) != 'undefined' && typeof(Twinkle.tag.groupHash) != 'undefined')
		{
			Twinkle.tag.article.tags = {
				"advert": "类似广告",
				"autobiography": "类似一篇自传,或内容主要由条目描述的当事人或组织撰写、编辑",
				"blpdispute": "可能违反了维基百科关于生者传记的方针",
				"blpsources": "传记需要补充更多来源",
				"blpunsourced": "传记没有列出任何参考或来源",
				"catimprove": "需要更多页面分类",
				"citation style": "参考文献需要进行清理,以符合正确的引用、脚注或外部链接格式",
				"citecheck": "可能包含不适用或被曲解的引用资料,部分内容的准确性无法被证实",
				"cleanup": "可能需要进行清理,以符合维基百科的质量标准",
				"cleanup-jargon": "包含过多行话或专业术语,可能需要简化或提出进一步解释",
				"coi": "主要贡献者与本条目所宣扬的内容可能存在利益冲突",
				"contradict": "内容自相矛盾",
				"copyedit": "需要编修,以确保文法、用词、语气、格式、标点等使用恰当",
				"disputed": "内容疑欠准确,有待查证",
				"expand": "需要扩充",
				"expert": "需要精通或熟悉本主题的专家参与编辑",
				"external links": "使用外部链接的方式可能不符合维基百科的方针或指引",
				"fansite": "类似爱好者站点",
				"globalize": "仅具有一部分地区的信息或观点,无法做到普世通用和完整表达包含广泛区域的信息、观点",
				"hoax": "真实性被质疑",
				"howto": "包含指南或教学内容",
				"in-universe": "使用小说故事内的观点描述一个虚构事物",
				"inappropriate person": "使用不适当的第一人称和第二人称",
				"inappropriate tone": "语调或风格可能不适合百科全书的写作方式",
				"lead section": "导言部分也许不足以概括其内容",
				"lead section too long": "导言部分也许过于冗长",
				"merge": "建议此页面与页面合并",
				"merge from": "建议将页面合并到本页面",
				"merge to": "建议将此页面合并至页面",
				"newsrelease": "阅读起来像是新闻稿,或包含过度的宣传性语调",
				"no footnotes": "由于缺少内文脚注,部分信息的来源仍然不明确",
				"non-free": "可能过多或不当地使用了受版权保护的文字、图像或/及多媒体文件",
				"notability": "可能不符合通用关注度指引,或下列标准:传记、虚构事物、发明研究或网站",
				"Notability Unreferenced": "此条目也许具备关注度,但需要可靠的来源来加以彰显",
				"notmandarin": "包含过多不是现代标准汉语的内容",
				"onesource": "极大或完全地依赖于某个单一的来源",
				"original research": "可能包含原创研究或未查证内容",
				"orphan": "没有或只有很少链入页面",
				"overlinked": "可能含有太多的内部链接",
				"pov": "中立性有争议。内容、语调可能带有明显的个人观点或地方色彩",
				"primarysources": "需要可靠、公开、第三方的来源",
				"prose": "使用了列表式记述,可能需要改写为连贯的叙述性文字",
				"refimprove": "需要补充更多来源",
				"review": "阅读起来类似评论,需要清理",
				"rewrite": "不符合维基百科的质量标准,需要完全重写",
				"roughtranslation": "翻译品质不佳",
				"substub": "过于短小",
				"trivia": "应避免有陈列杂项、琐碎资料的部分",
				"uncategorized": "缺少页面分类",
				"unencyclopedic": "可能不适合写入百科全书",
				"unreferenced": "没有列出任何参考或来源",
				"update": "需要更新",
				"verylong": "可能过于冗长",
				"weasel": "可能因为语意模棱两可而损及其中立性或准确性",
				"wikify": "需要被修正为维基格式以符合质量标准"
			};
			Twinkle.tag.article.tagCategories = {
				"清理和维护模板": {
					"常规清理": [
						"cleanup",
						"cleanup-jargon",
						"copyedit",
						"wikify"
					],
					"可能多余的内容": [
						"external links",
						"non-free"
					],
					"结构和导言": [
						"lead section",
						"lead section too long",
						"verylong"
					],
					"小说相关清理": [
						"in-universe"
					]
				},
				"常规条目问题": {
					"重要性和知名度": [
						"notability",
						"Notability Unreferenced"
					],
					"写作风格": [
						"advert",
						"fansite",
						"howto",
						"inappropriate person",
						"inappropriate tone",
						"newsrelease",
						"prose",
						"review"
					],
					"内容": [
						"expand",
						"substub",
						"unencyclopedic"
					],
					"信息和细节": [
						"expert",
						"trivia"
					],
					"时间性": [
						"update"
					],
					"中立、偏见和事实准确性": [
						"autobiography",
						"coi",
						"contradict",
						"disputed",
						"globalize",
						"hoax",
						"pov",
						"weasel"
					],
					"可供查证和来源": [
						"blpdispute",
						"blpsources",
						"blpunsourced",
						"citecheck",
						"no footnotes",
						"onesource",
						"original research",
						"primarysources",
						"refimprove",
						"unreferenced"
					]
				},
				"具体内容问题": {
					"语言": [
						"notmandarin",
						"roughtranslation"
					],
					"链接": [
						"orphan",
						"overlinked"
					],
					"参考技术": [
						"citation style"
					],
					"分类": [
						"catimprove",
						"uncategorized"
					]
				},
				"合并": [
					"merge",
					"merge from",
					"merge to"
				],
				"信息": [
					"inuse"
				]
			};
			Twinkle.tag.multipleIssuesExceptions = [
				'catimprove',
				'coi',
				'merge',
				'merge from',
				'merge to',
				'notmandarin',
				'roughtranslation',
				"substub",
				'uncategorized',
				'update'
			];
		}
		else setTimeout(Tag, 100);
	}

	//Add {{User:Le Concorde/CVOtherWiki}} To notify list
	function Warn()
	{
		if(typeof(Twinkle.warn.callback) != 'undefined' && typeof(Twinkle.warn.messages.level4im) != 'undefined' && typeof(Twinkle.warn.messages.singlenotice) != 'undefined')
		{
			Twinkle.warn.messages.singlenotice = {
				"uw-2redirect": {
					label:"透过不适当的页面移动建立双重重定向",
					summary:"单层级通知:透过不适当的页面移动建立双重重定向"
				},
				"uw-aiv": {
					label:"不恰当的破坏回报",
					summary:"单层级通知:不恰当的破坏回报"
				},
				"uw-articlesig": {
					label:"在条目页中签名",
					summary:"单层级通知:在条目页中签名"
				},
				"uw-autobiography": {
					label:"建立自传",
					summary:"单层级通知:建立自传"
				},
				"uw-badcat": {
					label:"加入错误的页面分类",
					summary:"单层级通知:加入错误的页面分类"
				},
				"uw-bite": {
					label:"伤害新手",
					summary:"单层级通知:伤害新手"
				},
				"uw-booktitle": {
					label:"没有使用书名号来标示书籍、电影、音乐专辑等",
					summary:"单层级通知:没有使用书名号来标示书籍、电影、音乐专辑等"
				},
				"uw-c&pmove": {
					label:"剪贴移动",
					summary:"单层级通知:剪贴移动"
				},
				"uw-chinese": {
					label:"不是以中文进行沟通",
					summary:"单层级通知:不是以中文进行沟通"
				},
				"uw-coi": {
					label:"利益冲突",
					summary:"单层级通知:利益冲突"
				},
				"uw-copyright-friendly": {
					label:"初次加入侵犯版权的内容",
					summary:"单层级通知:初次加入侵犯版权的内容"
				},
				"uw-copyviorewrite": {
					label:"在侵权页面直接重写条目",
					summary:"单层级通知:在侵权页面直接重写条目"
				},
				"uw-date": {
					label:"不必要地更换日期格式",
					summary:"单层级通知:不必要地更换日期格式"
				},
				"uw-editsummary": {
					label:"没有使用编辑摘要",
					summary:"单层级通知:没有使用编辑摘要"
				},
				"uw-hangon": {
					label:"没有在讨论页说明暂缓快速删除理由",
					summary:"单层级通知:没有在讨论页说明暂缓快速删除理由"
				},
				"uw-lang": {
					label:"不必要地将条目所有文字换成简体或繁体中文",
					summary:"单层级通知:不必要地将条目所有文字换成简体或繁体中文"
				},
				"uw-langmove": {
					label:"不必要地将条目标题换成简体或繁体中文",
					summary:"单层级通知:不必要地将条目标题换成简体或繁体中文"
				},
				"uw-linking": {
					label:"过度加入红字连结或重复蓝字连结",
					summary:"单层级通知:过度加入红字连结或重复蓝字连结"
				},
				"uw-minor": {
					label:"不适当地使用小修改选项",
					summary:"单层级通知:不适当地使用小修改选项"
				},
				"uw-notaiv": {
					label:"不要向当前的破坏回报复杂的用户纷争",
					summary:"单层级通知:不要向当前的破坏回报复杂的用户纷争"
				},
				"uw-notvote": {
					label:"我们是以共识处事,不仅是投票",
					summary:"单层级通知:我们是以共识处事,不仅是投票"
				},
				"uw-preview": {
					label:"使用预览按钮来避免不必要的错误",
					summary:"单层级通知:使用预览按钮来避免不必要的错误"
				},
				"uw-sandbox": {
					label:"移除沙盒的置顶模板{{sandbox}}",
					summary:"单层级通知:移除沙盒的置顶模板{{sandbox}}"
				},
				"uw-selfrevert": {
					label:"回退个人的测试",
					summary:"单层级通知:回退个人的测试"
				},
				"uw-subst": {
					label:"谨记要替代模板",
					summary:"单层级通知:谨记要替代模板"
				},
				"uw-talkinarticle": {
					label:"在条目页中留下意见",
					summary:"单层级通知:在条目页中留下意见"
				},
				"uw-tilde": {
					label:"没有在讨论页上签名",
					summary:"单层级通知:没有在讨论页上签名"
				},
				"uw-uaa": {
					label:"向更改用户名回报的用户名称并不违反方针",
					summary:"单层级通知:向更改用户名回报的用户名称并不违反方针"
				},
				"uw-warn": {
					label:"警告破坏用户",
					summary:"单层级通知:警告破坏用户"
				},
				"User:Le Concorde/CVOtherWiki": {
					label:"初次加入其他网络百科全书的内容",
					summary:"单层级通知:初次加入其他网络百科全书的内容"
				}
			};
		}
		else setTimeout(Warn, 100);
	}

	Xfd();
	Copyvio();
	Tag();
	Warn();
})();
//</nowiki>