User:YFdyh000/DisamAssist.js

维基百科,自由的百科全书

注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google ChromeFirefoxMicrosoft EdgeSafari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。

//<source lang="javascript">

//DisamAssist
//由[[User:Qwertyytrewqqwerty]]最初設計:[[es:Usuario:Qwertyytrewqqwerty/DisamAssist.js]]
//由[[User:GZWDer]]本地化:[[User:GZWDer/DisamAssist.js]] 2020-08-19
//由[[User:Peacearth]] 稍作翻譯 2021-05-15
//由[[User:落花有意12138]]提供改善與修正建議 2023-07-15
//由[[User:Peacearth]]擴展使用範圍至全部同類索引條目 2023-07-15
//由[[User:YFdyh000]]增加简体中文翻译,并调整部分参数 2023-07-16
//由[[User:YFdyh000]]引入HanAssist 2023-07-17

mw.loader.using( 'ext.gadget.HanAssist', function() {
window.DisamAssist = jQuery.extend( true, {
	cfg: {
		/*
		 * Categories where disambiguation pages are added (usually by a template like {{Disambiguation}}
		 */
		disamCategories: ['全部消歧義頁面','全部同類索引條目'],
		
		/*
		 * "Canonical names" of the templates that may appear after ambiguous links
		 * and which should be removed when fixing those links
		 */
		disamLinkTemplates: [
			'Disambiguation needed',
			'Dn',
			'連結消歧義',
			'链接消歧义',
			'需要消歧义',
			'需要消歧義'
		],
		
		/*
		 * "Canonical names" of the templates that designate intentional links to
		 * disambiguation pages
		 */
		disamLinkIgnoreTemplates: [
			'R from ambiguous page',
			'R to disambiguation page', '消歧義頁重定向',
			'R from incomplete disambiguation'
		],
		
		/*
		 * Format string for "Foo (disambiguation)"-style pages
		 */
		 disamFormat: '$1 (消歧义)',
		
		/*
		 * Regular expression matching the titles of disambiguation pages (when they are different from
		 * the titles of the primary topics)
		 */
		disamRegExp: '^(.*) \\(消歧[义義]\\)$',
		
		/*
		 * Text that will be inserted after the link if the user requests help. If the value is null,
		 * the option to request help won't be offered
		 */
		disamNeededText: '{{dn|date={{subst:CURRENTYEAR}}年{{subst:CURRENTMONTHNAME}}}}',
		
		/*
		 * Content of the "Foo (disambiguation)" pages that will be created automatically when using
		 * DisamAssist from a "Foo" page
		 */
		redirectToDisam: '#REDIRECT [[$1]]',
		
		/*
		 * Whether intentional links to disambiguation pages can be explicitly marked by adding " (disambiguation)"
		 */
		intentionalLinkOption: false,
		
		/*
		 * Namespaces that will be searched for incoming links to the disambiguation page (pages in other
		 * namespaces will be ignored)
		 */
		targetNamespaces: [6, 10, 14, 100, 108, 0],
		
		/*
		 * Number of backlinks that will be downloaded at once
		 * When using blredirect, the maximum limit is supposedly halved
		 * (see http://www.mediawiki.org/wiki/API:Backlinks)
		 */
		backlinkLimit: 250,
		
		/*
		 * Number of titles we can query for at once
		 */
		queryTitleLimit: 50,
	
		/*
		 * Number of characters before and after the incoming link that will be displayed
		 */
		radius: 300,
	
		/*
		 * Height of the context box, in lines
		 */
		numContextLines: 4,
	
		/*
		 * Number of pages that will be stored before saving, so that changes to them can be
		 * undone if need be
		 */
		historySize: 2,
		
		/*
		 * Minimum time in seconds since the last change was saved before a new edit can be made. A
		 * negative value or 0 disables the cooldown. Users with the "bot" right won't be affected by
		 * the cooldown
		 */
		editCooldown: 0,
		
		/*
		 * Specify how the watchlist is affected by DisamAssist edits. Possible values: "watch", "unwatch",
		 * "preferences", "nochange"
		 */
		watch: 'nochange'
	},

	// 简体中文翻译取自[[User:YFdyh000/DisamAssist.js]]
	// 繁体中文翻译取自[[User:Peacearth/DisamAssist.js]]
	// 英文翻译取自[[:en:User:Qwertyytrewqqwerty/DisamAssist.js]]
	txt: mw.libs.HanAssist.parse({
		start: {
			hans: "链入链接消歧义",
			hant: "消歧義連入連結",
			other: "Disambiguate links"
		},
		startMain: {
			hans: "指向题目的链接消歧义",
			hant: "消歧義連入主條目之連結",
			other: "Disambiguate links to primary topic"
		},
		startSame: {
			hans: "指向本页面的链接消歧义",
			hant: "消歧義連入本頁面之連結",
			other: "Disambiguate links to DAB"
		},
		close: {
			hans: "关闭",
			hant: "關閉",
			other: "Close"
		},
		undo: {
			hans: "撤销",
			hant: "復原",
			other: "Undo"
		},
		omit: {
			hans: "跳过",
			hant: "跳過",
			other: "Skip"
		},
		refresh: {
			hans: "刷新",
			hant: "重新整理",
			other: "Refresh"
		},
		titleAsText: {
			hans: "更换目标",
			hant: "其他目標",
			other: "Different target"
		},
		disamNeeded: {
			hans: "标记{{需要消歧义}}",
			hant: "標示{{dn}}",
			other: "Tag {{dn}}"
		},
		intentionalLink: {
			hans: "链接应指向 (消歧义)",
			hant: "有意連到消歧義頁的連結",
			other: "Intentional link to DAB"
		},
		titleAsTextPrompt: {
			hans: "输入新的链接目标:",
			hant: "請輸入新的連結目標:",
			other: "Specify the new target:"
		},
		removeLink: {
			hans: "解除链接",
			hant: "去除連結",
			other: "Unlink"
		},
		optionMarker: {
			hans: " [链到这个]",
			hant: " [連到這裡]",
			other: " [Link here]"
		},
		targetOptionMarker: {
			hans: " [当前目标]",
			hant: " [當前目標]",
			other: " [Current target]"
		},
		redirectOptionMarker: {
			hans: " [当前目标(已重定向)]",
			hant: " [當前目標(已重定向)]",
			other: " [Current target (redirected)]"
		},
		pageTitleLine: {
			hans: "<a href=\"$1\">$2</a>:",
			hant: "<a href=\"$1\">$2</a>:",
			other: "In <a href=\"$1\">$2</a>:"
		},
		noMoreLinks: {
			hans: "沒有需要消歧义的链接了。",
			hant: "沒有需要消歧義的連結了。",
			other: "No more links to disambiguate."
		},
		pendingEditCounter: {
			hans: "正在保存$1个页面,队列中有$2个页面",
			hant: "$1個頁面儲存中,$2個頁面佇列中",
			other: "Saving: $1; in history: $2"
		},
		pendingEditBox: {
			hans: "DisamAssist正在保存您的$1笔编辑。",
			hant: "DisamAssist正在儲存您的編輯($1)。",
			other: "DisamAssist is currently saving changes ($1)."
		},
		pendingEditBoxTimeEstimation: {
			hans: "$1;预计还需:$2",
			hant: "$1;估計剩餘時間:$2",
			other: "$1; approximate time remaining: $2"
		},
		pendingEditBoxLimited: {
			hans: "完成所有编辑的保存前,不要关闭本页面。您可以通过其他标签页继续编辑,但请注意,不鼓励在多个页面中同时使用DisamAssist小工具,否则短时间内产生的大量编辑可能有不利影响。",
			hant: "在所有待定變更保存完成之前,請不要關閉此分頁。您可以在其他分頁繼續編輯維基百科,但請注意,我們並不鼓勵同時在多個頁面使用DisamAssist小工具,因為在短時間內進行大量編輯可能會對維基百科造成干擾。",
			other: "Please don't close this tab until all pending changes have been saved. You may keep editing Wikipedia in a different tab, but be advised that using multiple instances of DisamAssist at the same time is discouraged, as a high number of edits over a short time period may be disruptive."
		},
		error: {
			hans: "错误:$1",
			hant: "錯誤:$1",
			other: "Error: { other: $1"
		},
		fetchRedirectsError: {
			hans: "无法获取重定向:“$1”。",
			hant: "無法獲取重定向:\"$1\".",
			other: "Unable to fetch redirects: \"$1\"."
		},
		getBacklinksError: {
			hans: "无法下载反向链接:“$1”。",
			hant: "無法下載反向連結:\"$1\".",
			other: "Unable to download backlinks: \"$1\"."
		},
		fetchRightsError: {
			hans: "无法获取用户权限:“$1”,",
			hant: "無法獲取用戶權限:\"$1\",",
			other: "Unable to fetch user rights: \"$1\","
		},
		loadPageError: {
			hans: "无法加载“$1”:“$2”。",
			hant: "無法載入$1:\"$2\".",
			other: "Unable to load $1: \"$2\"."
		},
		savePageError: {
			hans: "无法保存对“$1”的更改:“$2”。",
			hant: "無法將變更儲存至$1:\"$2\".",
			other: "Unable to save changes to $1: \"$2\"."
		},
		dismissError: {
			hans: "忽略",
			hant: "忽略",
			other: "Dismiss"
		},
		pending: {
			hans: "DisamAssist有未保存的编辑。点击“关闭”可保存。",
			hant: "DisamAssist尚有未儲存的編輯。如欲儲存之,請按「關閉」。",
			other: "There are unsaved changes in DisamAssist. To save them, please press Close"
		},
		editInProgress: {
			hans: "DisamAssist正在编辑。关闭本页面可能遗失您的编辑成果。",
			hant: "DisamAssist正在進行編輯。如果您將本分頁關閉,可能會喪失您的編輯。",
			other: "DisamAssist is currently performing changes. If you close the tab now, they may be lost."
		},
		ellipsis: {
			hans: "...",
			hant: "...",
			other: "..."
		},
		notifyCharacter: {
			hans: "✔",
			hant: "✔",
			other: "✔"
		},
		summary: {
			hans: "使用[[User:YFdyh000/DisamAssist.js|DisamAssist]]清理[[WP:DAB|消歧义]]链接:[[$1]]($2)",
			hant: "使用[[User:YFdyh000/DisamAssist.js|DisamAssist]]清理[[WP:DAB|消歧義]]連結:[[$1]]($2)。",
			other: "Disambiguating links to [[$1]] ($2) using [[User:YFdyh000/DisamAssist|DisamAssist]]."
		},
		summaryChanged: {
			hans: "改链[[$1]]",
			hant: "改連結至[[$1]]",
			other: "link changed to [[$1]]"
		},
		summaryOmitted: {
			hans: "已跳过链接",
			hant: "連結已跳過",
			other: "link skipped"
		},
		summaryRemoved: {
			hans: "已解除链接",
			hant: "連結已移除",
			other: "link removed"
		},
		summaryIntentional: {
			hans: "有意链至消歧义页面",
			hant: "刻意連至消歧義頁面",
			other: "intentional link to DAB"
		},
		summaryHelpNeeded: {
			hans: "需要帮助",
			hant: "需要幫助",
			other: "help needed"
		},
		summarySeparator: {
			hans: ";",
			hant: ";",
			other: "; "
		},
		redirectSummary: {
			hans: "用[[User:YFdyh000/DisamAssist.js|DisamAssist]]创建目标为[[$1]]的重定向。",
			hant: "使用[[User:YFdyh000/DisamAssist.js|DisamAssist]]創建目標為[[$1]]的重定向。",
			other: "Creating redirect to [[$1]] using [[User:YFdyh000/DisamAssist|DisamAssist]]."
		}
	}
	//, { locale: 'zh-tw' } // 手动设定语言
	)
}, window.DisamAssist || {} );

mw.loader.load( '//es.wikipedia.org/w/index.php?title=Usuario:Qwertyytrewqqwerty/DisamAssist-core.js&action=raw&ctype=text/javascript' );
mw.loader.load( '//es.wikipedia.org/w/index.php?title=Usuario:Qwertyytrewqqwerty/DisamAssist.css&action=raw&ctype=text/css', 'text/css' );
} );

//</source>