“MediaWiki:Common.js”的版本间差异
来自仁王 wiki
(美化返回顶部按钮) |
小 |
||
第8行: | 第8行: | ||
//div.style.backgroundColor = "steelblue"; | //div.style.backgroundColor = "steelblue"; | ||
div.style.position = "fixed"; | div.style.position = "fixed"; | ||
− | div.style.textAlign = "center"; | + | //div.style.textAlign = "center"; |
div.style.opacity = ".7"; | div.style.opacity = ".7"; | ||
− | div.style.width = " | + | div.style.width = "44px"; |
− | div.style.height = " | + | div.style.height = "44px"; |
div.style.bottom = "100px"; | div.style.bottom = "100px"; | ||
div.style.right = "50px"; | div.style.right = "50px"; | ||
div.style.display = "none"; | div.style.display = "none"; | ||
div.style.background = "url(https://www.niohwiki.com/mediawiki/images/6/63/Fbar_top_pink.png)"; | div.style.background = "url(https://www.niohwiki.com/mediawiki/images/6/63/Fbar_top_pink.png)"; | ||
− | div.innerHTML = '<a href="#"></a>'; | + | div.innerHTML = '<a href="#">返回顶部</a>'; |
var i = document.getElementById("mw-footer-container"); | var i = document.getElementById("mw-footer-container"); |
2022年5月11日 (三) 12:20的版本
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ //console.log("已触发MediaWiki:Common.js"); /* 创建并设置回到顶部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.innerHTML = '<a href="#">返回顶部</a>'; var i = document.getElementById("mw-footer-container"); i.parentNode.insertBefore(div,i); document.body.addEventListener("wheel",function () { //console.log("滚动条"); document.documentElement.scrollTop > document.documentElement.clientHeight ? div.style.display = "block":div.style.display = "none";}); //} /* 把导航栏左侧仁王1和仁王2变为可用超链接 */ var nioh1 = document.getElementById("p-.E4.BB.81.E7.8E.8B1-label"); nioh1.style.cursor="pointer"; nioh1.style.color="#36c"; nioh1.onclick=function(){window.location.href="index.php?title=仁王1";} var nioh2 = document.getElementById("p-.E4.BB.81.E7.8E.8B2-label"); nioh2.style.cursor="pointer"; nioh2.style.color="#36c"; nioh2.onclick=function(){window.location.href="index.php?title=仁王2";} /* 把tinymce插件影响到的编辑源代码变成中文并且换成高级编辑 document.querySelector(".collapsible span").innerText="编辑源代码"; document.querySelector("#ca-tinymceedit span").innerText="高级编辑";*/ /* 插入百度统计 */ 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); })();