您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
MCBBS行为拓展/样式修复
当前为
// ==UserScript== // @name MCBBS Extender // @namespace https://i.zapic.cc // @version beta-0.0.2 // @description MCBBS行为拓展/样式修复 // @author Zapic // @match https://www.mcbbs.net/* // ==/UserScript== (function() { var conf = { //美化代码块样式 "fixCodeBlock": true, //修复代码块"复制代码"换行消失的问题 "fixCodeCopy": true, //修复表格排版内含有多媒体导致元素戳破表格的问题 "fixTableLayout": true, //后台轮询新消息 "QueryMessage": true, //后台轮询消息间隔,单位为秒 "QueryMessageInterval": 60, //板块页点击"下一页"按钮是否记住当前页码 "rememberPage":true, //美化右侧回到顶部按钮 "animateGoToTopButton":true, //固定顶栏在顶部 "pinnedTopBar":true }; var jq = jQuery; if(conf.fixCodeBlock){ jq("body").append("<style id=\"fixCodeBlock\">.hljs > ::-webkit-scrollbar {background: #00000000;height: 5px}.hljs > ::-webkit-scrollbar-thumb{background:#0000005c;border-radius: 3px;}.pl .blockcode{overflow-x:auto;padding: 10px 0 20px 10px;}.blockcode ol{overflow-x: unset;}.hljs{display:unset;}.pl .blockcode em{position: absolute;margin-top: 3px;}.pl .blockcode ol{margin: 0 0 0px -10px!important;padding: 0 0 0px 20px !important;}</style>"); } if(conf.fixTableLayout){ jq("body").append("<style id=\"fixTableLayout\">.pl table.t_table{table-layout: fixed;}</style>"); } if(conf.fixCodeCopy){ copycode = function(obj) { if (!obj) return false; var count = obj.children[0].children.length; var code = ""; for(i=0;i<count;i++){ code += obj.children[0].children[i].innerText + "\r\n"; } setCopy(code, '代码已复制到剪贴板'); }; } if(conf.QueryMessage){ setInterval(function(){ jq.get("https://www.mcbbs.net/",function(d){var dom = jq(d); var el = dom.filter("script[src*=html5notification]"); var ut = dom.find(".user_tools"); var pum = dom.filter("#myprompt_menu"); jq(".user_tools").html(ut.html()); jq("#myprompt_menu").html(pum.html()); jq("title").text(NOTICECURTITLE); if(el.length !== 0){ if(!window.Html5notification){jq.get(el[0].src,function(s){eval(s);});} var s = el.nextUntil("div").last().text(); eval(s); noticeTitle(); } }); },conf.QueryMessageInterval*1000); } if(conf.rememberPage){ if($('autopbn')){ var npbtn=$('autopbn') var dc = npbtn.onclick; npbtn.onclick = function(){ var nextpageurl = this.getAttribute('rel').valueOf(); var curpage = parseInt(this.getAttribute('curpage').valueOf()); this.setAttribute('curpage',curpage+1); nextpageurl = nextpageurl.replace(/&page=\d+/, '&page=' + (curpage + 1)); history.replaceState(null,null,nextpageurl); dc(); }; } } if(conf.animateGoToTopButton){ jq("body").append("<style id=\"GoToTopButton\">#scrolltop{opacity:0;transform:scale(0.7);pointer-events:none;bottom: 270px;transform-origin: 0 50%;visibility:visible;margin-left:-5px;}</style>"); showTopLink = function() { var ft = $('ft'); if (ft) { var scrolltop = $('scrolltop'); var viewPortHeight = parseInt(document.documentElement.clientHeight); var scrollHeight = parseInt(document.body.getBoundingClientRect().top); var basew = parseInt(ft.clientWidth); var sw = scrolltop.clientWidth; if(scrolltop.style.transitionDuration=="") scrolltop.style.transitionDuration=".1s"; if (basew < 1000) { var left = parseInt(fetchOffset(ft)['left']); left = left < sw ? left * 2 - sw : left; scrolltop.style.left = (basew + left + 44) + 'px'; } else { scrolltop.style.left = 'auto'; scrolltop.style.right = 0; } if (BROWSER.ie && BROWSER.ie < 7) { scrolltop.style.top = viewPortHeight - scrollHeight - 150 + 'px'; } if (scrollHeight < -100) { scrolltop.style.opacity=1; scrolltop.style.transform="scale(1)"; scrolltop.style.pointerEvents="unset"; scrolltop.style.marginLeft="unset"; } else { scrolltop.style.opacity=""; scrolltop.style.transform=""; scrolltop.style.pointerEvents=""; scrolltop.style.marginLeft=""; } } } showTopLink(); } if(conf.pinnedTopBar){ jq("body").append("<style id=\"pinnedTopBar\">#toptb{position: fixed;width: 100%;z-index:99;top:0;}.mc_map_wp{padding-top: 45px;}#scbar_type_menu{top:38px!important}#user_info_menu,#myprompt_menu,#usertools_menu {position:fixed!important;top:47px!important}</style>"); } })();