跳转到内容

User:JC1/SR/chars.js

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

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

/******************************************/
/*  [[MediaWiki:Gadget-specialchars.js]]  */
/*         只不過不想把符號表弄至上方.        */
/*              順便測試一下js              */
/******************************************/
$(function(){
	// 調整符號表
	var wpEditToolbar=document.getElementById("toolbar")||document.getElementById("wikiEditor-ui-toolbar");
	if(!wpEditToolbar){return;}
	var editspecialchars=document.getElementById("editpage-specialchars");
	if (editspecialchars) {
		function chooseCharSubset() {// select subsection of special characters
			var s=menu.selectedIndex;
			for (var i = 0,p; p=lines[i] ; i++) {
				p.style.display = i == s ? 'inline' : 'none';
			}
		}
		// 增加特殊符號的下拉選單
		var lines = editspecialchars.getElementsByTagName('p');
		var menu=createElement("select",null,{
			'styles':{'display':"inline"},
			'events':{'change':chooseCharSubset}
		});
		for (var i = 0,p; p=lines[i] ; i++) {
			menu.options[i]=new Option(p.title?p.title:p.id);
		}
		editspecialchars.insertBefore(menu,editspecialchars.firstChild);
		chooseCharSubset();
		// 移動特殊符號的下拉選單
		// elementMoveto(editspecialchars , wpEditToolbar , 'after' );
	}
});