User:Supergrey1/ pangu.js

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

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

// 基於 mastermay.github.io/text-autospace.js
// 改善中文和其他字元混排時的字距(僅對「閱讀模式」生效)。相比「小工具版」更加穩定,對排版的破壞力更小。
// 
// 使用方式:在 [[Special:MyPage/common.js]] 鍵入如下內容:
// importScript('User:Supergrey1/_pangu.js');

if (mw.config.get('wgAction') === 'view') {

	mw.loader.load('https://mastermay.github.io/text-autospace.js/text-autospace.min.js');
	mw.util.addCSS(`
	html.han-la hanla:after {
		content: " ";
		display: inline;
		font-family: Arial;
		font-size: 0.89em;
	}
	
	html.han-la code hanla,
	html.han-la pre hanla,
	html.han-la kbd hanla,
	html.han-la samp hanla,
	html.han-la ruby hanla {
		display: none;
	}
	
	html.han-la ol > hanla,
	html.han-la ul > hanla {
		display: none;
	}
	html.han-la tr > hanla {
	    display: none;
	}
	`);
	
	$(document).ready(function () {
		document.documentElement.classList.add('han-la');
	});
}