跳转到内容

User:Lopullinen/gadgets/supstyleilh.js

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

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

// 使{{tl|ilh}}仿[[:en:Template:Interlanguage link]]效果
// 感谢[[User:AnYiLin]]的技术指导

$(window).ready(function() {
	window.setTimeout(function() {
		mw.hook('wikipage.content').add(function($item) {
			if ($item.attr('id') === 'mw-content-text') {
				$('.ilh-all').each(function() {
					$(this).find('.ilh-page')
					.append($('<sup>', {
						class: 'noprint nowrap'
					})
					.append('[')
					.append($('<a>', {
						class: 'extiw',
						href: $(this).find('.ilh-link>a').attr('href'),
						title: $(this).data('lang-code') + ':' + $(this).data('foreign-title'),
						target: '_blank',
						text: $(this).data('lang-code')
					})).append(']').css({
						"user-select": "none",
						"font-weight": "normal",
						"font-style": "normal"
					}));
					$(this).find('.ilh-comment').remove();
				});
			}
		});
	}, 100);
});