User:Crowley666/js/TranslationHelper.js

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

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

$(document).ready(function(){
	if(typeof mw.cx !== 'undefined' && typeof mw.cx.TranslationController !== 'undefined') {
		mw.cx.TranslationController.prototype.getMTAbuseMsg = function ( numOfHighMTSections ) { return false; }
		$(document).on('keydown', function (e) {
			if ((e.metaKey || e.ctrlKey && !e.altKey) && (e.which === 69 || e.which === 72)) {
				e = $('a.ve-ce-annotation-active');
				t = e.attr('title');
				if (t.startsWith('http')) {
					t0 = t.split('/wiki/')[0];
					t = t.split('/wiki/')[1];
					if (t0.endsWith('zh.wikipedia.org')) {
						e.attr('rel', 'mw:WikiLink');
						e.attr('class', 'cx-link ve-ce-annotation ve-ce-nailedAnnotation ve-ce-linkAnnotation ve-ce-mwInternalLinkAnnotation ve-ce-cxLinkAnnotation ve-ce-annotation-active');
						e.attr('title', t);
					}
				}
				e.text(t);
			}
		});
	}
});