MediaWiki:Common.js
来自仁王 wiki
注意:在保存之后,您可能需要清除浏览器缓存才能看到所作出的变更的影响。
- Firefox或Safari:按住Shift的同时单击刷新,或按Ctrl-F5或Ctrl-R(Mac为⌘-R)
- Google Chrome:按Ctrl-Shift-R(Mac为⌘-Shift-R)
- Internet Explorer:按住Ctrl的同时单击刷新,或按Ctrl-F5
- Opera:前往菜单 → 设置(Mac为Opera → Preferences),然后隐私和安全 → 清除浏览数据 → 缓存的图片和文件。
/* 这里的任何JavaScript将为所有用户在每次页面载入时加载。 */ window.onload = function () { console.log("已触发MediaWiki:Common.js"); var div = document.createElement("div"); div.style.backgroundColor = "steelblue"; div.style.position = "fixed"; div.style.textAlign = "center"; div.style.opacity = ".7"; div.style.width = "40px"; div.style.height = "40px"; div.style.bottom = "100px"; div.style.right = "50px"; div.style.display = "none"; div.innerHTML = '<a href="#" style="color:white">返回顶部</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"; }); }