您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
MCBBS行为拓展/样式修复
当前为
// ==UserScript== // @name MCBBS Extender // @namespace https://i.zapic.cc // @version beta-0.0.5 // @description MCBBS行为拓展/样式修复 // @author Zapic // @match https://www.mcbbs.net/* // @run-at document-body // ==/UserScript== (function() { var conf = { //美化代码块样式 "fixCodeBlock": true, //修复代码块"复制代码"换行消失的问题 "fixCodeCopy": true, //修复表格排版内含有多媒体导致元素戳破表格的问题 "fixTableLayout": true, //后台轮询新消息 "QueryMessage": true, //后台轮询消息间隔,单位为秒 "QueryMessageInterval": 60, //板块页点击"下一页"按钮是否记住当前页码 "rememberPage":true, //美化右侧回到顶部按钮 "animateGoToTopButton":true, //固定顶栏在顶部 "pinnedTopBar":true, //顶栏弹出菜单美化&对齐 "fixTopBarPopMenu": true, //主题悬浮预览 "hoverPreviewTheme":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;}.pl table.t_table[style*=\"px\"]{table-layout: auto;}</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:790;top:0;box-shadow: #0000004f 3px 3px 5px 1px;}.mc_map_wp{padding-top: 45px;}#scbar_type_menu{top:38px!important}#user_info_menu,#myprompt_menu,#usertools_menu,#sslct_menu {position:fixed!important;top:47px!important}</style>"); } if(conf.fixTopBarPopMenu){ jq("body").append("<style id=\"fixTopBarPopMenu\">div#user_info_menu {margin-top: 5px;}.user_info_menu_info > li {margin-top: 2px;}a.rank {padding: 2px 7px!important; border-radius: 14px;}a.rank:hover {text-decoration: none;}ul.user_info_menu_btn {padding-top: 6px;}ul.user_info_menu_btn>li>a:hover {background: #36b030;color: white;}ul.user_info_menu_btn>li>a {padding: 5px 8px;border-radius: 5px;}ul.user_info_menu_btn>li>a[onclick]:hover {background: red;}#myprompt_menu {margin-left: -10px;}#myprompt_menu,#usertools_menu,#sslct_menu { z-index:791!important;margin-top: 5px!important;border: 1px solid #d1d1d1;min-width: unset;border-radius: 5px;}#myprompt_menu>li>a, #usertools_menu>li>a {border: none; border-radius: 5px;text-align: center;padding: 3px 15px;}#myprompt_menu>li>a:hover, #usertools_menu>li>a:hover {background: #36b030;color: white;}div#sslct_menu {margin-left: 16px;padding-left: 14px;}.sslct_btn {border: none!important;width: 15px;height: 15px;padding: 2px;}.sslct_btn i {border-radius: 50%;width: 13px;height: 13px;}</style>"); } if(conf.hoverPreviewTheme){ jq(".sslct_btn").first().on("mouseover",function(){previewstyle = getcookie('extstyle');extstyle('./template/mcbbs/style/default');}); jq(".sslct_btn").last().on("mouseover",function(){previewstyle = getcookie('extstyle');extstyle('./template/mcbbs/style/winter');}); jq(".sslct_btn").last().on("click",function(){previewstyle = './template/mcbbs/style/winter'}); jq(".sslct_btn").first().on("click",function(){previewstyle = './template/mcbbs/style/default'}); jq(".sslct_btn").on("mouseout",function(){extstyle(previewstyle);}); } })();