MediaWiki:Common.js

Hineven留言 | 贡献2018年4月18日 (三) 09:20的版本

注意:在发布之后,您可能需要清除浏览器缓存才能看到所作出的更改的影响。

  • Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5Ctrl-R(Mac为⌘-R
  • Google Chrome:Ctrl-Shift-R(Mac为⌘-Shift-R
  • Edge:按住Ctrl的同时单击刷新,或按Ctrl-F5
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */


	var elist=document.getElementsByClassName("page-tags");
	for(var i = 0; i < elist.length; i++) {
		var str = elist[i].innerHTML;
		str=str.replace("番外","<strong style=\"background-color:#92fda3;\">番外</strong>");
		str=str.replace("长故事","<strong style=\"background-color:#ff8080;\">长故事</strong>");
		str=str.replace("故事集","<strong style=\"background-color:#df6eef;\">故事集</strong>");
		str=str.replace("故事","<strong style=\"background-color:#66b9f1;\">故事</strong>");
		str=str.replace("设定","<strong style=\"background-color:#ffff7b;\">设定</strong>");
		elist[i].innerHTML = str;
	}

/* 以下代码用于折叠文字应答函数 -- Hineven */

	collapse_click = function(id) { // 大力爆改css
		var ptitle = document.getElementById(id);
		if(id.match("disp") == null) {
			ptitle.attributes.getNamedItem("style").value = "display:none";
			document.getElementById(id+"-disp").attributes.getNamedItem("style").value = "display:visible";
			document.getElementById(id.replace("-title", "-content")).attributes.getNamedItem("style").value = "display:visible";
		} else {
			ptitle.attributes.getNamedItem("style").value = "display:none";
			document.getElementById(id.replace("-disp", "").replace("-title", "-content")).attributes.getNamedItem("style").value = "display:none";
			document.getElementById(id.replace("-disp", "")).attributes.getNamedItem("style").value = "display:visible";
		}
	}