MediaWiki:Gadget-tradsim-trad2sim.js:修订间差异

H萌娘,万物皆可H的百科全书!
跳到导航 跳到搜索
Mediawiki>William915
 
imported>=海豚=
无编辑摘要
 
(未显示同一用户的62个中间版本)
第1行: 第1行:
/* #REDIRECT */mw.loader.load("//zh-yue.wikipedia.org/w/index.php?title=User:William915/Gadget-tradsim-trad2sim.js\u0026action=raw\u0026ctype=text/javascript");
window.HanTSVersion="1139833";
window.origHTML=document.getElementById("bodyContent").innerHTML;
window.origHeadElem = document.getElementById("firstHeading") || document.getElementById("section_0");
window.origHeadHTML=window.origHeadElem.innerHTML;
if (mw.config.get('wgNamespaceNumber') != -1){
window.newtrad2sim=function(){
var listobj=pview.getElementsByTagName("ul")[0];
if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
window.localStorage.setItem('Traditional Chinese', true);
location.reload();
}
};
 
window.newtrad2simm=function(){
window.localStorage.setItem('Traditional Chinese', true);
location.reload();
};
 
 
window.simrestore=function(){
var listobj=pview.getElementsByTagName("ul")[0];
if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
document.getElementById("bodyContent").innerHTML=window.origHTML;
window.origHeadElem.innerHTML=window.origHeadHTML;
var convtag=document.getElementById("ca-conv");
if(!convtag)
listobj.innerHTML="<li id=\"ca-conv\"><span><a href=\"javascript:window.newtrad2sim()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a><\/span><\/li>"+listobj.innerHTML;
else
convtag.innerHTML="<span><a href=\"javascript:window.newtrad2sim()\" title=\" 繁体中文\" id=\"ca-conv-text\">大陆简体<\/a><\/span>";
}
};
 
window.simrestorem=function(){
localStorage.removeItem('Traditional Chinese');
location.reload();
};
 
if(document.getElementById("mw-mf-main-menu-button")){ //There should be a better way to check this
var convtag=document.getElementById("ca-conv-text");
if(!convtag){
spanobj=document.createElement("span");
srch=document.getElementById("ca-watch");
srch.parentElement.insertBefore(spanobj,srch);
spanobj.innerHTML="<a href=\"#\" onclick=\"window.newtrad2simm()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a>";
}
}else{
    var pview=document.getElementById("p-namespaces");
    var listobj=pview.getElementsByTagName("ul")[0];
    if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
     var convtag=document.getElementById("ca-conv");
     if(!convtag)
      listobj.innerHTML="<li id=\"ca-conv\"><span><a onclick=\"javascript:window.newtrad2sim()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a><\/span><\/li>"+listobj.innerHTML;
     else
      convtag.innerHTML="<span><a href=\"javascript:window.newtrad2sim()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a><\/span>";
    }
   }
}
if (window.localStorage.getItem('Traditional Chinese')) {
document.querySelector("body").innerHTML=window.newtrad2simcore(" "+document.querySelector("body").innerHTML).substr(1);
window.origHeadElem.innerHTML=window.newtrad2simcore(" "+window.origHeadElem.innerHTML).substr(1);
var convtag=document.getElementById("ca-conv-text");
convtag.parentElement.innerHTML="<a href=\"javascript:window.simrestorem()\" title=\"復原\" id=\"ca-conv-text\">港台繁體<\/a>";
}

2021年8月5日 (四) 21:52的最新版本

window.HanTSVersion="1139833";
window.origHTML=document.getElementById("bodyContent").innerHTML;
window.origHeadElem = document.getElementById("firstHeading") || document.getElementById("section_0");
window.origHeadHTML=window.origHeadElem.innerHTML;
if (mw.config.get('wgNamespaceNumber') != -1){
window.newtrad2sim=function(){
	var listobj=pview.getElementsByTagName("ul")[0];
	if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
			window.localStorage.setItem('Traditional Chinese', true);
			location.reload();
	}
};

window.newtrad2simm=function(){
		window.localStorage.setItem('Traditional Chinese', true);
		location.reload();
};


window.simrestore=function(){
	var listobj=pview.getElementsByTagName("ul")[0];
	if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
		document.getElementById("bodyContent").innerHTML=window.origHTML;
		window.origHeadElem.innerHTML=window.origHeadHTML;
		var convtag=document.getElementById("ca-conv");
		if(!convtag)
			listobj.innerHTML="<li id=\"ca-conv\"><span><a href=\"javascript:window.newtrad2sim()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a><\/span><\/li>"+listobj.innerHTML;
		else
			convtag.innerHTML="<span><a href=\"javascript:window.newtrad2sim()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a><\/span>";
	}
};

window.simrestorem=function(){
	localStorage.removeItem('Traditional Chinese');
	location.reload();
};

if(document.getElementById("mw-mf-main-menu-button")){ //There should be a better way to check this
	var convtag=document.getElementById("ca-conv-text");
	if(!convtag){
		spanobj=document.createElement("span");
		srch=document.getElementById("ca-watch");
		srch.parentElement.insertBefore(spanobj,srch);
		spanobj.innerHTML="<a href=\"#\" onclick=\"window.newtrad2simm()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a>";
	}
}else{
      var pview=document.getElementById("p-namespaces");
      var listobj=pview.getElementsByTagName("ul")[0];
      if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
        var convtag=document.getElementById("ca-conv");
        if(!convtag)
          listobj.innerHTML="<li id=\"ca-conv\"><span><a onclick=\"javascript:window.newtrad2sim()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a><\/span><\/li>"+listobj.innerHTML;
        else
          convtag.innerHTML="<span><a href=\"javascript:window.newtrad2sim()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a><\/span>";
      }
    }
}
if (window.localStorage.getItem('Traditional Chinese')) {
document.querySelector("body").innerHTML=window.newtrad2simcore(" "+document.querySelector("body").innerHTML).substr(1);
	window.origHeadElem.innerHTML=window.newtrad2simcore(" "+window.origHeadElem.innerHTML).substr(1);
	var convtag=document.getElementById("ca-conv-text");
	convtag.parentElement.innerHTML="<a href=\"javascript:window.simrestorem()\" title=\"復原\" id=\"ca-conv-text\">港台繁體<\/a>";
}