User:Irukaza/common.js:修订间差异

H萌娘,万物皆可H的百科全书!
跳到导航 跳到搜索
imported>=海豚=
无编辑摘要
imported>=海豚=
无编辑摘要
(未显示同一用户的1个中间版本)
第1行: 第1行:
  function r18Warning() {
window.HanTSVersion="1139833";
     var content = $('<div id="x18"><div id="x18Context"><div id="x18Title"><div id="x18Icon"></div></div><div class="x18Button"></div></div></div><div class="x18-page-warning" style="position:fixed;top: 0px;left: 0px;z-index:2"><a href="/Mainpage" title="点此返回主页"><img alt="点此返回主页" src="https://img.moegirl.org/common/d/d3/%E6%9C%AC%E6%96%87%E4%B8%8D%E9%80%82%E5%90%88%E6%9C%AA%E6%88%90%E5%B9%B4%E4%BA%BA%E6%B5%8F%E8%A7%88.png" width="227" height="83"></a></div>');
window.origHTML=document.getElementById("bodyContent").innerHTML;
     if (window.localStorage.getItem('x18') !== 1) { //如果没有x18记录
window.origHeadElem = document.getElementById("firstHeading") || document.getElementById("section_0");
       $('body').css('overflow', 'hidden'); //禁止滚屏
window.origHeadHTML=window.origHeadElem.innerHTML;
       $('#mw-content-text').css({
if ( mw.config.get( 'wgPageName' ) != '特殊:最近更改' ){
         'opacity': 0,
window.newtrad2sim=function(){
         'transition': 'opacity 0.37s linear'
var listobj=pview.getElementsByTagName("ul")[0];
       }); //禁止偷看并加点动画
if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
       content.prependTo('body').find('.x18Button').append('<div id="x18Yes">是</div><div id="x18No" class="x18Button"> </div>')
document.getElementById("bodyContent").innerHTML=window.newtrad2simcore(" "+document.getElementById("bodyContent").innerHTML).substr(1);
         .end().find('#x18Title').append('你是否已年满十八岁?')
window.origHeadElem.innerHTML=window.newtrad2simcore(" "+window.origHeadElem.innerHTML).substr(1);
         .end().delay(400).queue(function() {
var convtag=document.getElementById("ca-conv");
           $(this).css({
if(!convtag)
             'opacity': 1,
listobj.innerHTML="<li id=\"ca-conv\"><span><a href=\"javascript:window.simrestore()\" title=\"复原\" id=\"ca-conv-text\"> 港台繁体<\/a><\/span><\/li>"+listobj.innerHTML;
             'transition': 'opacity 0.37s linear'
else
           }); // 显示警告信息并加点动画
convtag.innerHTML="<span><a href=\"javascript:window.simrestore()\" title=\" 复原\" id=\"ca-conv-text\"> 港台繁体<\/a><\/span>";
           $(this).dequeue();
}
         });
};
       $('#x18Yes').bind('click', function() {
 
         window.localStorage.setItem('x18', true); //记录x18
window.newtrad2simm=function(){
         $('#mw-content-text').css('opacity', 1).delay(400).queue(function() {
document.getElementById("bodyContent").innerHTML=window.newtrad2simcore(" "+document.getElementById("bodyContent").innerHTML).substr(1);
           $(this).removeAttr('style'); //显示内容
window.origHeadElem.innerHTML=window.newtrad2simcore(" "+window.origHeadElem.innerHTML).substr(1);
           $(this).dequeue();
var convtag=document.getElementById("ca-conv-text");
         });
convtag.parentElement.innerHTML="<a href=\"javascript:window.simrestorem()\" title=\" 复原\" id=\"ca-conv-text\"> 港台繁体<\/a>";
         $("#x18").css('opacity', 0).delay(400).queue(function() {
};
           $('body').removeAttr('style'); //允许滚屏
 
           $(this).remove(); //移除警告信息
 
           $(this).dequeue();
window.simrestore=function(){
         });
var listobj=pview.getElementsByTagName("ul")[0];
       });
if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
       $('#x18No').bind('click', function() {
document.getElementById("bodyContent").innerHTML=window.origHTML;
         window.location.replace(window.location.origin + '/' + mw.config.get('wgMainPageTitle')); //不给你看
window.origHeadElem.innerHTML=window.origHeadHTML;
       });
var convtag=document.getElementById("ca-conv");
     } else $("#x18").remove(); //如果有x18记录
if(!convtag)
      $('.x18-page-warning').appendTo('.mw-panel');
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(){
document.getElementById("bodyContent").innerHTML=window.origHTML;
window.origHeadElem.innerHTML=window.origHeadHTML;
var convtag=document.getElementById("ca-conv-text");
convtag.parentElement.innerHTML="<a href=\"javascript:window.newtrad2simm()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a>";
};
 
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");
    if(pview&&pview.className.search("vector")>=0&&(window.location.search.search("action=edit")<0||window.location.search.search("action=view")>=0)){
    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>";
    }
    }
    }
   $(function() {
}
     tabs();
}
     if (mw.config.get('wgMainPageTitle') !== mw.config.get('wgPageName') && mw.config.get('wgNamespaceNumber') === 0) r18Warning();
})();

2021年7月30日 (五) 22:14的版本

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( 'wgPageName' ) != '特殊:最近更改' ){
window.newtrad2sim=function(){
	var listobj=pview.getElementsByTagName("ul")[0];
	if(listobj.parentNode.className.indexOf("emptyPortlet")<0){
		document.getElementById("bodyContent").innerHTML=window.newtrad2simcore(" "+document.getElementById("bodyContent").innerHTML).substr(1);
		window.origHeadElem.innerHTML=window.newtrad2simcore(" "+window.origHeadElem.innerHTML).substr(1);
		var convtag=document.getElementById("ca-conv");
		if(!convtag)
			listobj.innerHTML="<li id=\"ca-conv\"><span><a href=\"javascript:window.simrestore()\" title=\"复原\" id=\"ca-conv-text\">港台繁体<\/a><\/span><\/li>"+listobj.innerHTML;
		else
			convtag.innerHTML="<span><a href=\"javascript:window.simrestore()\" title=\"复原\" id=\"ca-conv-text\">港台繁体<\/a><\/span>";
	}
};

window.newtrad2simm=function(){
	document.getElementById("bodyContent").innerHTML=window.newtrad2simcore(" "+document.getElementById("bodyContent").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>";
};


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(){
	document.getElementById("bodyContent").innerHTML=window.origHTML;
	window.origHeadElem.innerHTML=window.origHeadHTML;
	var convtag=document.getElementById("ca-conv-text");
	convtag.parentElement.innerHTML="<a href=\"javascript:window.newtrad2simm()\" title=\"繁体中文\" id=\"ca-conv-text\">大陆简体<\/a>";
};

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");
      if(pview&&pview.className.search("vector")>=0&&(window.location.search.search("action=edit")<0||window.location.search.search("action=view")>=0)){
      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>";
      }
    }
}
	}