MediaWiki:Common.js:修订间差异
来自仁王 wiki
无编辑摘要 |
修复仁王1、仁王2超链接失效(升级1.44导致 |
||
(未显示同一用户的43个中间版本) | |||
第1行: | 第1行: | ||
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ | /* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ | ||
console.log(" | /* 创建并设置回到顶部div */ | ||
//window.onload = function () { | |||
//console.log("onload触发"); | |||
var div = document.createElement("div"); | var div = document.createElement("div"); | ||
div.style.backgroundColor = " | //div.style.backgroundColor = "steelblue"; | ||
div.style. | div.style.position = "fixed"; | ||
div.style.width = " | //div.style.textAlign = "center"; | ||
div.style.height = " | div.style.opacity = ".7"; | ||
div.innerHTML = '<a href="#"> | div.style.width = "44px"; | ||
div.style.height = "44px"; | |||
document.getElementById(" | div.style.bottom = "100px"; | ||
div.style.right = "50px"; | |||
div.style.display = "none"; | |||
div.style.background = "url(https://www.niohwiki.com/mediawiki/images/6/63/Fbar_top_pink.png)"; | |||
div.style.boxShadow='0px 0px 7px 0px rgb(1 1 1 / 30%)'; | |||
div.style.borderRadius='50%'; | |||
div.innerHTML = '<a href="#" style="float:left;width:44px;height:44px;"></a>'; | |||
var i = document.getElementById("mw-footer-container"); | |||
i.parentNode.insertBefore(div,i); | |||
/* 取消返回顶部按钮监听事件 | |||
document.body.addEventListener("wheel",function () { | |||
document.documentElement.scrollTop > document.documentElement.clientHeight ? div.style.display = "block":div.style.display = "none";}); */ | |||
div.style.display = "block"; | |||
/* 把导航栏左侧仁王1和仁王2变为可用超链接 */ | |||
var nioh1 = document.getElementById("p-仁王1-label"); | |||
nioh1.style.cursor="pointer"; | |||
nioh1.style.color="#36c"; | |||
nioh1.onclick=function(){window.location.href="index.php?title=仁王1";} | |||
var nioh2 = document.getElementById("p-仁王2-label"); | |||
nioh2.style.cursor="pointer"; | |||
nioh2.style.color="#36c"; | |||
nioh2.onclick=function(){window.location.href="index.php?title=仁王2";} | |||
/* 插入百度统计 */ | |||
var _hmt = _hmt || []; | |||
(function() { | |||
var hm = document.createElement("script"); | |||
hm.src = "https://hm.baidu.com/hm.js?b79796bd01951a40cf8a8a1a7f24aba4"; | |||
var s = document.getElementsByTagName("script")[0]; | |||
s.parentNode.insertBefore(hm, s); | |||
})(); | |||
/* 手机端侧边栏滚动问题*/ | |||
if (window.outerWidth < 600) { | |||
var side = document.querySelectorAll("#site-navigation .sidebar-inner")[0]; | |||
side.style.height='70vh'; | |||
side.style.overflowY='scroll'; | |||
} |
2025年9月13日 (六) 07:39的最新版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ /* 创建并设置回到顶部div */ //window.onload = function () { //console.log("onload触发"); var div = document.createElement("div"); //div.style.backgroundColor = "steelblue"; div.style.position = "fixed"; //div.style.textAlign = "center"; div.style.opacity = ".7"; div.style.width = "44px"; div.style.height = "44px"; div.style.bottom = "100px"; div.style.right = "50px"; div.style.display = "none"; div.style.background = "url(https://www.niohwiki.com/mediawiki/images/6/63/Fbar_top_pink.png)"; div.style.boxShadow='0px 0px 7px 0px rgb(1 1 1 / 30%)'; div.style.borderRadius='50%'; div.innerHTML = '<a href="#" style="float:left;width:44px;height:44px;"></a>'; var i = document.getElementById("mw-footer-container"); i.parentNode.insertBefore(div,i); /* 取消返回顶部按钮监听事件 document.body.addEventListener("wheel",function () { document.documentElement.scrollTop > document.documentElement.clientHeight ? div.style.display = "block":div.style.display = "none";}); */ div.style.display = "block"; /* 把导航栏左侧仁王1和仁王2变为可用超链接 */ var nioh1 = document.getElementById("p-仁王1-label"); nioh1.style.cursor="pointer"; nioh1.style.color="#36c"; nioh1.onclick=function(){window.location.href="index.php?title=仁王1";} var nioh2 = document.getElementById("p-仁王2-label"); nioh2.style.cursor="pointer"; nioh2.style.color="#36c"; nioh2.onclick=function(){window.location.href="index.php?title=仁王2";} /* 插入百度统计 */ var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?b79796bd01951a40cf8a8a1a7f24aba4"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); /* 手机端侧边栏滚动问题*/ if (window.outerWidth < 600) { var side = document.querySelectorAll("#site-navigation .sidebar-inner")[0]; side.style.height='70vh'; side.style.overflowY='scroll'; }