您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
MCBBS行为拓展/样式修复
当前为
// ==UserScript== // @name MCBBS Extender // @namespace https://i.zapic.cc // @version beta-0.0.8 // @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("head").append("<style id=\"fixCodeBlock\">.hljs > ::-webkit-scrollbar {background: #00000000;height: 7px}.hljs > ::-webkit-scrollbar-thumb:hover{background:#0000005c;}.hljs > ::-webkit-scrollbar-thumb{background:#0000002c;border-radius: 3px}.pl .blockcode{overflow-x:auto;padding: 10px 0 5px 10px;background-attachment: local}.blockcode ol{overflow-x: unset!important;}.hljs{display:unset;}.pl .blockcode ol{margin: 0 0 0px -10px!important;padding: 0 0 0px 20px !important;}.pl .blockcode ol li:hover {background-color: #00000010;color: #666;}.pl .blockcode ol li {margin-left: 23px;min-width: fit-content;padding-right: 10px;}.pl .blockcode em {display: block;margin-top: 5px;}</style>"); } if (conf.fixTableLayout) { jq("head").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) { jq(document).ready(function () { 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("head").append("<style id=\"GoToTopButton\">#scrolltop{bottom: 270px!important;visibility:visible;overflow-x:hidden;width:75px;}.scrolltopa{transition-duration:.15s;margin-left:-40px;opacity:0;}.scrolltopashow{margin-left:0px;opacity:1;}</style>"); showTopLink = function () { var ft = $('ft'); if (ft) { var scrolltop = $('scrolltop'); var scrolltopbtn = jq(".scrolltopa"); var viewPortHeight = parseInt(document.documentElement.clientHeight); var scrollHeight = parseInt(document.body.getBoundingClientRect().top); var basew = parseInt(ft.clientWidth); var sw = scrolltop.clientWidth; 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 (scrollHeight < -100) { scrolltopbtn.addClass("scrolltopashow"); } else { scrolltopbtn.removeClass("scrolltopashow"); } } } showTopLink(); } if (conf.pinnedTopBar) { jq("head").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("head").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!important;}#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>"); var __extstyle = extstyle; extstyle = function(style){ __extstyle(style); jq("#fixTopBarPopMenuWinter").remove(); if(style == "./template/mcbbs/style/winter"){ jq("head").append("<style id=\"fixTopBarPopMenuWinter\">.user_info_menu_info li a.rank {background-color: #5c8dff!important;}ul.user_info_menu_btn>li>a:hover,#myprompt_menu>li>a:hover, #usertools_menu>li>a:hover {background: #5c8dff!important;}</style>"); } } var theme = getcookie('extstyle'); if(theme == "./template/mcbbs/style/winter"){ jq("head").append("<style id=\"fixTopBarPopMenuWinter\">.user_info_menu_info li a.rank {background-color: #5c8dff!important;}ul.user_info_menu_btn>li>a:hover,#myprompt_menu>li>a:hover, #usertools_menu>li>a:hover {background: #5c8dff!important;}</style>"); } } if (conf.hoverPreviewTheme) { jq(document).ready(function () { 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); }); }); } })();