// ==UserScript== // @name MT论坛 // @namespace http://tampermonkey.net/ // @description MT论坛效果增强,如自动签到、自动展开帖子、滚动加载评论、显示uid、屏蔽用户、手机版小黑屋、编辑器优化等 // @version 2.5.6.1 // @author WhiteSevs // @icon https://bbs.binmt.cc/favicon.ico // @match *://bbs.binmt.cc/* // @compatible edge Beta/Dev/Candy 测试通过 // @compatible Yandex 测试通过 // @compatible Kiwi 测试通过 // @license GPL-3.0-only // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_setClipboard // @grant GM_xmlhttpRequest // @grant unsafeWindow // @run-at document-start // @supportURL https://github.com/893177236/Monkey_script // @require https://lf3-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.4.1/jquery.min.js // @require https://unpkg.com/any-touch/dist/any-touch.umd.min.js // @require https://greasyfork.org/scripts/449471-viewer/code/Viewer.js?version=1081056 // @require https://greasyfork.org/scripts/449512-xtiper/code/Xtiper.js?version=1081249 // @require https://greasyfork.org/scripts/449562-nzmsgbox/code/NZMsgBox.js?version=1082044 // @require https://greasyfork.org/scripts/452322-js-watermark/code/js-watermark.js // @downloadURL none // ==/UserScript== (function () { 'use strict'; const log = { success: (str) => { console.log("%c" + str, "color: #00a5ff"); }, error: (str) => { console.trace("%c" + str, "color: #f20000"); } } function tryCatch(func, params, errorFunc) { /* 捕获错误 */ let ret = null; try { if (typeof func == "string") { ret = window.eval(func); } else { if (params == null) { ret = func(); } else { ret = func(params); } } } catch (error) { console.log("%c" + (func.name ? func.name : func + "出现错误"), "color: #f20000"); console.log("%c" + ("错误原因:" + error), "color: #f20000"); console.trace(func); window.eval(errorFunc); } finally { return ret; } } const popup2 = { /* 自定义新的popup */ config: { mask: { zIndex: 1000000, style: `#force-mask{ width: 100%; height: 100%; position: fixed; top: 0px; left: 0px; background: black; opacity: 0.6; z-index: 1000000; display: flex; align-content: center; justify-content: center; align-items: center; }`, }, confirm: { zIndex: 1000100, style: ` #popup2-confirm .popup2-confirm-cancel, #popup2-confirm .popup2-confirm-ok{ user-select: none }`, }, toast: { zIndex: 1100000, style: `.popup2-toast{ width: fit-content; padding: 10px 16px; color: #fff; background: rgba(0,0,0,0.65); position: fixed; margin: 0 auto; left: 0; right: 0; bottom: 0; border-radius: 4px; font-size: 14px; z-index: 1100000; max-width: 80vw; opacity: 1; -webkit-box-sizing: content-box; -moz-box-sizing: content-box; box-sizing: content-box; -webkit-backface-visibility: hidden; -webkit-font-smoothing: antialiased/subpixel-antialiased; touch-action: pan-y; -webkit-user-select: none; transform: translateY(160px); } .popup2-toast-show{ transform: translateY(-80px) !important; transition: all 0.2s ease 0s; -webkit-transition: all 0.2s ease 0s; }`, } }, init: () => { Object.keys(popup2.config).forEach(function (key) { let style = popup2.config[key].style; if (style != "") { GM_addStyle(style); } }) }, force_mask_init: function () { document.documentElement.style.overflow = 'hidden'; if (!$jq("#force-mask").length) { $jq('body').append($jq('
')); } else { $jq("#force-mask").html(""); } }, confirm: function (param_options) { let options = { "text": "Call By popup2.confirm", "callback": () => { popup2.confirm_close(); }, "btnReverse": false, "mask": true, "only": true, "btnCancelText": "取消", "btnOkText": "确定", "btnOther": { "enable": false, "text": "其它方式", "callback": () => { popup2.confirm_close(); } } } if (typeof param_options == "string") { options.text = param_options; } else { for (var key in options) { if (typeof param_options[key] !== "undefined") { options[key] = param_options[key]; } } } let bottomBtnHTML = ""; let confirmHTML = ""; if (!options.btnReverse) { bottomBtnHTML = `${options.btnCancelText} ${options.btnOkText} `; } else { bottomBtnHTML = `${options.btnOkText} ${options.btnCancelText} `; } confirmHTML = `
${options.text}
${bottomBtnHTML}
`; if (options.only) { this.confirm_close(); } let jqConfirmHTML = $jq(confirmHTML); if (options.btnOther.enable) { jqConfirmHTML.find("dd.b_t .popup2-confirm-bottom-btn").after($jq(`
${options.btnOther.text}
`)); jqConfirmHTML.find(".popup2-confirm-other").on("click", function () { tryCatch(options.btnOther.callback); }); } $jq("body").append(jqConfirmHTML); $jq(`#popup2-confirm a:contains('${options.btnOkText}')`).on("click", () => { tryCatch(options.callback); }) if (options.mask) { this.mask_show(); } else { this.mask_close(); } }, toast: (param_options) => { let options = { "text": "Call By popup2.toast", "only": true, "delayTime": 2000 } if (typeof param_options == "string") { options.text = param_options; } else { for (var key in options) { if (typeof param_options[key] !== "undefined") { options[key] = param_options[key]; } } } if (options.only) { popup2.toast_close(); } let toastobj = $jq(`
${options.text}
`); $jq('body').append(toastobj); toastobj.css("transform", `matrix(1, 0, 0, 1, 0, ${toastobj.outerHeight() > 80 ? toastobj.outerHeight()+80 : 80})`); setTimeout(() => { toastobj.addClass("popup2-toast-show"); setTimeout(() => { popup2.toast_close(toastobj); }, options.delayTime); }, 150); }, mask_show: function () { this.force_mask_init(); $jq('#force-mask').show(); }, mask_loading_show: function () { this.force_mask_init(); $jq('#force-mask').html(``).show(); }, mask_close: function () { $jq('#force-mask').html("").hide(); document.documentElement.style.overflow = 'auto'; }, toast_close: (toastobj) => { if (toastobj) { toastobj.remove(); } else { $jq(".popup2-toast").remove(); } }, confirm_close: function () { this.mask_close(); $jq.each($jq(".popup2-popmenu"), function (index, obj) { $jq(obj).remove(); }); } }; let xtips = { /* 因xtip的消息函数会重复显示,自定义一个 */ value: [], toast: (text, options) => { xtips.value.forEach(item => { xtip.close(item); }) xtips.value = []; let xtip_toast_id = null; if (options == null) { xtip_toast_id = xtip.msg(text); } else { xtip_toast_id = xtip.msg(text, options); } xtips.value = xtips.value.concat(xtip_toast_id); } } let mt_config = { dom_obj: { beauty_select: function () { /* 下拉列表对象 */ return document.getElementsByClassName("beauty-select")[0]; }, combobox_switch: function () { /* 复选框对象 */ return document.getElementsByClassName("whitesevcheckbox")[0]; }, comiis_verify: function () { /* 帖子内各个人的信息节点【list】 */ return document.getElementsByClassName("comiis_verify"); }, comiis_formlist: function () { /* 导航中最新、热门、精华、恢复、抢沙发的各个帖子【list】 */ return document.getElementsByClassName("forumlist_li"); }, comiis_mmlist: function () { return document.getElementsByClassName("comiis_mmlist"); }, comiis_postli: function () { /* 帖子内评论,包括帖子内容主体,第一个就是主体【list】 */ return document.getElementsByClassName("comiis_postli comiis_list_readimgs nfqsqi") }, post_bottom_controls: function () { /* 帖子底部一栏控件 */ return document.getElementsByClassName("comiis_znalist_bottom b_t cl") }, post_list_of_comments: function () { /* 帖子内评论列表 */ return $jq(".comiis_postlist.kqide"); }, post_next_commect: function () { /* 帖子内评论下一页的按钮 */ return document.querySelector("div.comiis_page.bg_f>a:nth-child(3)"); } }, rexp: { bbs: /bbs.binmt.cc/, /* 论坛 */ search_url: /bbs.binmt.cc\/search.php/g, /* 搜索页 */ chat_url: /home.php\?mod=space&do=pm&subop=view/g, /* 聊天页 */ home_url: /home.php\?mod=spacecp&ac=profile&op=info/g, /* 个人空间页 */ home_url_brief: /home.php\?mod=space/g, /* 个人空间页简略url */ home_url_at: /bbs.binmt.cc\/space-uid-/g, /* 个人空间页的@点进去 */ home_kmisign_url: /bbs.binmt.cc\/(forum.php\?mod=guide&view=hot(|&mobile=2)|k_misign-sign.html)/g, /* 主页和签到页链接 */ home_space_url: /bbs\.binmt\.cc\/home\.php\?mod=space&do=profile&mycenter/g, /* 【我的】 个人信息页链接 */ home_space_pc_uid_url: /space-uid-(.*?).html/, /* PC 个人空间链接uid */ reply_forum: /bbs.binmt.cc\/forum.php\?mod=post&action=reply/g, /* 回复的界面url */ sign_url: "", navigation_url: "", community_url: /forum.php\?forumlist/, /* 社区 */ forum_post: /(bbs.binmt.cc\/thread-|bbs.binmt.cc\/forum.php\?mod=viewthread)/g, /* 帖子链接 */ forum_post_pc: /.*:\/\/bbs.binmt.cc\/thread.*/, /* 帖子链接-PC */ forum_guide_url: /bbs.binmt.cc\/forum.php\?mod=guide/g, /* 导航链接 */ forum_post_reply: /forum.php\?mod=post&action=reply/g, /* 帖子中回复的链接 */ forum_post_page: '&page=(.*)', /* 帖子链接的当前所在页 page */ forum_post_pc_page: 'thread-(.*?)-', /* PC帖子链接的当前所在页 page */ forum_plate_text: /休闲灌水|求助问答|逆向教程|资源共享|综合交流|编程开发|玩机教程|建议反馈/g, /* 各版块名称 */ plate_url: /bbs.binmt.cc\/forum-[0-9]{1,2}-[0-9]{1,2}.html/g, /* 板块链接 */ formhash: /formhash=(.*)&/, hash: /hash=(.+)&/, /* 论坛账号的凭证 */ font_special: /|<\/font>|||||align=".*?"|
[\s]*
[\s]*
/g, /* 帖子内特殊字体格式 */ forum_post_guide_url: /bbs.binmt.cc\/page-[1-5].html|bbs.binmt.cc\/forum.php\?mod=guide/g, /* 帖子链接和导航链接 */ mt_uid: /uid=(\d+)/, nologin: /member.php\?mod=logging&action=login(|&mobile=2)/g, /* 未登录 */ pc_useragent: 'Windows', /* pc识别 */ k_misign_sign: "bbs.binmt.cc\/k_misign-sign.html", post_forum: /forum.php\?mod=post&action=newthread/, /* 发布帖子 */ edit_forum: /forum.php\?mod=post&action=edit/, /* 编辑帖子 */ }, GMRunStartTime: Date.now() } /* mt全屏遮罩调用 popup.open(''); 关闭方式 popup.close() */ let utils = { formatDateStrToStamp(datastring) { /* 把字符串格式的时间(完整,包括日期和时间)格式化成时间戳 */ let date = datastring; date = date.substring(0, 19); date = date.replace(/-/g, '/'); let timestamp = new Date(date).getTime(); /* let newDate = new Date(timestamp); */ return timestamp; }, formatTimeStrToStamp(timestring) { /* 字符串格式的时间(只有时间,没有日期)格式化成时间戳 */ let today = new Date(); let date = today.getFullYear() + "-" + (today.getMonth() + 1) + "-" + today.getDate() + " " + timestring; date = date.substring(0, 19); date = date.replace(/-/g, '/'); let timestamp = new Date(date).getTime(); /* let newDate = new Date(timestamp); */ return timestamp }, sortListByProperty(propertyName, model) { /* 数组按照内部某个值的大小比对排序,如[{"time":"2022-1-1"},{"time":"2022-2-2"}] */ return function (after_obj, before_obj) { var beforeValue = before_obj[propertyName]; /* 前 */ var aferValue = after_obj[propertyName]; /* 后 */ if (model.toLowerCase() === "desc") { if (aferValue > beforeValue) { return -1 } else if (aferValue < beforeValue) { return 1 } else { return 0 } } else { if (aferValue < beforeValue) { return -1 } else if (aferValue > beforeValue) { return 1 } else { return 0 } } } }, listToStringByValue(_list_, propertyName) { /* 数组根据 字段(int)合并成字符串 */ let content = ""; Array.from(_list_).forEach((item) => { content = content + item[propertyName]; }) return content }, jsonToArray(_json_) { /* json内的值合并到数组里 */ let retArray = []; Object.keys(_json_).forEach(function (key) { retArray = retArray.concat(_json_[key]); }) return retArray; }, jsonStrToObject(_json_str_) { /* json字符串转为json对象 */ return window.eval("(" + _json_str_ + ")"); }, randomArr(items) { /* 随机数组 */ var item = items[Math.floor(Math.random() * items.length)]; return item; }, randbix(n, m) { /* 随机小数点 */ bix = Math.random().toFixed(2); num = Number(utils.randomNum(n, m)) + Number(bix); r2 = utils.randomNum(2, 10); return num.toFixed(r2); }, randomNum(n, m) { /* 随机数字 */ var rander = Math.round(Math.random() * (m - n)) + n; return rander; }, getFormatTime(formatStr) { /* 获取自定义格式化时间, yyyy-MM-dd HH:mm:ss 2022-08-21 23:59:00 */ /** * yyyy 年 * MM 月 * dd 天 * HH 时 (24小时制) * hh 时 (12小时制) * mm 分 * ss 秒 */ function checkTime(i) { if (i < 10) return "0" + i; return i; } function timeSystemChange(_hour_) { /* 时间制修改 24小时制转12小时制 */ return _hour_ > 12 ? _hour_ - 12 : _hour_; } var time = new Date(); var yyyy = time.getFullYear(); /* 获取 年 */ var MM = checkTime(time.getMonth() + 1); /* 获取 月 */ var dd = checkTime(time.getDate()); /* 获取 日 */ var HH = checkTime(time.getHours()); /* 获取 时 (24小时制) */ var hh = checkTime(timeSystemChange(time.getHours())); /* 获取 时 (12小时制) */ var mm = checkTime(time.getMinutes()); /* 获取 分 */ var ss = checkTime(time.getSeconds()); /* 获取 秒 */ /****当时、分、秒、小于10时,则添加0****/ formatStr = formatStr.replace(/yyyy/g, yyyy); formatStr = formatStr.replace(/MM/g, MM); formatStr = formatStr.replace(/dd/g, dd); formatStr = formatStr.replace(/HH/g, HH); formatStr = formatStr.replace(/hh/g, hh); formatStr = formatStr.replace(/mm/g, mm); formatStr = formatStr.replace(/ss/g, ss); return formatStr; }, checkClickInDOM(obj) { /* 检测点击范围是否在该元素区域内 */ var x = Number(window.event.clientX) /* 鼠标相对屏幕横坐标 */ var y = Number(window.event.clientY) /* 鼠标相对屏幕纵坐标 */ var obj_x_left = Number(obj.getBoundingClientRect().left) /* obj相对屏幕的横坐标 */ var obj_x_right = Number( obj.getBoundingClientRect().left + obj.clientWidth ) /* obj相对屏幕的横坐标+width */ var obj_y_bottom = Number( obj.getBoundingClientRect().top + obj.clientHeight ) /* obj相对屏幕的纵坐标+height */ var obj_y_top = Number(obj.getBoundingClientRect().top) /* obj相对屏幕的纵坐标 */ if ((x >= obj_x_left && x <= obj_x_right && y >= obj_y_top && y <= obj_y_bottom) || obj.outerHTML.indexOf(window.event.target.innerHTML) != -1) { return true } else { return false } }, asyncSetTimeOut(fnStr, delayTime) { /* 同步执行延时函数 */ return new Promise(res => { setTimeout(() => { let ret = tryCatch(fnStr); res(ret); }, delayTime); }) }, asyncArrayForEach(array_data, array_func, completeRunFunc) { /* 同步执行foreach函数 */ Promise.all( Array.from(array_data).map(async (item, index) => { await tryCatch(array_func, [index, item]); }) ).then(() => { tryCatch(completeRunFunc); return null; }) }, sleep(delayTime) { /* 暂停执行xx毫秒,需要await */ return new Promise(res => { setTimeout(() => { res(); }, delayTime); }) }, cookie: () => { /*! js-cookie v3.0.1 | MIT */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : (global = global || self, (function () { var current = global.Cookies; var exports = global.Cookies = factory(); exports.noConflict = function () { global.Cookies = current; return exports; }; }())); }(this, (function () { 'use strict'; /* eslint-disable no-var */ function assign(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { target[key] = source[key]; } } return target } /* eslint-enable no-var */ /* eslint-disable no-var */ var defaultConverter = { read: function (value) { if (value[0] === '"') { value = value.slice(1, -1); } return value.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent) }, write: function (value) { return encodeURIComponent(value).replace( /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent ) } }; /* eslint-enable no-var */ /* eslint-disable no-var */ function init(converter, defaultAttributes) { function set(key, value, attributes) { if (typeof document === 'undefined') { return } attributes = assign({}, defaultAttributes, attributes); if (typeof attributes.expires === 'number') { attributes.expires = new Date(Date.now() + attributes.expires * 864e5); } if (attributes.expires) { attributes.expires = attributes.expires.toUTCString(); } key = encodeURIComponent(key) .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent) .replace(/[()]/g, escape); var stringifiedAttributes = ''; for (var attributeName in attributes) { if (!attributes[attributeName]) { continue } stringifiedAttributes += '; ' + attributeName; if (attributes[attributeName] === true) { continue } /* Considers RFC 6265 section 5.2: ... 3. If the remaining unparsed-attributes contains a %x3B (";") character: Consume the characters of the unparsed-attributes up to, not including, the first %x3B (";") character. ... */ stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]; } return (document.cookie = key + '=' + converter.write(value, key) + stringifiedAttributes) } function get(key) { if (typeof document === 'undefined' || (arguments.length && !key)) { return } /* To prevent the for loop in the first place assign an empty array in case there are no cookies at all. */ var cookies = document.cookie ? document.cookie.split('; ') : []; var jar = {}; for (var i = 0; i < cookies.length; i++) { var parts = cookies[i].split('='); var value = parts.slice(1).join('='); try { var foundKey = decodeURIComponent(parts[0]); jar[foundKey] = converter.read(value, foundKey); if (key === foundKey) { break } } catch (e) {} } return key ? jar[key] : jar } return Object.create({ set: set, get: get, remove: function (key, attributes) { set( key, '', assign({}, attributes, { expires: -1 }) ); }, withAttributes: function (attributes) { return init(this.converter, assign({}, this.attributes, attributes)) }, withConverter: function (converter) { return init(assign({}, this.converter, converter), this.attributes) } }, { attributes: { value: Object.freeze(defaultAttributes) }, converter: { value: Object.freeze(converter) } }) } var api = init(defaultConverter, { path: '/' }); /* eslint-enable no-var */ return api; }))) }, /* base64转blob */ base64ToBlob: function (dataurl) { var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); while (n--) { u8arr[n] = bstr.charCodeAt(n); } return new Blob([u8arr], { type: mime }); }, /* base64转File */ base64ToFile(dataurl, filename) { var arr = dataurl.split(','), mime = arr[0].match(/:(.*?);/)[1], bstr = atob(arr[1]), n = bstr.length, u8arr = new Uint8Array(n); while (n--) { u8arr[n] = bstr.charCodeAt(n); } return new File([u8arr], filename, { type: mime }); }, /* blob转file */ blobToFile: function (theBlob, fileName) { theBlob.lastModifiedDate = new Date(); theBlob.name = fileName; return theBlob; }, /* file转base64 */ asyncFileToBase64(file) { let reader = new FileReader(); reader.readAsDataURL(file); return new Promise(res => { reader.onload = function (e) { res(e.target.result); } }) }, /* 下载base64格式的数据 */ downloadBase64(fileName, base64Content) { let aLink = document.createElement('a') let blob = utils.base64ToBlob(base64Content) // new Blob([content]); let evt = document.createEvent('HTMLEvents') evt.initEvent('click', true, true) // initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为 aLink.download = fileName aLink.href = URL.createObjectURL(blob) // aLink.dispatchEvent(evt); aLink.click() } } function envCheck() { /* 脚本运行环境修复,兼容部分函数 GM_xmlhttpRequest x浏览器进行了兼容,调用方式为GM.xmlHttpRequest,但会检测是否同源请求,所以不可修改headers */ let checkStatus = true; let isFailedFunction = []; console.log("正在检测脚本环境..."); if (typeof $ != 'undefined') { window.$jq = $.noConflict(true); /* 为什么这么写,X浏览器加载jq会替换网页上的jq */ console.log(`check: %c $jq %c √ jQuery版本:${$jq.fn.jquery}`, "background:#24272A; color:#ffffff", "color:#00a5ff"); if ($jq.fn.jquery != "3.4.1") { console.log("jQuery加载错误,如果是非油猴加载本脚本方式,请放到网页加载完毕后执行"); return false; } if (typeof jQuery != 'undefined') { console.log(`check: %c $ %c √ 网站的jQuery版本:${$.fn ? $.fn.jquery : jQuery.fn.jquery}`, "background:#24272A; color:#ffffff", "color:#00a5ff"); } } else { checkStatus = false; isFailedFunction = isFailedFunction.concat("GM_xmlhttpRequest"); console.log("check: %c $ %c ×", "background:#24272A; color:#ffffff", "color:#f90000"); } if (typeof GM_xmlhttpRequest == "undefined") { if (typeof GM != "undefined" && typeof GM.xmlHttpRequest != "undefined") { window.GM_xmlhttpRequest_isRepair = false; window.GM_xmlhttpRequest = (param) => { GM.xmlHttpRequest(param); }; console.log("check: %c GM_xmlhttpRequest %c √ 替换成当前环境的GM中", "background:#24272A; color:#ffffff"); } else { window.GM_xmlhttpRequest_isRepair = true; isFailedFunction = isFailedFunction.concat("GM_xmlhttpRequest"); console.log(`check: %c GM_xmlhttpRequest %c 修复,该函数不存在,替换成ajax`, "background:#24272A; color:#ffffff", "background:#fff;"); window.GM_xmlhttpRequest = (f) => { console.log(`$jq.ajax请求 url: ${f.url}`); console.log(f); let headers_options = {}; let headers_options_key = [ "Accept-Charset", "Accept-Encoding", "Access-Control-Request-Headers", "Access-Control-Request-Method", "Connection", "Content-Length", "Cookie", "Cookie2", "Date", "DNT", "Expect", "Host", "Keep-Alive", "Origin", "Referer", "TE", "Trailer", "Transfer-Encoding", "Upgrade", "User-Agent", "Via" ]; if (f.headers != null) { Array.from(headers_options_key).forEach(item => { delete f.headers[item] }) } else { f.headers = {}; } $jq.ajax({ url: f.url, type: f.method, data: f.data, timeout: f.timeout, dataType: f.responseType, headers: headers_options, success: (r) => { f.onload(r) }, error: (r) => { if (r.status == 200) { f.onload(r) } else { f.onerror(r); } } }) } } } else { window.GM_xmlhttpRequest_isRepair = false; console.log("check: %c GM_xmlhttpRequest %c √", "background:#24272A; color:#ffffff", "color:#00a5ff"); } var loadNetworkResource = []; window.GM_asyncLoadScriptContent = (url, replaceStatus) => { /* 异步执行跨域js资源 js */ if (loadNetworkResource.indexOf(url) != -1) { console.log("已加载该js:", url); return } replaceStatus = replaceStatus == null ? true : replaceStatus; return new Promise(res => { GM_xmlhttpRequest({ url: url, method: "GET", async: false, timeout: 10000, onload: (r) => { let execStatus = false; let retText = r.responseText; if (replaceStatus) { retText = retText.replace(/\$/g, "$jq"); retText = retText.replace(/jQuery/g, "$jq"); } try { eval(retText); execStatus = true; loadNetworkResource = loadNetworkResource.concat(url); } catch (error) { console.log("eval执行失败" + error); execStatus = false; } /* try { window.eval(retText); execStatus = true; loadNetworkResource = loadNetworkResource.concat(url); }catch (error) { console.log("window.eval执行失败 " + error); execStatus = false; }*/ res(execStatus); }, onerror: () => { console.log("网络异常,加载JS失败", url); res(false); } }) }) } window.GM_asyncLoadScriptNode = (url) => { return new Promise(res => { let tempNode = document.createElement("script"); tempNode.setAttribute("src", url); document.head.append(tempNode); tempNode.onload = () => { res(); } }) } window.GM_asyncLoadStyleSheet = (url) => { /* 异步添加跨域css资源 */ if (loadNetworkResource.indexOf(url) != -1) { console.log("已加载该css:", url); return } loadNetworkResource = loadNetworkResource.concat(url); let cssNode = document.createElement("link"); cssNode.setAttribute("rel", "stylesheet"); cssNode.setAttribute("href", url); cssNode.setAttribute("type", "text/css"); document.head.append(cssNode); } if (typeof GM_getValue == "undefined") { window.GM_getValue = (key, defaultValue) => { let value = window.localStorage.getItem(key); if (typeof value == "string" && value.trim() != String()) { value = JSON.parse(value); } else if (defaultValue != null) { value = defaultValue; } return value }; console.log("check: %c GM_getValue %c √ 修复", "background:#24272A; color:#ffffff", "color:#00a5ff"); } else { console.log("check: %c GM_getValue %c √", "background:#24272A; color:#ffffff", "color:#00a5ff"); } if (typeof GM_setValue == "undefined") { window.GM_setValue = (key, value) => { window.localStorage.setItem(key, JSON.stringify(value)); }; console.log("check: %c GM_setValue %c √ 修复", "background:#24272A; color:#ffffff", "color:#00a5ff"); } else { console.log("check: %c GM_setValue %c √", "background:#24272A; color:#ffffff", "color:#00a5ff"); } if (typeof GM_deleteValue == "undefined") { window.GM_deleteValue = (key) => { window.localStorage.removeItem(key); }; console.log("check: %c GM_deleteValue %c √ 修复", "background:#24272A; color:#ffffff", "color:#00a5ff"); } else { console.log("check: %c GM_deleteValue %c √", "background:#24272A; color:#ffffff", "color:#00a5ff"); } if (typeof GM_addStyle == "undefined") { window.GM_addStyle = (styleText) => { let cssDOM = document.createElement("style"); cssDOM.setAttribute("type", "text/css"); cssDOM.innerHTML = styleText; document.head.appendChild(cssDOM); return cssDOM; }; console.log("check: %c GM_addStyle %c √ 修复", "background:#24272A; color:#ffffff", "color:#00a5ff"); } else { console.log("check: %c GM_addStyle %c √", "background:#24272A; color:#ffffff", "color:#00a5ff"); } if (typeof GM_setClipboard == "undefined") { window.GM_setClipboard = (text) => { let clipBoardDOM = document.createElement("input"); clipBoardDOM.type = "text"; clipBoardDOM.setAttribute("style", "opacity:0;position:absolute;"); clipBoardDOM.id = "whitesevClipBoardInput"; document.body.append(clipBoardDOM); let clipBoardInputNode = document.getElementById("whitesevClipBoardInput"); clipBoardInputNode.value = text; clipBoardInputNode.removeAttribute("disabled"); clipBoardInputNode.select(); document.execCommand('copy'); clipBoardInputNode.remove(); }; console.log("check: %c GM_setClipboard %c √ 修复", "background:#24272A; color:#ffffff", "color:#00a5ff"); } else { console.log("check: %c GM_setClipboard %c √", "background:#24272A; color:#ffffff", "color:#00a5ff"); } if (typeof unsafeWindow == "undefined") { window.unsafeWindow = window; console.log("check: %c unsafeWindow %c √ 修复", "background:#24272A; color:#ffffff", "color:#00a5ff"); } else { console.log("check: %c unsafeWindow %c √", "background:#24272A; color:#ffffff", "color:#00a5ff"); } if (checkStatus) { console.log(`脚本环境检测结果: 通过`); } else { let isFailedStr = ""; Array.from(isFailedFunction).forEach(item => { isFailedStr += (item + "、"); }) isFailedStr = isFailedStr.replace(/、$/, '') console.log(`脚本环境检测结果: ${isFailedStr}失败`); } return checkStatus; } const pc = { collectionForumPost() { /* 悬浮按钮-添加收藏帖子功能 */ if (!window.location.href.match(mt_config.rexp.forum_post)) { return; } var own_formhash = document.querySelector("#scform > input[type=hidden]:nth-child(1)").value; var collect_href_id = window.location.href.match(mt_config.rexp.forum_post_pc_page)[1]; var collect_href = 'https:\/\/bbs.binmt.cc\/home.php?mod=spacecp&ac=favorite&type=thread&id=' + collect_href_id + '&formhash=' + own_formhash; var new_collect = document.createElement('span'); var old_Suspended = document.getElementById("scrolltop"); new_collect.innerHTML = '<\/a>'; old_Suspended.insertAdjacentElement('afterBegin', new_collect); }, detectUserOnlineStatus() { /* 探测用户在线状态 */ if (window.location.href.match(mt_config.rexp.forum_post_pc)) { var quanju = []; var cishu = 0; for (var sss = document.getElementsByClassName("pls favatar"), ll = 0; ll < sss.length; ll++) { var sendmessage = sss[ll].getElementsByClassName("comiis_o cl") if (sendmessage.length == 0) {} else { var sendmessageurl = sendmessage[0].getElementsByTagName('a')[1].href; let xhr = new XMLHttpRequest(); xhr.open("GET", sendmessageurl, false); xhr.onreadystatechange = function () { if (xhr.readyState == 4) { let pattern = /正在.*]/g; let str = xhr.responseText; let newstr = str.match(pattern)[0]; quanju.push(newstr); } } xhr.send(); let offLineStaus = quanju[cishu].match('离线') ? true : false; cishu = cishu + 1; var onlineStatusImage = document.createElement('img'); onlineStatusImage.src = offLineStaus ? 'https://cdn-bbs.mt2.cn/static/image/smiley/doge/54.png' : 'https://cdn-bbs.mt2.cn/static/image/smiley/doge/35.png'; onlineStatusImage.smilied = offLineStaus ? '1353' : '1384'; onlineStatusImage.border = "0"; onlineStatusImage.style = 'float:right'; sss[ll].insertAdjacentElement('afterbegin', onlineStatusImage); } } } }, latestReleaseForumPost() { /* 最新发表 */ var latestReleaseNode = $jq(`
  • 最新发表
  • `); $jq("#comiis_nv .wp.comiis_nvbox.cl ul").append(latestReleaseNode); if (window.location.href == "https://bbs.binmt.cc/forum.php?mod=guide&view=newthread") { $jq("#mn_forum_10").removeClass("a"); latestReleaseNode.find("a").css("background", 'url("https://cdn-bbs.mt2.cn/template/comiis_mi/img/nv_a.png") repeat-x 50% -50px'); } }, main() { /* 电脑版函数按顺序加载 */ popup2.toast = (text) => { if (typeof text == "string") { xtips.toast(text); } else { xtips.toast(text.text); } } tryCatch(pc.latestReleaseForumPost); /* tryCatch(pc.detectUserOnlineStatus); */ tryCatch(mobile.identifyLinks); tryCatch(pc.collectionForumPost); tryCatch(pc.quickReply); tryCatch(pc.showUserLevel); tryCatch(mobile.autoSignIn); }, quickReply() { /* 快捷回复 */ if (!window.location.href.match(mt_config.rexp.forum_post)) { return; } document.querySelector("#scrolltop > span:nth-child(2) > a").onclick = function () { showWindow('reply', this.href); setTimeout( 'document.querySelector("#moreconf").innerHTML=document.querySelector("#moreconf").innerHTML+\' `, app: true, success: async (x) => { let localDataUser = lanzou.storage.getUser(); let localDataPwd = lanzou.storage.getPwd(); if (localDataUser != "" && localDataPwd != "") { x.xtipdiv.querySelector(".xinput.xful[type='text']").value = localDataUser; x.xtipdiv.querySelector(".xinput.xful[type='password']").value = localDataPwd; } x.xtipdiv.querySelector(".xbutton.xful.xblue").onclick = async () => { let inputUser = x.xtipdiv.querySelector(".xinput.xful[type='text']").value.trim(); let inputPwd = x.xtipdiv.querySelector(".xinput.xful[type='password']").value.trim(); if (inputUser != "" && inputPwd != "") { xtips.toast("登录中请稍后..."); let _formhash_ = await lanzou.login_getFormHash(inputUser, inputPwd); console.log(_formhash_); if (_formhash_ == 4) { console.log("已登录"); lanzou.storage.setUser(inputUser); lanzou.storage.setPwd(inputPwd); if (lanzou.storage.getFormhash() == null) { console.log("未知原因,已登录但本地未保存formhash,建立临时值"); lanzou.storage.setFormhash(_formhash_); } xtip.close(x.mainid); showView(); return; }; if (_formhash_ == null) { return; }; let loginStatus = await lanzou.login(inputUser, inputPwd, _formhash_); if (loginStatus) { console.log("登录成功"); console.log(inputUser, inputPwd, _formhash_); lanzou.storage.setUser(inputUser); lanzou.storage.setPwd(inputPwd); lanzou.storage.setFormhash(_formhash_); xtip.close(x.mainid); showView(); } } else { xtips.toast('账号或密码不能为空'); } } } }); } async function showLanZouView(user, pwd) { lanZouViewShowLock = false; let sheet = null; let _formhash_ = lanzou.storage.getFormhash(); let loginStatus = await lanzou.login(user, pwd, _formhash_); if (!loginStatus) { xtips.toast("登录过期"); lanzou.storage.delFormhash(); showLoginView(); return; } sheet = xtip.sheet({ btn: [`欢迎! ${user}`, '上传', '查看历史上传'] }); $jq("#lanzouuploadfilebtn").off("change").change(async (e) => { let lanzouChooseFile = e.currentTarget.files[0]; console.log(lanzouChooseFile); let uploadFileInfo = await lanzou.uploadFile(lanzouChooseFile); if (uploadFileInfo) { let tempData = lanzou.storage.getUploadFiles(); tempData = tempData.concat(uploadFileInfo); GM_setClipboard(`${uploadFileInfo["is_newd"]}/${uploadFileInfo["f_id"]}`); xtips.toast("已复制到剪贴板"); console.log(tempData); lanzou.storage.setUploadFiles(tempData); } }) let anyTouchNode = new AnyTouch(document.getElementById(sheet)); anyTouchNode.on("tap", (e) => { if (document.getElementById(sheet).querySelector(".xtiper_bg").outerHTML.indexOf(e.target.outerHTML) != -1) { /* 点击背景不关闭小窗 */ return; } if (document.querySelectorAll(".xtiper_sheet_ul.xtiper_sheet_center .xtiper_sheet_li")[0].outerHTML.indexOf(e.target.outerHTML) != -1) { /* 用户 */ xtip.confirm('确定退出登录吗?', { btn1: async function () { let logoutStatus = await lanzou.outLogin(lanzou.storage.getUser()); if (logoutStatus) { xtips.toast("退出登录成功"); lanzou.storage.delFormhash(); anyTouchNode.off("tap"); xtip.close(sheet); lanZouViewShowLock = false; } else { xtips.toast("退出登录失败"); } } }); return; } if (document.querySelectorAll(".xtiper_sheet_ul.xtiper_sheet_center .xtiper_sheet_li")[1].outerHTML.indexOf(e.target.outerHTML) != -1) { /* 上传 */ $jq("#lanzouuploadfilebtn").val(""); $jq("#lanzouuploadfilebtn").click(); return; } if (document.querySelectorAll(".xtiper_sheet_ul.xtiper_sheet_center .xtiper_sheet_li")[2].outerHTML.indexOf(e.target.outerHTML) != -1) { /* 查看历史上传 */ anyTouchNode.off("tap"); xtip.close(sheet); showUploadFiles(); return; } if (document.querySelectorAll(".xtiper_sheet_ul.xtiper_sheet_center .xtiper_sheet_li")[3].outerHTML.indexOf(e.target.outerHTML) != -1) { /* 取消 */ anyTouchNode.off("tap"); xtip.close(sheet); lanZouViewShowLock = false; return; } }) } async function showView() { let user = lanzou.storage.getUser(); let pwd = lanzou.storage.getPwd(); let formhash = lanzou.storage.getFormhash(); if (user == "" || pwd == "" || formhash == null) { showLoginView(); } else { showLanZouView(user, pwd); } } function insertBtn() { let comiis_left_Touch = document.createElement("li"); comiis_left_Touch.className = "comiis_left_Touch"; let ANode = document.createElement("a"); ANode.setAttribute("href", "javascript:;"); ANode.className = "blacklist"; ANode.innerHTML = `
    蓝奏云
    `; ANode.onclick = () => { if (!lanZouViewShowLock) { showView(); lanZouViewShowLock = true; } else { console.log("重复点击"); } } comiis_left_Touch.append(ANode); $jq(".comiis_sidenv_box .sidenv_li .comiis_left_Touch.bdew").append(comiis_left_Touch); } insertBtn(); }, async loadCheckboxTipResource() { /* 加载checkbox值变化的显示的提示的资源 */ await GM_asyncLoadScriptContent("https://whitesev.gitee.io/static_resource/ios_loading/js/iosOverlay.js"); await GM_asyncLoadStyleSheet("https://whitesev.gitee.io/static_resource/ios_loading/css/iosOverlay.css"); }, loadNextComments() { /* 加载下一页的评论 */ function autoLoadNextPageComments(post_comments_list) { /* 自动加载下一页的评论 */ $jq("#loading-comment-tip")[0].parentElement.style.display = ""; let next_page_url = post_comments_list.children[2].href; let isloding_flag = false; console.log("预设,获取下一页url:", next_page_url); if (next_page_url.indexOf("javascript:;") != -1) { console.log(post_comments_list); console.log("无多页评论"); $jq("#loading-comment-tip")[0].parentElement.style.display = "none"; return; } function _loadNextComments_() { if (isloding_flag == false) { isloding_flag = true; $jq("#loading-comment-tip").text("正在加载评论中..."); $jq("#loading-comment-tip")[0].parentElement.style.display = ""; let _url_ = next_page_url; $jq.get(_url_, function (data, status, xhr) { console.log("正在请求的下一页url", _url_); let postlist = $jq(data); let kqideSourceNode = $jq(".comiis_postlist.kqide"); let postDOM = postlist.find(".comiis_postlist.kqide").html(); let get_next_page_url = postlist.find(".nxt"); if (get_next_page_url.length != 0) { console.log("成功获取到下一页-评论"); next_page_url = get_next_page_url.attr("href"); let newURL = new URL(_url_); let setLocationUrl = `${newURL.pathname}${newURL.search}`; console.log("设置当前的url为请求的下一页url", window.location.origin + setLocationUrl); window.history.pushState('forward', null, setLocationUrl); $jq("#loading-comment-tip")[0].parentElement.style.display = "none"; } else { console.log("评论全部加载完毕,关闭监听事件"); let newURL = new URL(next_page_url); let setLocationUrl = `${newURL.pathname}${newURL.search}`; console.log("设置当前的url为请求的最后一页url", setLocationUrl); window.history.pushState('forward', null, setLocationUrl); $jq(".comiis_page.bg_f").remove(); $jq("#loading-comment-tip").text("已加载完所有评论"); $jq("#loading-comment-tip")[0].parentElement.style.display = ""; $jq("#loading-comment-tip").off("click", _loadNextComments_); $jq(window).off("scroll", scroll_loadNextComments); } isloding_flag = false; kqideSourceNode.append(postDOM); mobile.needRepeatLoadingJSResource(); }) } else { console.log("正在加载中请稍后"); } } function scroll_loadNextComments() { if (Math.ceil($jq(window).scrollTop() + $jq(window).height() + 150) >= $jq(document).height()) { /* load data */ _loadNextComments_(); } } $jq(window).on("scroll", scroll_loadNextComments); $jq("#loading-comment-tip").text("请上下滑动或点击加载"); $jq("#loading-comment-tip").on("click", _loadNextComments_); } if (GM_getValue("v21") && window.location.href.match(mt_config.rexp.forum_post) && document.title.indexOf("提示信息 - MT论坛") == -1) { let tip_html = `
    `; $jq(".comiis_bodybox").append($jq(tip_html)); let commentsEle = document.querySelector(".comiis_pltit span.f_d") || document.querySelector("#comiis_foot_memu .comiis_kmvnum"); if (document.querySelector(".comiis_pltit h2") && document.querySelector(".comiis_pltit h2").textContent.indexOf("暂无评论") != -1) { console.log("暂无评论"); $jq("#loading-comment-tip")[0].parentElement.style.display = "none"; return; } let commentsNum = parseInt(commentsEle.textContent); if (commentsNum >= 10) { let setAutoLoadInterval = setInterval(function () { let post_comments_list = document.querySelector(".comiis_page.bg_f"); /* 评论列表 */ if (post_comments_list) { autoLoadNextPageComments(post_comments_list); clearInterval(setAutoLoadInterval); } else { console.log("正在等待下一页列表元素出现"); } }, 500) } else { console.log("无多页评论"); $jq("#loading-comment-tip")[0].parentElement.style.display = "none"; } } }, loadPrevComments() { /* 加载上一页的评论 */ function autoLoadPrevPageComments() { /* 自动加载上一页的评论 */ let post_comments_list = document.querySelector(".comiis_page.bg_f"); let prev_page_url = post_comments_list.children[0].href; let isloding_flag = false; console.log("预设,获取上一页url:", prev_page_url); $jq("#loading-comment-tip-prev").text("请上下滑动或点击加载"); $jq("#loading-comment-tip-prev").on("click", _loadPrevComments_); function _loadPrevComments_() { if (isloding_flag) { console.log("正在加载上一页中请稍后"); } else { isloding_flag = true; $jq("#loading-comment-tip-prev").text("正在加载评论中..."); $jq("#loading-comment-tip-prev")[0].parentElement.style.display = ""; let _url_ = prev_page_url; $jq.get(_url_, function (data, status, xhr) { console.log("正在请求的上一页评论:", prev_page_url); let postlist = $jq(data); let kqideSourceNode = $jq(".comiis_postlist.kqide"); let postDOM = postlist.find(".comiis_postlist.kqide").html(); let get_pregv_page_url = postlist.find(".prev"); if (get_pregv_page_url.length != 0) { console.log("成功获取到上一页-评论"); prev_page_url = get_pregv_page_url.attr("href"); let newURL = new URL(_url_); let setLocationUrl = `${newURL.pathname}${newURL.search}`; console.log("设置当前的url为请求的上一页url", window.location.origin + setLocationUrl); window.history.pushState('forward', null, setLocationUrl); $jq("#loading-comment-tip-prev")[0].parentElement.style.display = "none"; isloding_flag = false; kqideSourceNode.prepend(postDOM); mobile.needRepeatLoadingJSResource(); } else { isloding_flag = false; kqideSourceNode.prepend(postDOM); let newURL = new URL(prev_page_url); let setLocationUrl = `${newURL.pathname}${newURL.search}`; console.log("已到顶页,设置当前的url第一页url", window.location.origin + setLocationUrl); window.history.pushState('forward', null, setLocationUrl); console.log("上一页评论全部加载完毕,关闭监听事件"); let page_title = postlist.find(".comiis_viewtit")[0].outerHTML; console.log($jq(page_title)); kqideSourceNode.prepend($jq(page_title)[0]); mobile.needRepeatLoadingJSResource(); /* $jq(".comiis_page.bg_f").remove(); */ $jq("#loading-comment-tip-prev").remove(); $jq("#loading-comment-tip-prev").off("click", _loadPrevComments_); $jq(window).off("scroll", ); } }) } /* $jq(window).unbind("scroll",_loadPrevComments_); */ } function scroll_loadPrevComments() { if ($jq(window).scrollTop() <= 50) { _loadPrevComments_(); } } $jq(window).on("scroll", scroll_loadPrevComments); } if (GM_getValue("v32") && window.location.href.match(mt_config.rexp.forum_post) && document.title.indexOf("提示信息 - MT论坛") == -1) { if (!document.querySelector(".comiis_pltit span.f_d")) { console.log("当前不在第一页,加载上一页评论"); let tip_html = `
    `; $jq(".comiis_bodybox script")[0].after($jq(tip_html)[0]); if (document.querySelector(".comiis_pltit h2") && document.querySelector(".comiis_pltit h2").textContent.indexOf("暂无评论") != -1) { console.log("暂无上一页评论"); $jq("#loading-comment-tip-prev")[0].parentElement.style.display = "none"; return; } autoLoadPrevPageComments(); } } }, main() { /* 手机版按顺序加载的函数 */ tryCatch(mobile.commentsAddReviews); tryCatch(mobile.recoveryIMGWidth); tryCatch(mobile.identifyLinks); tryCatch(mobile.showUserUID); tryCatch(mobile.previewPictures); tryCatch(mobile.removeForumPostFontStyle); tryCatch(mobile.removeForumPostCommentFontStyle); tryCatch(mobile.autoSignIn); tryCatch(mobile.autoExpendFullTextByForumPost); tryCatch(mobile.searchHistory); tryCatch(mobile.loadNextComments, '', '$jq("#loading-comment-tip").text("加载评论失败")'); tryCatch(mobile.loadPrevComments, '', '$jq("#loading-comment-tip-prev").text("加载评论失败")'); tryCatch(mobile.repairClearSearchInput); tryCatch(mobile.repairUnableToEnterOtherSpaceCorrectly); tryCatch(mobile.chatChartBed); tryCatch(mobile.pageSmallWindowBrowsingForumPost); tryCatch(mobile.codeQuoteCopyBtn); tryCatch(mobile.editorOptimization); tryCatch(mobile.editorOptimizationFull); tryCatch(mobile.shieldUser); tryCatch(mobile.shieldPlate); tryCatch(mobile.userCheckBoxSettings); /* 选项主要界面内容 */ tryCatch(mobile.blackHome.insertMobileBlackHomeButton); tryCatch(mobile.lanzouFunction); tryCatch(mobile.paymentSubjectReminder); tryCatch(mobile.blacklistShieldUsersOrBlocks); tryCatch(mobile.showTodayStar); tryCatch(mobile.showSignInRanking); tryCatch(mobile.pageAfterDOMChangeRunFunction); unsafeWindow.popup2 = popup2; popup2.init(); }, needRepeatLoadingJSResource() { /* 帖子内需要重复执行的js */ tryCatch(mobile.shieldUser); tryCatch(mobile.commentsAddReviews); tryCatch(mobile.identifyLinks); tryCatch(mobile.showUserUID); tryCatch(mobile.previewPictures); tryCatch(mobile.modifyForumPostFontColor); tryCatch(mobile.pageSmallWindowBrowsingForumPost); tryCatch(mobile.codeQuoteCopyBtn); tryCatch(mobile.editorOptimizationOffDefaultBottomReplyBtnClickEvent); popup.init(); }, pageAfterDOMChangeRunFunction() { /* 当本页面动态加载帖子需要重复加载的东西 */ if (window.location.href.match(/bbs.binmt.cc\/forum/) || window.location.href.match(/bbs.binmt.cc\/home.php\?mod=space&do=thread&view=me/) || window.location.href.match(/home.php\?mod=space&uid=.+&do=thread&view=me/)) { function beforeHookRun() { tryCatch(mobile.showUserUID); tryCatch(mobile.previewPictures); tryCatch(mobile.shieldUser); tryCatch(mobile.shieldPlate); tryCatch(mobile.pageSmallWindowBrowsingForumPost); tryCatch(mobile.codeQuoteCopyBtn); } document.body.addEventListener("DOMNodeInserted", (event) => { let ele = event.target; if (ele.className != null && ele.className.indexOf("comiis_forumlist") != -1) { beforeHookRun(); } }) } }, pageSmallWindowBrowsingForumPost() { /* 页面小窗浏览帖子 */ if (!GM_getValue("v45") && ( !(window.location.href.match(mt_config.rexp.forum_guide_url) || !(window.location.href.match(mt_config.rexp.search_url)) ))) { return }; /* if (window != top.window) { console.log("当前在非top里,已禁用初始化小窗"); return; } */ GM_addStyle(` .xtiper_sheet, .xtiper_sheet .xtiper_sheet_tit{ border-radius: 18px 18px 0px 0px; } /* title自定义美化 */ .xtiper_sheet_tit.xtiper_sheet_left{ display: block; background: #fff; width: 100%; box-sizing: border-box; } .xtiper_sheet_tit.xtiper_sheet_left img.xtiper_tit_ico{ background: #fff; filter: invert(100%); width: 24px; height: 24px; align-self: center; } .xtiper_sheet_tit.xtiper_sheet_left .xtiper_tit_content{ margin-left: 22px; width: 215px; } .xtiper_sheet_tit.xtiper_sheet_left .xtiper_tit_content p{ word-wrap: break-word; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .xtiper_sheet_tit.xtiper_sheet_left .xtiper_tit_content .xtiper_tit_svg_lock{ display: flex; align-items: center; } .xtiper_sheet_tit.xtiper_sheet_left .xtiper_tit_content .xtiper_tit_svg_lock svg{ margin: 0px 6px 0px 2px; } .xtiper_sheet_tit.xtiper_sheet_left .xtiper_tit_right { display: inline-flex; align-items: center; align-content: center; width: 115px; justify-content: center; } .xtiper_sheet_tit.xtiper_sheet_left .xtiper_tit_right_windowopen, .xtiper_sheet_tit.xtiper_sheet_left .xtiper_tit_right_windowclose{ width: 100%; text-align: center; margin: 0px 0px; height: 100%; display: flex; justify-content: center; align-items: center; } /* 底部高度不对等问题*/ .xtiper_content.xtit{ height: calc(100% - 80px); } /* 底部消息距离底部30px*/ .xtiper.xtiper_msg.xtiper_msg_bottom.xtiper_msg_black.xon{ margin-bottom: 30px; } /* 标题顶部拖拽*/ .xtiper_sheet_tit_top_drag{ width: 100%; position: relative; height: 10px; } .xtiper_sheet_tit_top_drag div{ width: 50px; margin: 0 auto; height: 4px; background: #d9d9d9; border-radius: 15px; bottom: 3px; position: relative; } `); function getFormList() { /* 获取当前页面所有帖子 */ let formList = mt_config.dom_obj.comiis_formlist() ? mt_config.dom_obj.comiis_formlist() : []; formList = formList.length == 0 ? mt_config.dom_obj.comiis_postli() : formList; formList = formList.length == 0 ? mt_config.dom_obj.comiis_mmlist() : formList; return formList; } let formlist = null; /* 帖子列表 */ let isFindFormList = false; /* 是否找到帖子 */ let findFormListNums = 0; /* 找到帖子的数量 */ let smallWindowId = null; /* 小窗对象 */ let waitFormListAppear = setInterval(function () { /* 等待页面加载出现帖子 */ if (isFindFormList) { formlist = getFormList(); main(); clearInterval(waitFormListAppear); } else { if (findFormListNums >= 10) { console.log("未出现帖子或寻找贴子超时,清理定时器"); clearInterval(waitFormListAppear); } isFindFormList = getFormList().length ? true : false; findFormListNums += 1; } }, 800); function popstateFunction() { window.history.pushState('forward', null, '#'); window.history.forward(1); resumeBack(); } function banBack() { /* 禁止浏览器后退按钮 */ if (window.history && window.history.pushState) { $jq(window).on('popstate', popstateFunction); } window.history.pushState('forward', null, '#'); /* 在IE中必须得有这两行 */ window.history.forward(1); }; async function resumeBack() { /* 允许浏览器后退并关闭小窗 */ xtip.close(smallWindowId); smallWindowId = null; $jq(window).off('popstate', popstateFunction); while (1) { if (window.location.href == 'https://bbs.binmt.cc/#') { console.log("back!"); await utils.asyncSetTimeOut("window.history.back();", 100); await utils.sleep(100); } else { return; } } }; function getSmallPageBtn(forumPostTitle, forumPostUrl, isNew) { let prevNode = document.createElement("li"); let constructURL = new URL(forumPostUrl); let isHTTPS = constructURL.protocol.indexOf("https:") != -1 ? true : false; let safeIcon = ` `; let unsafeIcon = ` `; let blankOpenIcon = ` `; let closeIcon = ` `; let showWebsiteSafeIcon = isHTTPS ? safeIcon : unsafeIcon; let websiteTitle = `

    ${forumPostTitle}

    ${showWebsiteSafeIcon}

    ${constructURL.host}

    ${blankOpenIcon}
    ${closeIcon}
    `; prevNode.className = "f_c"; prevNode.setAttribute("style", "display: flex;justify-content: center;align-items: center;"); prevNode.innerHTML = ` `; prevNode.getElementsByClassName("tosmallwindowprev")[0].innerText = isNew ? "Win" : "浏览"; prevNode.onclick = () => { banBack(); let temp_id = xtip.open({ type: 'url', content: forumPostUrl, title: websiteTitle, height: '88%', app: true, success: (e) => {}, end: () => { console.log("点击其它区域关闭小窗"); resumeBack(); } }); if (typeof top.window.tampermonkeyByMT != "undefined") { console.log("当前执行为非油猴调用"); let iframe_id = temp_id + "_id"; document.getElementById(iframe_id).onload = () => { console.log(`子窗口: ${iframe_id}加载完毕`); let scriptNode = document.createElement("script"); scriptNode.innerHTML = top.window.tampermonkeyByMT; document.getElementById(iframe_id).contentWindow.document.head.append(scriptNode); } } smallWindowId = temp_id; console.log(smallWindowId); let dragNode = new AnyTouch(document.getElementById(temp_id)); let smallWidowNode = document.getElementById(temp_id).querySelector("div.xtiper_sheet"); let smallWidowNormalHeight = parseInt(smallWidowNode.style["height"]); /* 小窗原始高度 */ console.log("小窗原始高度", smallWidowNormalHeight); dragNode.on("pan", (e) => { if (e.phase == 'move' && e.displacementY > 0) { /* 当前为向下移动 */ smallWidowNode.style["transition"] = "none"; smallWidowNode.style["height"] = Math.abs(smallWidowNormalHeight - e.distanceY) + "px"; } if (e.isEnd) { /* 当前为停止移动,松开手指,判断在哪个区域,一半以上回归上面,一般以下,关闭 */ smallWidowNode.style["transition"] = "0.2s ease-in"; if (parseInt(smallWidowNode.style["height"]) > (window.innerHeight / 2)) { smallWidowNode.style["height"] = smallWidowNormalHeight + "px"; } else { resumeBack(); } } }) dragNode.on("tap", (e) => { if (document.getElementById(temp_id).querySelector(".xtiper_bg").outerHTML.indexOf(e.target.outerHTML) != -1) { /* 点击背景关闭小窗 */ console.log("点击背景关闭小窗"); resumeBack(); dragNode.off("tap"); dragNode.off("pan"); return; } if (document.getElementById(temp_id).querySelector(".xtiper_tit_content").outerHTML.indexOf(e.target.outerHTML) != -1) { GM_setClipboard(`『${forumPostTitle}』 - ${forumPostUrl}`); xtips.toast('已复制链接', { icon: 'success', pos: 'bottom' }); return; } if (document.getElementById(temp_id).querySelector(".xtiper_tit_right_windowopen svg").outerHTML.indexOf(e.target.outerHTML) != -1) { window.open(forumPostUrl, "_blank"); return; } if (document.getElementById(temp_id).querySelector(".xtiper_tit_right_windowclose svg").outerHTML.indexOf(e.target.outerHTML) != -1) { console.log("点击关闭按钮关闭小窗"); resumeBack(); dragNode.off("tap"); dragNode.off("pan"); return; } }) } return prevNode; } async function main() { $jq.each(formlist, function (index, value) { let isNewUI = false; let formBottomEle = value.querySelectorAll(".comiis_znalist_bottom.b_t.cl ul.cl li"); if (!formBottomEle.length) { let tempFormBottomEle = value.querySelectorAll(".comiis_xznalist_bottom.cl ul.cl li"); /* 新版论坛UI */ if (!tempFormBottomEle.length) { return }; formBottomEle = tempFormBottomEle; isNewUI = true; }; let clParentEle = formBottomEle[0].parentElement; if (clParentEle.querySelector(".tosmallwindowprev")) { console.log("已经插入过小窗浏览"); } else { let forumPostUrl = value.querySelector(".mmlist_li_box.cl a").getAttribute("href"); let forumPostTitle = value.querySelector(".mmlist_li_box.cl a").innerText; if (!forumPostUrl) { console.log("获取帖子url失败"); return; } if (!forumPostTitle) { console.log("获取帖子标题失败"); return; } let previewPicturesEle = getSmallPageBtn(forumPostTitle, forumPostUrl, isNewUI ? isNewUI : null); if (previewPicturesEle != null) { clParentEle.append(previewPicturesEle); clParentEle.setAttribute("style", "display: flex;height: inherit;"); } } }) } }, paymentSubjectReminder() { /* 付费主题白嫖提醒 */ let urlForumPostMatchStatus = window.location.href.match(mt_config.rexp.forum_post); let urlHomeSpaceMatchStatus = window.location.href.match(mt_config.rexp.home_space_url); let urlGuideMatchStatus = window.location.href.match(mt_config.rexp.forum_guide_url); let urlCommunityMatchStatus = window.location.href.match(mt_config.rexp.community_url) || window.location.href.match(mt_config.rexp.plate_url); let urlBBSMatchStatus = window.location.href.match(mt_config.rexp.bbs); let storageMatchStatus = GM_getValue("v44") != null; let setTipForumPostList = GM_getValue("tipToFreeSubjectForumPost") == null ? [] : GM_getValue("tipToFreeSubjectForumPost"); const paymentSubjectReminderHome = { getData() { /* 获取数据 */ return GM_getValue("tipToFreeSubjectForumPost") == null ? [] : GM_getValue("tipToFreeSubjectForumPost"); }, setData(data) { /* 设置数据 */ GM_setValue("tipToFreeSubjectForumPost", data); }, async insertButtonView() { /* 插入-底部导航-我的-付费主题白嫖列表(按钮) */ let comiis_left_Touch = document.createElement("li"); comiis_left_Touch.className = "comiis_left_Touch"; let paymentSubjectReminderHomeBtn = document.createElement("a"); paymentSubjectReminderHomeBtn.setAttribute("href", "javascript:;"); paymentSubjectReminderHomeBtn.className = "paymentsubjectreminder"; paymentSubjectReminderHomeBtn.innerHTML = `
    付费主题白嫖列表
    `; GM_addStyle(` .NZ-MsgBox-alert .msgcontainer .msgtitle { text-align: center !important; } #autolist .k_misign_lu img { width: 40px; height: 40px; -moz-border-radius: 20px; -webkit-border-radius: 20px; border-radius: 20px; } .k_misign_lc .f_c{ margin: 5px 0px; } details.subjectnotvisit, details.subjectcanvisit{ margin-left: 20px; } `) paymentSubjectReminderHomeBtn.onclick = () => { paymentSubjectReminderHome.showView(); } comiis_left_Touch.append(paymentSubjectReminderHomeBtn); $jq(".comiis_sidenv_box .sidenv_li .comiis_left_Touch.bdew").append(comiis_left_Touch); /* Array.from(document.querySelectorAll(".comiis_myinfo_list.bg_f.cl")).forEach((ele) => { if (ele.innerText.match(/消息提醒|资料设置|我的积分|我的勋章|我的道具/)) { ele.append(paymentSubjectReminderHomeBtn); return; } }) */ }, async showView() { /* 显示-付费主题白嫖列表(dialog) */ if (typeof $jq.NZ_MsgBox == "undefined") { popup2.toast("加载NZMsgBox.js中"); await GM_asyncLoadScriptNode("https://greasyfork.org/scripts/449562-nzmsgbox/code/NZMsgBox.js"); if (typeof $jq.NZ_MsgBox == "undefined") { popup2.toast("网络异常,加载NZMsgBox.js失败"); return; } else { console.log("成功加载NZMsgBox.js"); } } let data = paymentSubjectReminderHome.getData(); $jq.NZ_MsgBox.alert({ title: "付费主题白嫖列表", content: "获取中", type: "", location: "center", buttons: { confirm: { text: "确定" } } }); let notVisitedTipContent = "" /* 可白嫖且未访问 */ let notVisitedNums = 0; /* 可白嫖且未访问的数量 */ let isFreeContent = ""; /* 可白嫖帖子-未读的加左上边红点 */ let isPaidContent = ""; /* 需付费帖子 */ let isFreeNotVisitedContentList = []; let isFreeContentList = []; let isPaidContentList = []; $jq.each(data, (i, v) => { let timeColor = "#f91212"; let leftRedBtn = ""; if (new Date().getTime() > v["expirationTimeStamp"]) { /* 可白嫖 */ timeColor = "#1e90ff"; if (v["isVisited"] == false) { leftRedBtn = '' notVisitedNums = notVisitedNums + 1; } } let concatList = { "content": `
    ${leftRedBtn}
    ${v["title"]}
  • ${v["expirationTime"]}
  • `, "timestamp": v["expirationTimeStamp"] }; if (new Date().getTime() > v["expirationTimeStamp"]) { /* 可白嫖 */ if (leftRedBtn != '') { isFreeNotVisitedContentList = isFreeNotVisitedContentList.concat(concatList); } else { isFreeContentList = isFreeContentList.concat(concatList); } } else { isPaidContentList = isPaidContentList.concat(concatList); } }); isFreeNotVisitedContentList.sort(utils.sortListByProperty("timestamp", "asc")); isFreeContentList.sort(utils.sortListByProperty("timestamp", "asc")); isFreeContent = utils.listToStringByValue(isFreeNotVisitedContentList, "content") + utils.listToStringByValue(isFreeContentList, "content"); isPaidContent = utils.listToStringByValue(isPaidContentList, "content"); if (notVisitedNums > 0) { notVisitedTipContent = `${notVisitedNums}`; } let dialogIsFreeContent = '
    可白嫖' + notVisitedTipContent + '' + isFreeContent + "
    "; let dialogIsPaidContent = '
    需付费' + isPaidContent + "
    "; $jq(".msgcon").html(""); $jq(".msgcon").append(dialogIsFreeContent); $jq(".msgcon").append(dialogIsPaidContent); $jq(".msgcon").css("height", "400px"); $jq(".delsubjecttip i.comiis_font").on("click", (e) => { var t_index = e.target.parentElement.getAttribute("t-index"); popup2.confirm({ "text": "

    确定移出付费主题白嫖列表?

    ", "mask": true, "callback": () => { data.splice(t_index, 1); console.log(data); paymentSubjectReminderHome.setData(data); e.target.parentElement.parentElement.parentElement.parentElement.parentElement.remove(); popup2.confirm_close(); }, "only": true }); }); $jq("#paymentSubjectReminderIsFreeList").on("click", "a", (e) => { var t_index = e.target.getAttribute("t-index"); var t_href = e.target.getAttribute("t-href"); console.log(t_index, t_href); data[t_index]["isVisited"] = true; paymentSubjectReminderHome.setData(data); window.open(t_href, "_blank"); e.target.setAttribute("style", "color: #000000;"); if (e.target.parentElement.parentElement.children[0].className != "icon_msgs bg_del") { return; } e.target.parentElement.parentElement.children[0].remove(); $jq("#paymentSubjectReminderIsFreeList").append(e.target.parentElement.parentElement.parentElement.parentElement.parentElement); let notVisitedNums = $jq(".subjectcanvisit summary span.icon_msgs.bg_del.f_f").text(); notVisitedNums = parseInt(notVisitedNums) - 1; if (notVisitedNums > 0) { $jq(".subjectcanvisit summary span.icon_msgs.bg_del.f_f").html(notVisitedNums); } else { $jq(".subjectcanvisit summary span.icon_msgs.bg_del.f_f").remove(); } }) $jq("#paymentSubjectReminderIsPaidList").on("click", "a", (e) => { var t_index = e.target.getAttribute("t-index"); var t_href = e.target.getAttribute("t-href"); console.log(t_index, t_href); window.open(t_href, "_blank"); e.target.setAttribute("style", "color: #000000;"); }) } } if (storageMatchStatus && urlForumPostMatchStatus) { /* 帖子内部-添加进提醒的按钮或者已添加进提醒的按钮点击移出 */ let paySubjectTip = $jq("span.kmren"); /* 购买主题的元素 */ if (paySubjectTip.length != 0) { log.success("当前帖子存在需要购买主题"); let isAddTip = false; let tipBtnHTML = ''; Array.from(setTipForumPostList).forEach((item, index) => { if (window.location.href.match(item["url"])) { isAddTip = true; return; } }); if (isAddTip) { log.success("已设置提醒"); tipBtnHTML = $jq(``); tipBtnHTML.on("click", function () { popup2.confirm({ text: "

    确定移出付费主题白嫖列表?

    ", callback: function () { let isRemove = false; Array.from(setTipForumPostList).forEach((item, index) => { if (window.location.href.match(item["url"])) { setTipForumPostList.splice(index, 1); GM_setValue("tipToFreeSubjectForumPost", setTipForumPostList); isRemove = true; utils.asyncSetTimeOut("window.location.reload()", 1500); return; } }); if (!isRemove) { popup2.toast("移出失败"); } else { popup2.confirm_close(); popup2.toast({ "text": "移出成功" }); } }, mask: true }); }); } else { log.success("未设置提醒"); tipBtnHTML = $jq(``); tipBtnHTML.on("click", () => { let expirationTimeMatch = $jq(".kmren").parent().text().replace(/\t|\n/g, "").match(/[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}[\s]{1}[0-9]{1,2}:[0-9]{1,2}/); if (expirationTimeMatch.length == 0) { popup2.toast({ "text": "获取付费主题到期时间失败" }); return; } let expirationTime = expirationTimeMatch[0]; let expirationTimeStamp = utils.formatDateStrToStamp(expirationTime); setTipForumPostList = setTipForumPostList.concat({ "url": window.location.href, "title": document.title.replace(" - MT论坛", ""), "expirationTime": expirationTime, "expirationTimeStamp": expirationTimeStamp, "isVisited": false }); GM_setValue("tipToFreeSubjectForumPost", setTipForumPostList); popup2.toast({ "text": "添加成功" }); setTimeout(function () { window.location.reload(); }, 1500); }); } $jq(".comiis_head.f_top .header_y").append(tipBtnHTML); }; } if (storageMatchStatus && urlBBSMatchStatus) { /* 底部导航-我的-提供类似小黑屋这种可查看设置提醒的帖子 */ paymentSubjectReminderHome.insertButtonView(); } if (storageMatchStatus) { /* 设置提醒小红点 */ function getTipNums() { let needTipNums = 0; Array.from(paymentSubjectReminderHome.getData()).forEach((item, index) => { if (new Date().getTime() > item["expirationTimeStamp"] && item["isVisited"] == false) { needTipNums += 1; } }); return needTipNums; } if (urlHomeSpaceMatchStatus || urlGuideMatchStatus || urlCommunityMatchStatus) { /* 当前网页为,底部导航-我的 */ let redBtn = $jq(".icon_msgs.bg_del.f_f"); /* 底部导航-我的-右上角小红点 */ let tipNums = 0; if (redBtn.length) { tipNums = parseInt(redBtn.text()); $jq(".icon_msgs.bg_del.f_f").html(tipNums + getTipNums()); $jq(".comiis_head .header_z .kmuser em").append($jq(``)); } else { let tipnums = getTipNums(); if (tipnums) { /* $jq("ul.comiis_flex li.flex a[title='我的'] i.comiis_font").append($jq(`${tipnums}`)); */ $jq(".comiis_head .header_z .kmuser em").append($jq(``)); } } } if (urlBBSMatchStatus) { /* 当前网页为,全部 */ let redBtn = $jq(".sidenv_num.bg_del.f_f"); /* 侧边栏-头像-右上角小红点 */ let tipNums = 0; if (redBtn.length) { tipNums = parseInt(redBtn.text()); $jq(".sidenv_num.bg_del.f_f").html(tipNums + getTipNums()); } else { let tipnums = getTipNums(); if (tipnums) { $jq(".sidenv_user em").before($jq(`${tipnums}`)); } } if (getTipNums()) { /* 当前网页为,侧边slider,付费白嫖列表 */ /* $jq(".comiis_left_Touch .paymentsubjectreminder div.flex").append($jq(``)); */ $jq(".comiis_left_Touch .paymentsubjectreminder div.flex").append($jq(``)); } } } }, async previewPictures() { /* 贴外预览图片-使用github项目https://github.com/fengyuanchen/viewerjs */ if (!GM_getValue("v34") && (!(window.location.href.match(mt_config.rexp.forum_guide_url) || /* !(window.location.href.match(mt_config.rexp.forum_post)) || !(window.location.href.match(mt_config.rexp.plate_url)) || */ !(window.location.href.match(mt_config.rexp.search_url)) ))) { return } function getFormList() { let formList = mt_config.dom_obj.comiis_formlist() ? mt_config.dom_obj.comiis_formlist() : []; formList = formList.length == 0 ? mt_config.dom_obj.comiis_postli() : formList; formList = formList.length == 0 ? mt_config.dom_obj.comiis_mmlist() : formList; return formList; } let formlist = null; /* 帖子列表 */ let isFindFormList = false; let findFormListNums = 0; let waitFormListAppear = setInterval(function () { if (isFindFormList) { formlist = getFormList(); main(); clearInterval(waitFormListAppear) } else { if (findFormListNums >= 10) { console.log("未出现帖子或寻找贴子超时,清理定时器"); clearInterval(waitFormListAppear); } isFindFormList = getFormList().length ? true : false; findFormListNums += 1; } }, 800); function getPreviewBtn(node, isNew) { let prevNode = document.createElement("li"); prevNode.className = "f_c"; let imageDOM = node.querySelectorAll(".comiis_pyqlist_img").length ? node.querySelectorAll(".comiis_pyqlist_img") : node.querySelectorAll(".comiis_pyqlist_imgs"); if (imageDOM.length == 0) { return null; }; prevNode.setAttribute("style", "display: flex;justify-content: center;"); prevNode.innerHTML = ``; Array.from(imageDOM).forEach(item => { let needPrevImages = item.querySelectorAll("img"); let postForumImageNodeDiv = document.createElement("div"); let postForumImageNodeUl = document.createElement("ul"); postForumImageNodeUl.className = "postforumimages"; postForumImageNodeUl.setAttribute("style", "display:none;"); Array.from(needPrevImages).forEach(_img_ => { let tempLi = document.createElement("li"); let tempImg = document.createElement("img"); tempImg.setAttribute("data-src", _img_.getAttribute("src")); tempLi.append(tempImg); postForumImageNodeUl.append(tempLi); }); postForumImageNodeDiv.append(postForumImageNodeUl); prevNode.append(postForumImageNodeDiv); }) let canPrevImageNums = prevNode.getElementsByTagName("img").length; prevNode.getElementsByClassName("topreimg")[0].innerText = isNew ? canPrevImageNums : "预览"; prevNode.onclick = (e) => { let imageList = e.target.parentElement.children[2].children[0]; let viewer = new Viewer(imageList, { inline: false, url: "data-src", hidden: () => { viewer.destroy(); } }); viewer.zoomTo(1); viewer.show(); } return prevNode; } async function main() { $jq.each(formlist, function (index, value) { let isNewUI = false; let formBottomEle = value.querySelectorAll(".comiis_znalist_bottom.b_t.cl ul.cl li"); if (!formBottomEle.length) { let tempFormBottomEle = value.querySelectorAll(".comiis_xznalist_bottom.cl ul.cl li"); /* 新版论坛UI */ if (!tempFormBottomEle.length) { return }; formBottomEle = tempFormBottomEle; isNewUI = true; }; let clParentEle = formBottomEle[0].parentElement; if (clParentEle.querySelector(".topreimg")) { console.log("已经插入过预览图片"); } else { let previewPicturesEle = getPreviewBtn(value, isNewUI ? isNewUI : null); if (previewPicturesEle != null) { clParentEle.append(previewPicturesEle); clParentEle.setAttribute("style", "display: flex;"); } } }) } }, previewPostForum() { /* 发帖、回复、编辑预览功能 */ GM_addStyle(` #comiis_mh_sub{ height:40px; } .gm_plugin_previewpostforum svg{ } .gm_plugin_previewpostforum_html .comiis_message_table{ margin-top: 10px; font-weight: initial; line-height: 24px; } .gm_plugin_previewpostforum_html .comiis_message_table a{ height: auto; float: unset; color: #507daf !important; } .gm_plugin_previewpostforum_html .comiis_message_table i{ text-align: unset; font-size: unset; line-height: unset; padding-top: unset; display: unset; } .comiis_postli.comiis_list_readimgs.nfqsqi{ width: 100vw; } .gm_plugin_previewpostforum_html.double-preview{ width: 50vw; } .gm_plugin_previewpostforum_html.double-preview .comiis_over_box.comiis_input_style{ border-left: 1px solid; } `); let open_double = GM_getValue("preview_post_forum_by_double"); function addMenu_preview() { /* 添加底部菜单-预览 */ $jq("#comiis_mh_sub .swiper-wrapper.comiis_post_ico").append($jq(`预览`)); } function addMenu_doubleColumnPreview() { /* 添加底部菜单-高级-使用双列预览 */ $jq("#htmlon").parent().append($jq(`
  • 使用双列预览
  • `)); $jq("#postformdouble").on("click", function () { let obj = $jq(this); let code_obj = obj.parent().find(".comiis_checkbox"); if (code_obj.hasClass("comiis_checkbox_close")) { GM_setValue("preview_post_forum_by_double", true) } else { GM_setValue("preview_post_forum_by_double", false) } }) } function addMenu_immersiveInput() { /* 添加底部菜单-高级-使用沉浸输入 */ $jq("#htmlon").parent().append($jq(`
  • 使用沉浸输入
  • `)); $jq("#immersiveinput").on("click", function () { let obj = $jq(this); let code_obj = obj.parent().find(".comiis_checkbox"); console.log(code_obj.attr("class")); if (code_obj.hasClass("comiis_checkbox_close")) { $jq(".comiis_wzpost ul li.comiis_flex").hide(); /* 板块、标题 */ $jq(".comiis_wzpost ul li.comiis_styli.kmquote").hide(); /* 回复别人的quote */ $jq("#pollchecked").parent().parent().hide(); /* 投票,最多可填写 20 个选项 */ $jq("#pollm_c_1").hide(); /* 投票,增加一项 */ $jq(".comiis_polloption_add+div.f_0").hide(); /* 投票,增加一项(编辑状态下) */ $jq(".comiis_wzpost ul li.comiis_thread_content:contains('内容')").hide(); /* 投票,内容 */ } else { $jq(".comiis_wzpost ul li.comiis_flex").show(); $jq(".comiis_wzpost ul li.comiis_styli.kmquote").show(); $jq("#pollchecked").parent().parent().show(); $jq("#pollm_c_1").show(); $jq(".comiis_polloption_add+div.f_0").show(); $jq(".comiis_wzpost ul li.comiis_thread_content:contains('内容')").show(); } window.dispatchEvent(new Event("resize")); }) } const smiliesDictionaries = { /* 表情字典 */ "[呵呵]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq001.gif", "[撇嘴]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq002.gif", "[色]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq003.gif", "[发呆]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq004.gif", "[得意]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq005.gif", "[流泪]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq006.gif", "[害羞]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq007.gif", "[闭嘴]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq008.gif", "[睡]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq009.gif", "[大哭]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq010.gif", "[尴尬]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq011.gif", "[发怒]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq012.gif", "[调皮]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq013.gif", "[呲牙]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq014.gif", "[惊讶]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq015.gif", "[难过]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq016.gif", "[酷]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq017.gif", "[冷汗]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq018.gif", "[抓狂]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq019.gif", "[吐]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq020.gif", "[偷笑]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq021.gif", "[可爱]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq022.gif", "[白眼]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq023.gif", "[傲慢]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq024.gif", "[饥饿]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq025.gif", "[困]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq026.gif", "[惊恐]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq027.gif", "[流汗]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq028.gif", "[憨笑]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq029.gif", "[装逼]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq030.gif", "[奋斗]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq031.gif", "[咒骂]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq032.gif", "[疑问]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq033.gif", "[嘘]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq034.gif", "[晕]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq035.gif", "[折磨]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq036.gif", "[衰]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq037.gif", "[骷髅]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq038.gif", "[敲打]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq039.gif", "[再见]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq040.gif", "[擦汗]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq041.gif", "[抠鼻]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq042.gif", "[鼓掌]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq043.gif", "[糗大了]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq044.gif", "[坏笑]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq045.gif", "[左哼哼]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq046.gif", "[右哼哼]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq047.gif", "[哈欠]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq048.gif", "[鄙视]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq049.gif", "[委屈]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq050.gif", "[快哭了]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq051.gif", "[阴脸]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq052.gif", "[亲亲]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq053.gif", "[吓]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq054.gif", "[可怜]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq055.gif", "[眨眼睛]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq056.gif", "[笑哭]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq057.gif", "[dogeQQ]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq058.gif", "[泪奔]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq059.gif", "[无奈]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq060.gif", "[托腮]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq061.gif", "[卖萌]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq062.png", "[斜眼笑]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq063.gif", "[喷血]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq064.gif", "[惊喜]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq065.gif", "[骚扰]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq066.gif", "[小纠结]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq067.gif", "[我最美]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq068.gif", "[菜刀]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq069.gif", "[西瓜]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq070.gif", "[啤酒]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq071.gif", "[篮球]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq072.gif", "[乒乓]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq073.gif", "[咖啡]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq074.gif", "[饭]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq075.gif", "[猪]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq076.gif", "[玫瑰]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq077.gif", "[凋谢]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq078.gif", "[示爱]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq079.gif", "[爱心]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq080.gif", "[心碎]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq081.gif", "[蛋糕]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq082.gif", "[闪电]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq083.gif", "[炸弹]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq084.gif", "[刀]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq085.gif", "[足球]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq086.gif", "[瓢虫]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq087.gif", "[便便]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq088.gif", "[月亮]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq089.gif", "[太阳]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq090.gif", "[礼物]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq091.gif", "[抱抱]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq092.gif", "[喝彩]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq93.gif", "[祈祷]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq94.gif", "[棒棒糖]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq95.gif", "[药]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq96.gif", "[赞]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq097.gif", "[差劲]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq098.gif", "[握手]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq099.gif", "[胜利]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq100.gif", "[抱拳]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq101.gif", "[勾引]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq102.gif", "[拳头]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq103.gif", "[差劲]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq104.gif", "[爱你]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq105.gif", "[NO]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq106.gif", "[OK]": "https://cdn-bbs.mt2.cn/static/image/smiley/qq/qq107.gif", "[#呵呵]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_1.png", "[#滑稽]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_10.png", "[#吐舌]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_3.png", "[#哈哈]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_2.png", "[#啊]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_23.png", "[#酷]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_22.png", "[#怒]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_13.png", "[#开心]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_39.png", "[#汗]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_14.png", "[#泪]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_16.png", "[#黑线]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_15.png", "[#鄙视]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_21.png", "[#不高兴]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_12.png", "[#真棒]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_17.png", "[#钱]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_40.png", "[#疑问]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_26.png", "[#阴险]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_20.png", "[#吐]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_34.png", "[#咦]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_41.png", "[#委屈]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_29.png", "[#花心]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_6.png", "[#呼~]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_42.png", "[#激动]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_5.png", "[#冷]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_43.png", "[#可爱]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_4.png", "[#What?]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_25.png", "[#勉强]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_38.png", "[#狂汗]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_24.png", "[#酸爽]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_27.png", "[#乖]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_8.png", "[#雅美蝶]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_28.png", "[#睡觉]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_31.png", "[#惊哭]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_19.png", "[#哼]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_44.png", "[#笑尿]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_32.png", "[#惊讶]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_30.png", "[#小乖]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_7.png", "[#喷]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_18.png", "[#抠鼻]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_33.png", "[#捂嘴笑]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_9.png", "[#你懂的]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_11.png", "[#犀利]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_35.png", "[#小红脸]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_36.png", "[#懒得理]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_37.png", "[#爱心]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_45.png", "[#心碎]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_46.png", "[#玫瑰]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_47.png", "[#礼物]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_48.png", "[#彩虹]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_49.png", "[#太阳]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_50.png", "[#月亮]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_51.png", "[#钱币]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_52.png", "[#咖啡]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_53.png", "[#蛋糕]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_54.png", "[#大拇指]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_55.png", "[#胜利]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_56.png", "[#爱你]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_57.png", "[#OK]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_58.png", "[#弱]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_59.png", "[#沙发]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_60.png", "[#纸巾]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_61.png", "[#香蕉]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_62.png", "[#便便]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_63.png", "[#药丸]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_64.png", "[#红领巾]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_65.png", "[#蜡烛]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_66.png", "[#三道杠]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_67.png", "[#音乐]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_68.png", "[#灯泡]": "https://cdn-bbs.mt2.cn/static/image/smiley/comiis_tb/tb_69.png", "[doge]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/1.png", "[doge思考]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/2.png", "[doge再见]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/3.png", "[doge生气]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/4.png", "[doge气哭]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/5.png", "[doge笑哭]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/7.png", "[doge调皮]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/6.png", "[doge啊哈]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/8.png", "[doge原谅TA]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/9.png", "[miao]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/10.png", "[miao思考]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/11.png", "[miao拜拜]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/12.png", "[miao生气]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/13.png", "[miao气哭]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/14.png", "[二哈]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/15.png", "[摊手]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/19.png", "[w并不简单]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/20.png", "[w滑稽]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/21.png", "[w色]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/22.png", "[w爱你]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/23.png", "[w拜拜]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/24.png", "[w悲伤]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/25.png", "[w鄙视]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/26.png", "[w馋嘴]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/27.png", "[w冷汗]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/28.png", "[w打哈欠]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/29.png", "[w打脸]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/30.png", "[w敲打]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/31.png", "[w生病]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/32.png", "[w闭嘴]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/33.png", "[w鼓掌]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/34.png", "[w哈哈]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/35.png", "[w害羞]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/36.png", "[w呵呵]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/37.png", "[w黑线]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/38.png", "[w哼哼]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/39.png", "[w调皮]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/40.png", "[w可爱]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/41.png", "[w可怜]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/42.png", "[w酷]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/43.png", "[w困]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/44.png", "[w懒得理你]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/45.png", "[w流泪]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/46.png", "[w怒]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/47.png", "[w怒骂]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/48.png", "[w钱]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/49.png", "[w亲亲]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/50.png", "[w傻眼]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/51.png", "[w便秘]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/52.png", "[w失望]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/53.png", "[w衰]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/54.png", "[w睡觉]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/55.png", "[w思考]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/56.png", "[w开心]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/57.png", "[w色舔]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/58.png", "[w偷笑]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/59.png", "[w吐]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/60.png", "[w抠鼻]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/61.png", "[w委屈]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/62.png", "[w笑哭]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/63.png", "[w嘻嘻]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/64.png", "[w嘘]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/65.png", "[w阴险]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/66.png", "[w疑问]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/67.png", "[w抓狂]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/70.png", "[w晕]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/69.png", "[w右哼哼]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/68.png", "[w左哼哼]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/71.png", "[w肥皂]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/77.png", "[w奥特曼]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/78.png", "[w草泥马]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/79.png", "[w兔子]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/80.png", "[w熊猫]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/81.png", "[w猪头]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/82.png", "[w→_→]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/83.png", "[w给力]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/84.png", "[w囧]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/85.png", "[w萌]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/86.png", "[w神马]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/87.png", "[w威武]": "https://cdn-bbs.mt2.cn/static/image/smiley/doge/88.png", } function clickEvent(e) { /* 预览按钮点击事件 */ if ($jq("#polldatas").length) { /* 当前是投票帖子 */ replaceVote(); } if (!$jq(this).find("i.comiis_font").hasClass("f_0")) { $jq(".gm_plugin_previewpostforum_html").css("display", "block"); let replaecdText = replaceText($jq("#needmessage").val()); $jq(".gm_plugin_previewpostforum_html .comiis_message_table")[0].innerHTML = replaecdText; if (open_double) { $jq(".gm_plugin_previewpostforum_html.double-preview .comiis_over_box.comiis_input_style").css("height", $jq("#needmessage").css("height")); } } else { $jq(".gm_plugin_previewpostforum_html").hide(); } }; function replaceText(text) { /* 替换内容 */ let attachimgmatch = text.match(/\[attachimg\]([\s\S]+?)\[\/attachimg\]/g); if (attachimgmatch) { attachimgmatch.forEach(item => { let aimgidMatch = item.match(/\[attachimg\]([\s\S]+?)\[\/attachimg\]/); let aimg_id = aimgidMatch ? aimgidMatch[aimgidMatch.length - 1] : ""; let imgtitle = $jq(`#aimg_${aimg_id}`).attr("title"); let imgsrc = $jq(`#aimg_${aimg_id}`).attr("src"); if (!imgsrc) { imgtitle = "该图片不存在"; } text = text.replace(item, `${imgtitle}`); }); } let code = text.match(/\[code\]([\s\S]*?)\[\/code\]/g); if (code) { code.forEach(item => { let match_content = item.match(/\[code\]([\s\S]*?)\[\/code\]/); let contentAll = match_content ? match_content[match_content.length - 1] : ""; let content = ""; let brSplit = contentAll.split("\n"); if (brSplit.length == 1) { content = "
  • " + contentAll + "
  • "; } else { Array.from(brSplit).forEach((item, index) => { if (index == brSplit.length - 1) { content = `${content}
  • ${item}
  • `; } else { content = `${content}
  • ${item}
  • `; } }) } text = text.replace(item, `
      ${content}
    `); }); } let url = text.match(/\[url\=[\s\S]*?\]([\s\S]*?)\[\/url\]/g); if (url) { url.forEach(item => { let urlMatch = item.match(/\[url=([\s\S]*?)\][\s\S]*\[\/url\]/); let urlNameMatch = item.match(/\[url=[\s\S]*?\]([\s\S]*?)\[\/url\]/); let _url_ = urlMatch ? urlMatch[urlMatch.length - 1] : ""; let _url_name_ = urlNameMatch ? urlNameMatch[urlNameMatch.length - 1] : ""; text = text.replace(item, `${_url_name_}`); }); } let color = text.match(/\[color\=[\s\S]*?\]([\s\S]*?)\[\/color\]/g); if (color) { color.forEach(item => { let colorValueMatch = item.match(/\[color=([\s\S]*?)\][\s\S]*\[\/color\]/); let colorTextMatch = item.match(/\[color=[\s\S]*?\]([\s\S]*?)\[\/color\]/); let colorValue = colorValueMatch ? colorValueMatch[colorValueMatch.length - 1] : ""; let colorText = colorTextMatch ? colorTextMatch[colorTextMatch.length - 1] : ""; text = text.replace(item, `${colorText}`); }); } let size = text.match(/\[size\=[\s\S]*?\]([\s\S]*?)\[\/size\]/g); if (size) { console.log(size); size.forEach(item => { let sizeValueMatch = item.match(/\[size=([\s\S]*?)\][\s\S]*\[\/size\]/); let sizeTextMatch = item.match(/\[size=[\s\S]*?\]([\s\S]*?)\[\/size\]/); let sizeValue = sizeValueMatch ? sizeValueMatch[sizeValueMatch.length - 1] : ""; let sizeText = sizeTextMatch ? sizeTextMatch[sizeTextMatch.length - 1] : ""; text = text.replace(item, `${sizeText}`); }); } let img = text.match(/\[img\]([\s\S]*?)\[\/img\]/g); if (img) { img.forEach(item => { let match_content = item.match(/\[img\]([\s\S]*?)\[\/img\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, ``); }); } let hide = text.match(/\[hide\]([\s\S]*?)\[\/hide\]/g); if (hide) { hide.forEach(item => { let match_content = item.match(/\[hide\]([\s\S]*?)\[\/hide\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `

    本帖隐藏的内容:

    ${content}
    `); }); } let hide2 = text.match(/\[hide=[\s\S]*?\]([\s\S]*?)\[\/hide\]/g); if (hide2) { hide2.forEach(item => { let match_content = item.match(/\[hide=([\s\S]*?)\]([\s\S]*?)\[\/hide\]/); let other_info = match_content ? match_content[match_content.length - 2] : ""; other_info = other_info.split(","); let integral_big_can_see = other_info.length == 2 ? other_info[1] : ""; text = text.replace(item, `
    以下内容需要积分高于 ${integral_big_can_see} 才可浏览
    `); }); } let quote = text.match(/\[quote\]([\s\S]*?)\[\/quote\]/g); if (quote) { quote.forEach(item => { let match_content = item.match(/\[quote\]([\s\S]*?)\[\/quote\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `
    回复 ${content}
    `); }); } let free = text.match(/\[free\]([\s\S]*?)\[\/free\]/g); if (free) { free.forEach(item => { let match_content = item.match(/\[free\]([\s\S]*?)\[\/free\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `
    ${content}
    `); }); } let strong = text.match(/\[b\]([\s\S]*?)\[\/b\]/g); if (strong) { strong.forEach(item => { let match_content = item.match(/\[b\]([\s\S]*?)\[\/b\]/i); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `${content}`); }); } let xhx = text.match(/\[u\]([\s\S]*?)\[\/u\]/g); if (xhx) { xhx.forEach(item => { let match_content = item.match(/\[u\]([\s\S]*?)\[\/u\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `${content}`); }); } let qx = text.match(/\[i\]([\s\S]*?)\[\/i\]/g); if (qx) { qx.forEach(item => { let match_content = item.match(/\[i\]([\s\S]*?)\[\/i\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `${content}`); }); } let strike = text.match(/\[s\]([\s\S]*?)\[\/s\]/g); if (strike) { strike.forEach(item => { let match_content = item.match(/\[s\]([\s\S]*?)\[\/s\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `${content}`); }); } let smilies = text.match(/\[([\s\S]+?)\]/g); if (smilies) { smilies.forEach(item => { console.log(item); let smiliesMatchSrc = smiliesDictionaries[item]; if (smiliesMatchSrc) { text = text.replace(item, ``); } }); } let media = text.match(/\[media=[\s\S]+?\][\s\S]+?\[\/media\]/g); if (media) { media.forEach(item => { console.log(item); let match_content = item.match(/\[media=[\s\S]*?\]([\s\S]*?)\[\/media\]/); let content = match_content ? match_content[match_content.length - 1] : ""; if (content) { text = text.replace(item, ``); } }); } let email = text.match(/\[email=[\s\S]+?\][\s\S]+?\[\/email\]/g); if (email) { email.forEach(item => { console.log(item); let email_match = item.match(/\[email=([\s\S]*?)\][\s\S]*?\[\/email\]/); let content_match = item.match(/\[email=[\s\S]*?\]([\s\S]*?)\[\/email\]/); let _email_ = email_match.length ? email_match[email_match.length - 1] : ""; let _content_ = content_match.length ? content_match[content_match.length - 1] : ""; if (_email_ || _content_) { text = text.replace(item, `${_content_}`); } }); } let align = text.match(/\[align=[\s\S]+?\][\s\S]+?\[\/align\]/g); if (align) { align.forEach(item => { console.log(item); let align_match = item.match(/\[align=([\s\S]*?)\][\s\S]+?\[\/align\]/); let content_match = item.match(/\[align=[\s\S]*?\]([\s\S]+?)\[\/align\]/); let _align_ = align_match.length ? align_match[align_match.length - 1] : ""; let _content_ = content_match.length ? content_match[content_match.length - 1] : ""; if (_align_ || _content_) { text = text.replace(item, `
    ${_content_}
    `); } }); } let qq = text.match(/\[qq\][\s\S]*?\[\/qq\]/g); if (qq) { qq.forEach(item => { console.log(item); let match_content = item.match(/\[qq\]([\s\S]*?)\[\/qq\]/); let content = match_content ? match_content[match_content.length - 1] : ""; /* 这个是以前的wpa协议,现在是tencent协议,mt的discuz没有更新,如:tencent://message/?uin=xxx&site=bbs.binmt.cc&menu=yes */ text = text.replace(item, ``); }); } let td = text.match(/\[td\][\s\S]+?\[\/td\]/g); if (td) { td.forEach(item => { console.log(item); let match_content = item.match(/\[td\]([\s\S]*?)\[\/td\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `${content}`); }); } let tr = text.match(/\[tr\][\s\S]+?\[\/tr\]/g); if (tr) { tr.forEach(item => { console.log(item); let match_content = item.match(/\[tr\]([\s\S]*?)\[\/tr\]/); let content = match_content ? match_content[match_content.length - 1] : ""; text = text.replace(item, `${content}`); }); } let table = text.match(/\[table\][\s\S]+?\[\/table\]/g); if (table) { table.forEach(item => { console.log(item); let match_content = item.match(/\[table\]([\s\S]*?)\[\/table\]/); let content = match_content ? match_content[match_content.length - 1] : ""; content = content.replace(/\n/g, ""); text = text.replace(item, `${content}
    `); }); } let list = text.match(/\[list=[\s\S]+?\][\s\S]+?\[\/list\]/g); if (list) { list.forEach(item => { console.log(item); let list_model_match = item.match(/\[list=([\s\S]*?)\][\s\S]*?\[\/list\]/); let list_content_match = item.match(/\[list=[\s\S]*?\]([\s\S]*?)\[\/list\]/); let list_model = list_model_match ? list_model_match[list_model_match.length - 1] : ""; let list_type = ""; if (list_model === "a") { list_type = "litype_2"; } else if (list_model === "A") { list_type = "litype_3"; } else if (list_model.length === 1 && list_model.match(/[0-9]{1}/)) { list_type = "litype_1"; } let content = list_content_match ? list_content_match[list_content_match.length - 1] : ""; let li_split = content.split("[*]"); if (li_split.length > 1) { let newContent = ""; if (li_split[0].replace(/[\s]*/, '') == "") { li_split = li_split.slice(1); } Array.from(li_split).forEach(item => { newContent = newContent + "
  • " + item + "
  • "; }); content = newContent; } content = content.replace(/\n/g, ""); text = text.replace(item, `
      ${content}
    `); }); } $jq(".gm_plugin_previewpostforum_html .comiis_quote.comiis_qianglou").remove(); let password = text.match(/\[password\](.*?)\[\/password\]/ig); if (password) { password.forEach(item => { console.log(item); text = item.replace(/\[password\](.*?)\[\/password\]/ig, ""); $jq(".gm_plugin_previewpostforum_html .comiis_message_table").before($jq(`
     付费主题, 价格: ${$jq("#price").val()} 金币 记录
    `)); }) } let every_reward = parseInt($jq("#replycredit_extcredits").val()); let total_reward = parseInt($jq("#replycredit_times").val()); let getreward_menbertimes = parseInt($jq("#replycredit_membertimes").val()); let getreward_random = parseInt($jq("#replycredit_random").val()); $jq(".gm_plugin_previewpostforum_html .comiis_htjl").remove(); if (!isNaN(every_reward) && !isNaN(total_reward) && every_reward > 0 && total_reward > 0) { $jq(".gm_plugin_previewpostforum_html .comiis_message_table").before($jq(`
    总共奖励 ${total_reward} 金币
    回复本帖可获得 ${every_reward} 金币奖励! 每人限 ${getreward_menbertimes} 次 ${getreward_random != 100 ? "(中奖概率 "+getreward_random+"%)":""}
    `)); } text = text.replace(/\[hr\]/g, '
    '); text = text.replace(/\[\*\]/g, '
  • '); text = text.replace(/\n/g, "
    "); return text; } function replaceVote() { /* 替换预览投票 */ let chooseColor = ["rgb(233, 39, 37)", "rgb(242, 123, 33)", "rgb(242, 166, 31)", "rgb(90, 175, 74)", "rgb(66, 196, 245)", "rgb(0, 153, 204)", "rgb(51, 101, 174)", "rgb(42, 53, 145)", "rgb(89, 45, 142)", "rgb(219, 49, 145)", "rgb(233, 39, 37)", "rgb(242, 123, 33)", "rgb(242, 166, 31)", "rgb(90, 175, 74)", "rgb(66, 196, 245)", "rgb(0, 153, 204)", "rgb(51, 101, 174)", "rgb(42, 53, 145)", "rgb(89, 45, 142)", "rgb(219, 49, 145)" ]; /* 选择的背景 */ let chooseContent = $jq(".comiis_polloption_add ul li:first-child div.flex .comiis_input.kmshow[type='text']"); /* 选项,最多20个 */ let maxchoices = parseInt($jq("input#maxchoices").val()); /* 最多可选 */ maxchoices = isNaN(maxchoices) ? 0 : maxchoices; maxchoices = maxchoices > 0 ? maxchoices : 0; maxchoices = maxchoices > chooseContent.length ? chooseContent.length : maxchoices; /* 大于当前选项数量的话为当前最大选项数量 */ let polldatas = parseInt($jq("input#polldatas").val()); /* 记票天数 */ polldatas = isNaN(polldatas) ? 0 : polldatas; let visibilitypoll = $jq("input#visibilitypoll").parent().find(".comiis_checkbox").hasClass("comiis_checkbox_close") ? false : true; /* 投票后结果可见 */ let overt = $jq("input#overt").parent().find(".comiis_checkbox").hasClass("comiis_checkbox_close") ? false : true; /* 公开投票参与人 */ let html = ""; let choosehtml = ""; console.log(chooseContent); chooseContent.each((i, v) => { if (i >= 20) { /* 最多20个 */ return; } choosehtml = choosehtml + `
  • 0% (0)
  • `; }); html = `

    ${(maxchoices > 1) ? '多选投票'+' 最多可选 '+maxchoices+' 项':"单选投票"}

    共有 0 人参与投票

    ${polldatas > 0 ? `

    距结束还有: ${polldatas > 1 ? ''+(polldatas-1)+' 天 ':''}23 小时 59 分钟

    `:""}
      ${choosehtml}
    ${overt ? '
    此为公开投票,其他人可看到您的投票项目
    ':""}
    `; $jq(".gm_plugin_previewpostforum_html .postforum_vote").remove(); $jq(".gm_plugin_previewpostforum_html .comiis_messages.comiis_aimg_show").children().eq(0).before($jq(html)); } function keyUpEvent(e) { /* 内容输入事件 */ let userInputText = e.target.value; let replaecdText = replaceText(userInputText); $jq(".gm_plugin_previewpostforum_html .comiis_message_table")[0].innerHTML = replaecdText; }; if (typeof unsafeWindow.comiis_addsmilies == "function") { /* 替换全局函数添加图片到里面触发input */ unsafeWindow.comiis_addsmilies = (a) => { unsafeWindow.$('#needmessage').comiis_insert(a); unsafeWindow.$("#needmessage")[0].dispatchEvent(new Event('input')); } } addMenu_doubleColumnPreview(); addMenu_preview(); addMenu_immersiveInput(); if (open_double) { /* box-shadow: -1px 0px 8px; */ $jq("#needmessage").parent().css("display", "flex"); $jq("#needmessage").after($jq(` `)); } else { $jq("#comiis_post_tab").append($jq(` `)); } $jq("#needmessage").on("propertychange input", keyUpEvent); $jq(".gm_plugin_previewpostforum").on("click", clickEvent); }, quickUBB: { code: { "rainbow1": { "key": "转普通彩虹", "value": "", "isFunc": true, "num": 1 }, "rainbow2": { "key": "转黑白彩虹", "value": "", "isFunc": true, "num": 2 }, "rainbow3": { "key": "转黑红彩虹", "value": "", "isFunc": true, "num": 3 }, "rainbow4": { "key": "转蓝绿彩虹", "value": "", "isFunc": true, "num": 4 }, "size": { "key": "size", "value": "[size=][/size]", "tagL": "=", "tagR": "]", "L": "[size=]", "R": "[/size]", "cursorL": "[size=", "cursorLength": 6, "quickUBBReplace": "[size=14]replace[/size]" }, "color": { "key": "color", "value": "[color=][/color]", "tagL": "=", "tagR": "]", "L": "[color=]", "R": "[/color]", "cursorL": "[color=", "cursorLength": 7, "quickUBBReplace": "[color=#000]replace[/color]" }, "b": { "key": "加粗", "value": "[b][/b]", "tagL": "]", "tagR": "[", "L": "[b]", "R": "[/b]", "cursorR": "[/b]", "cursorLength": 4, "quickUBBReplace": "[b]replace[/b]" }, "u": { "key": "下划线", "value": "[u][/u]", "tagL": "]", "tagR": "[", "L": "[u]", "R": "[/u]", "cursorR": "[/u]", "cursorLength": 4, "quickUBBReplace": "[u]replace[/u]" }, "i": { "key": "倾斜", "value": "[i][/i]", "tagL": "]", "tagR": "[", "L": "[i]", "R": "[/i]", "cursorR": "[/i]", "cursorLength": 4, "quickUBBReplace": "[i]replace[/i]" }, "s": { "key": "中划线", "value": "[s][/s]", "tagL": "]", "tagR": "[", "L": "[s]", "R": "[/s]", "cursorR": "[/s]", "cursorLength": 4, "quickUBBReplace": "[s]replace[/s]" }, "lineFeed": { "key": "换行", "value": "[*]", "L": "", "R": "[*]", "cursorL": "[*]", "cursorLength": 3, "quickUBBReplace": "replace[*]" }, "longHorizontalLine": { "key": "水平线", "value": "[hr]", "L": "", "R": "[hr]", "cursorL": "[hr]", "cursorLength": 4, "quickUBBReplace": "replace[hr]" }, "link": { "key": "链接", "value": "[url=][/url]", "tagL": "=", "tagR": "]", "L": "[url=]", "R": "[/url]", "cursorL": "[url=", "cursorLength": 5, "quickUBBReplace": "[url=replace]replace[/url]" }, "hide": { "key": "隐藏", "value": "[hide][/hide]", "tagL": "]", "tagR": "[", "L": "[hide]", "R": "[/hide]", "cursorR": "[/hide]", "cursorLength": 7, "quickUBBReplace": "[hide]replace[/hide]" }, "quote": { "key": "引用", "value": "[quote][/quote]", "tagL": "]", "tagR": "[", "L": "[quote]", "R": "[/quote]", "cursorR": "[/quote]", "cursorLength": 8, "quickUBBReplace": "[quote]replace[/quote]" }, "email": { "key": "邮件", "value": "[email=][/email]", "tagL": "=", "tagR": "]", "L": "[email=]", "R": "[/email]", "cursorL": "[email=", "cursorLength": 7, "quickUBBReplace": "[email=replace]replace[/email]" } }, insertQuickReplyUBB: () => { /* 快捷回复 */ $jq.each(mobile.quickUBB.code, function (index, value) { let ubbs = $jq(`
  • ${value["key"]}
  • `); ubbs.on("click", function () { $jq("#comiis_insert_ubb_tab div.comiis_post_urlico ul li.quickUBBs a.comiis_xifont").removeClass("f_0").addClass("f_d"); $jq(this).find(".comiis_xifont").removeClass("f_d").addClass("f_0"); popup2.confirm({ text: ` `, mask: true, only: true, callback: () => { let userInput = $jq(".quickinsertbbsdialog").val().trim(); if (userInput == null || userInput.trim() == "") { return; } if (value["isFunc"]) { comiis_addsmilies(mobile.quickUBB.set_rainbow(value["num"], userInput)); /* 插入贴内 */ } else if (value["quickUBBReplace"]) { comiis_addsmilies(value["quickUBBReplace"].replaceAll("replace", userInput)); /* 插入贴内 */ } else { comiis_addsmilies(userInput); /* 插入贴内 */ } popup2.confirm_close(); /* if (value["isFunc"]) { userInput = mobile.quickUBB.set_rainbow(value["num"], userInput); }*/ } }) }) $jq("#comiis_insert_ubb_tab div.comiis_post_urlico ul").append(ubbs[0]); }) }, insertReplayUBB: () => { /* 具体回复 */ let insertDOM = $jq(".comiis_post_urlico"); if (!insertDOM) { console.log("未找到插入元素"); return; } GM_addStyle(` #comiis_post_tab .comiis_input_style .comiis_post_urlico li a.f_0{ color: #53bcf5 !important; } `); let parentEle = $jq(".comiis_post_urlico > ul")[0]; let contentEle = $jq("#comiis_post_qydiv > ul"); let childNums = $jq("#comiis_post_qydiv ul li").length; mobile.quickUBB.jqueryExtraFunction(); $jq("#comiis_post_tab .comiis_input_style .comiis_post_urlico li").on("click", function () { $jq("#comiis_post_tab .comiis_input_style .comiis_post_urlico li a").removeClass("f_0"); $jq("#comiis_post_tab .comiis_input_style .comiis_post_urlico li a").addClass("f_d"); $jq(this).find("a").attr("class", "comiis_xifont f_0"); $jq("#comiis_post_qydiv ul li").hide().eq($jq(this).index()).fadeIn(); }) $jq.each(mobile.quickUBB.code, function (key, value) { let ubbs = $jq(`
  • ${value["key"]}
  • `); ubbs.on("click", (e) => { let bottomEle = $jq(`#comiis_post_qydiv li[data-key='${value.key}']`); if (!bottomEle.length) { console.log("未找到该元素"); return } let contentIndex = childNums + Object.keys(mobile.quickUBB.code).indexOf(key); console.log(contentIndex); $jq("#comiis_post_qydiv ul li").hide().eq(contentIndex).fadeIn(); $jq.each($jq("#comiis_post_tab div.comiis_post_urlico ul li a.comiis_xifont"), (i, v) => { v.className = "comiis_xifont f_d"; if (v == e.target) { v.className = "comiis_xifont f_0"; } }); }) parentEle.append(ubbs[0]); let ubbs_content = document.createElement("li"); ubbs_content.setAttribute("style", "display: none;"); ubbs_content.setAttribute("data-key", value["key"]); ubbs_content.innerHTML = `
    `; contentEle.append(ubbs_content); $jq(`.comiis_sendbtn[data-keyI="${key}"]`).on("click", () => { let text = $jq(`#comiis_input_${key}`).val(); if (text == '') { popup2.toast('请输入需要插入的内容'); return; } if (mobile.quickUBB.code[key]["isFunc"]) { text = mobile.quickUBB.set_rainbow(mobile.quickUBB.code[key]["num"], text); } if (mobile.quickUBB.code[key].hasOwnProperty("L")) { text = mobile.quickUBB.code[key]['L'] + text + mobile.quickUBB.code[key]['R']; } $jq("#needmessage").insertAtCaret(text); /* if (mobile.quickUBB.code[key]["tagL"] != undefined || mobile.quickUBB.code[key]["tagR"] != undefined) { $jq("#needmessage").moveCursorInCenterByText(mobile.quickUBB.code[key]["tagL"], mobile.quickUBB.code[key]["tagR"]); }*/ if (mobile.quickUBB.code[key].hasOwnProperty("cursorL")) { $jq("#needmessage").moveCursorToCenterByTextWithLeft(mobile.quickUBB.code[key]["cursorL"], mobile.quickUBB.code[key]["cursorLength"]); } if (mobile.quickUBB.code[key].hasOwnProperty("cursorR")) { $jq("#needmessage").moveCursorToCenterByTextWithRight(mobile.quickUBB.code[key]["cursorR"], mobile.quickUBB.code[key]["cursorLength"]); } }) }); }, set_rainbow: (num, text) => { if (text == "") { return ''; } var wr_text = text; var wr_code, wr_rgb, r, g, b, i, j, istep var wr_rgb1, wr_rgb2, r1, g1, b1, r2, g2, b2 r1 = g1 = b1 = r2 = g2 = b2 = 0; r = 0; g = 0; b = 0; istep = 0; wr_code = ''; if (num == 1) { istep = 40; r = 255; i = 1; j = 0; do { if (wr_text.charCodeAt(j) != 32) { if (g + istep < 256) { if (i == 1) g += istep; } else if (i == 1) { i = 2; g = 255; } if (r - istep > -1) { if (i == 2) r -= istep; } else if (i == 2) { i = 3; r = 0; } if (b + istep < 256) { if (i == 3) b += istep; } else if (i == 3) { i = 4; b = 255; } if (g - istep > -1) { if (i == 4) g -= istep; } else if (i == 4) { i = 5; g = 0; } if (r + istep < 256) { if (i == 5) r += istep; } else if (i == 5) { i = 6; r = 255; } if (b - istep > -1) { if (i == 6) b -= istep; } else if (i == 6) { i = 1; b = 0; } wr_rgb = ''; wr_rgb += parseInt(r).toString(16).length == 1 ? 0 + parseInt(r).toString(16) : parseInt(r).toString(16); wr_rgb += parseInt(g).toString(16).length == 1 ? 0 + parseInt(g).toString(16) : parseInt(g).toString(16); wr_rgb += parseInt(b).toString(16).length == 1 ? 0 + parseInt(b).toString(16) : parseInt(b).toString(16); wr_rgb = wr_rgb.toUpperCase(); wr_code += '[color=#' + wr_rgb + ']' + wr_text.charAt(j) + '[/color]'; } else { wr_code += wr_text.charAt(j); } j++; } while (j < wr_text.length); } else if (num == 2) { istep = 255 / wr_text.length; for (i = 1; i < wr_text.length + 1; i++) { if (wr_text.charCodeAt(i - 1) != 32) { r += istep; g += istep; b += istep; if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255; wr_rgb = ''; wr_rgb += parseInt(r).toString(16).length == 1 ? 0 + parseInt(r).toString(16) : parseInt(r).toString(16); wr_rgb += parseInt(g).toString(16).length == 1 ? 0 + parseInt(g).toString(16) : parseInt(g).toString(16); wr_rgb += parseInt(b).toString(16).length == 1 ? 0 + parseInt(b).toString(16) : parseInt(b).toString(16); wr_rgb = wr_rgb.toUpperCase(); wr_code += '[color=#' + wr_rgb + ']' + wr_text.charAt(i - 1) + '[/color]'; } else { wr_code += wr_text.charAt(i - 1); } } } else if (num == 3) { istep = 255 / wr_text.length; for (i = 1; i < wr_text.length + 1; i++) { if (wr_text.charCodeAt(i - 1) != 32) { r += istep; g = 29; b = 36; if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255; wr_rgb = ''; wr_rgb += parseInt(r).toString(16).length == 1 ? 0 + parseInt(r).toString(16) : parseInt(r).toString(16); wr_rgb += parseInt(g).toString(16).length == 1 ? 0 + parseInt(g).toString(16) : parseInt(g).toString(16); wr_rgb += parseInt(b).toString(16).length == 1 ? 0 + parseInt(b).toString(16) : parseInt(b).toString(16); wr_rgb = wr_rgb.toUpperCase(); wr_code += '[color=#' + wr_rgb + ']' + wr_text.charAt(i - 1) + '[/color]'; } else { wr_code += wr_text.charAt(i - 1); } } } else if (num == 4) { istep = 255 / wr_text.length; for (i = 1; i < wr_text.length + 1; i++) { if (wr_text.charCodeAt(i - 1) != 32) { r = 0; g = 174; b += istep; if (r > 255) r = 255; if (g > 255) g = 255; if (b > 255) b = 255; wr_rgb = ''; wr_rgb += parseInt(r).toString(16).length == 1 ? 0 + parseInt(r).toString(16) : parseInt(r).toString(16); wr_rgb += parseInt(g).toString(16).length == 1 ? 0 + parseInt(g).toString(16) : parseInt(g).toString(16); wr_rgb += parseInt(255 - b).toString(16).length == 1 ? 0 + parseInt(255 - b).toString(16) : parseInt(255 - b).toString(16); wr_rgb = wr_rgb.toUpperCase(); wr_code += '[color=#' + wr_rgb + ']' + wr_text.charAt(i - 1) + '[/color]'; } else { wr_code += wr_text.charAt(i - 1); } } } return wr_code; }, jqueryExtraFunction: () => { $jq.fn.extend({ insertAtCaret: function (myValue) { var $t = $jq(this)[0]; if (document.selection) { this.focus(); var sel = document.selection.createRange(); sel.text = myValue; this.focus(); } else if ($t.selectionStart || $t.selectionStart == '0') { var startPos = $t.selectionStart; var endPos = $t.selectionEnd; var scrollTop = $t.scrollTop; $t.value = $t.value.substring(0, startPos) + myValue + $t.value.substring(endPos, $t.value.length); this.focus(); $t.selectionStart = startPos + myValue.length; $t.selectionEnd = startPos + myValue.length; $t.scrollTop = scrollTop; } else { this.value += myValue; this.focus(); } }, selectRange: function (start, end) { if (end === undefined) { end = start; } return this.each(function () { if ('selectionStart' in this) { this.selectionStart = start; this.selectionEnd = end; } else if (this.setSelectionRange) { this.setSelectionRange(start, end); } else if (this.createTextRange) { var range = this.createTextRange(); range.collapse(true); range.moveEnd('character', end); range.moveStart('character', start); range.select(); } }); }, getCursorPosition: function () { var el = $jq(this)[0]; var pos = 0; if ('selectionStart' in el) { pos = el.selectionStart; } else if ('selection' in document) { el.focus(); var Sel = document.selection.createRange(); var SelLength = document.selection.createRange().text.length; Sel.moveStart('character', -el.value.length); pos = Sel.text.length - SelLength; } return pos; }, moveCursorInCenterByText: function (leftTextFlag, rightTextFlag) { var el = $jq(this)[0]; var el_text = el.value; for (let i = el.selectionStart - 1; i > 0; i--) { let LText = el_text[i - 1]; let currentText = el_text[i]; if (LText == leftTextFlag && currentText == rightTextFlag) { this.selectRange(i); break; } } }, moveCursorToCenterByTextWithLeft: function (leftMatchText, _length_) { var el = $jq(this)[0]; var el_text = el.value; for (let i = el.selectionStart - 1; i > 0; i--) { let lTexts = el_text.substring(i - _length_, i); if (lTexts == leftMatchText) { this.selectRange(i); break; } } }, moveCursorToCenterByTextWithRight: function (rightMatchText, _length_) { var el = $jq(this)[0]; var el_text = el.value; for (let i = el.selectionStart - 1; i > 0; i--) { let rTexts = el_text.substring(i, i + _length_); if (rTexts == rightMatchText) { this.selectRange(i + _length_); break; } } } }); } }, recoveryIMGWidth() { /* 修复图片宽度 */ if (GM_getValue("v16") && window.location.href.match(mt_config.rexp.forum_post)) { GM_addStyle(` .comiis_messages img{ max-width: 100% !important; } `) } }, removeForumPostCommentFontStyle() { /* 移除评论区字体效果 */ if (GM_getValue("v3") && window.location.href.match(mt_config.rexp.forum_post)) { var hide = document.getElementsByTagName('font'); var postForumMain = document.querySelector(".comiis_ordertype") ? document.querySelector(".comiis_postlist.kqide .comiis_postli").innerHTML : ''; for (let i = 0; i < hide.length; i++) { if (postForumMain.indexOf(hide[i].innerHTML) == -1) { console.log(hide[i].innerHTML); hide[i].removeAttribute('color'); hide[i].removeAttribute('style'); hide[i].removeAttribute('size'); } } var content = document.getElementsByClassName("comiis_message bg_f view_all cl message"); for (let i = 0; i < content.length; i++) { if (postForumMain.indexOf(content[i].innerHTML) == -1) { content[i].innerHTML = content[i].innerHTML.replace(mt_config.rexp.font_special, ''); } } } }, removeForumPostFontStyle() { /* 移除帖子内的字体style */ if (GM_getValue("v1") && window.location.href.match(mt_config.rexp.forum_post)) { if ($jq(".comiis_a.comiis_message_table.cl").eq(0).html()) { $jq(".comiis_a.comiis_message_table.cl").eq(0).html($jq(".comiis_a.comiis_message_table.cl").eq(0).html().replace(mt_config.rexp.font_special, '')); } } }, repairClearSearchInput() { /* 修复搜索的清空按钮 */ if (GM_getValue("v36") && window.location.href.match(mt_config.rexp.search_url)) { let $search_input = $jq(".ssclose.bg_e.f_e"); if ($search_input) { $search_input.click(function (e) { e.preventDefault(); $jq("#scform_srchtxt").val("") }) } else { log.error("搜索界面: 获取清空按钮失败"); } } }, repairUnableToEnterOtherSpaceCorrectly() { /* 修复无法正确进入别人的空间 */ if (!GM_getValue("v37")) { return; }; if (window.location.href.match(mt_config.rexp.home_url_brief)) { let href_params = window.location.href.match(/home.php\?(.+)/gi); href_params = href_params[href_params.length - 1]; let params_split = href_params.split("&"); if (params_split.length == 2 && href_params.indexOf("uid=") != -1 && href_params.indexOf("mod=space") != -1) { window.location.href = window.location.href + "&do=profile"; } } if (window.location.href.match(mt_config.rexp.home_url_at)) { let href_params = window.location.href.match(/space-uid-(.+).html/i); href_params = href_params[href_params.length - 1]; window.location.href = `https://bbs.binmt.cc/home.php?mod=space&uid=${href_params}&do=profile`; } }, searchHistory() { /* 搜索历史 */ if (GM_getValue("v19") && location.href.match(mt_config.rexp.search_url)) { function search_event() { /* 搜索历史事件 */ /* 搜索界面增加关闭按钮事件,清空input内容 */ /* 点击搜索保存搜索记录 */ $jq("#scform_submit").click(function () { let getsearchtext = $jq("#scform_srchtxt").val(); if ((getsearchtext != null) && (getsearchtext != "")) { let search_history_array = new Array(getsearchtext); let has_history = GM_getValue("search_history"); if (has_history != null) { if ($jq.inArray(getsearchtext, has_history) != -1) { console.log("已有该搜索历史记录") search_history_array = has_history } else { console.log("无该记录,追加"); search_history_array = search_history_array.concat(has_history); } } else { console.log("空记录,添加") } GM_setValue("search_history", search_history_array); } }) } function add_search_history() { /* 搜索界面添加搜索历史记录 */ $jq("#scform_srchtxt").attr("list", "search_history"); var search_history_list = GM_getValue("search_history"); var dom_datalist = document.createElement("datalist"); dom_datalist.id = "search_history"; var option_text = ""; if (search_history_list) { for (var i = 0; i < search_history_list.length; i++) { option_text = option_text + ' ` }, "建议反馈": { "className": "gm_user_select_feedback", "optionHTML": ` ` }, "站务专区": { "className": "gm_user_select_depot", "optionHTML": ` ` } } if (classifyClassNameDict[section_dict[fid]]) { if ($jq(".comiis_post_from .styli_tit:contains('分类')").length) { $jq(".comiis_post_from .styli_tit:contains('分类')").parent().remove(); } $jq(".comiis_stylino.comiis_needmessage").before($jq(`
  • 分类
  • `)); } else { Object.keys(classifyClassNameDict).forEach(function (key) { $jq(".comiis_post_from ." + classifyClassNameDict[key]["className"]).remove(); }) } $jq('#postform').attr('action', postSection); }); } else { selectNode.attr("disabled", true); } selectNode.val(currentSection).trigger('change'); }, shieldPlate() { /* 屏蔽板块 */ if (window.location.href.match(mt_config.rexp.forum_guide_url)) { let infos = document.querySelectorAll(".comiis_forumlist .forumlist_li"); let black_list = GM_getValue("blacklistplate") || ""; let black_list_array = black_list.split("、"); Array.from(infos).forEach((info) => { let from_plate = (info.querySelector(".forumlist_li_time a.f_d") || info.querySelector(".comiis_xznalist_bk.cl")).outerText; from_plate = from_plate.replace(//g, ""); from_plate = from_plate.replace(/\s*/g, ""); from_plate = from_plate.replace("来自", ""); if (black_list_array.indexOf(from_plate) != -1) { console.log("屏蔽目标板块:" + from_plate); info.setAttribute("style", "display:none !important;"); } }) } }, shieldUser() { /* 屏蔽用户 */ if (window.location.href.match(mt_config.rexp.forum_guide_url) || window.location.href.match(mt_config.rexp.plate_url) || window.location.href.match(mt_config.rexp.forum_post)) { let infos = document.querySelectorAll(".comiis_forumlist .forumlist_li"); /* 帖子外 */ if (!infos.length) { /* 帖子内 */ infos = document.querySelectorAll(".comiis_postlist .comiis_postli"); if (!infos.length) { return; } } let black_list = GM_getValue("blacklistuid") ? GM_getValue("blacklistuid") : ""; let black_list_array = black_list.split(","); Array.from(infos).forEach((info) => { let usr = info.getElementsByClassName("wblist_tximg"); if (!usr.length) { usr = info.getElementsByClassName("postli_top_tximg"); if (!usr.length) { return; } } usr = usr[0].href; let usr_uid = usr.match(mt_config.rexp.mt_uid)[1]; if (black_list_array.indexOf(usr_uid) != -1) { console.log("屏蔽用户:" + usr_uid); info.setAttribute("style", "display:none !important;"); } }) } }, showSignInRanking() { /* 显示签到的最先几个人,最多10个,和顶部的今日签到之星 */ if (window.location.href.match(mt_config.rexp.k_misign_sign)) { let today_ranking_ele = document.querySelector(".comiis_topnv .comiis_flex .flex"); today_ranking_ele.after($jq(`
  • 今日最先
  • `)[0]); let getMaxPage = (urlextra) => { return new Promise(res => { GM_xmlhttpRequest({ url: "https://bbs.binmt.cc/k_misign-sign.html?operation=" + urlextra, async: false, responseType: 'html', headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53" }, onload: function (resp) { let last_page = $jq(resp.responseText).find("#J_list_detail .pg span"); if (last_page.length && typeof last_page[0].title != "undefined") { let last_page_match = last_page[0].title.match(/([0-9]+)/); if (last_page_match.length == 2) { res(last_page_match[last_page_match.length - 1]); } else { popup2.toast("获取页失败"); res(0); } } else { popup2.toast("请求最先签到的页失败"); res(0); } }, onerror: function (resp) { console.log(resp); popup2.toast("网络异常,请重新获取"); res(0); } }) }) } let getPagePeople = (page) => { return new Promise(res => { GM_xmlhttpRequest({ url: "https://bbs.binmt.cc/k_misign-sign.html?operation=list&op=&page=" + page, async: false, responseType: 'html', headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53" }, onload: function (resp) { let peoples = $jq(resp.responseText).find("#J_list_detail tbody tr"); let ret_array = []; if (peoples.length == 2 && peoples[0].textContent.indexOf("暂无内容") != -1) { res(ret_array); return; } for (let i = 1; i <= peoples.length - 2; i++) { let people = peoples[i]; let ret_json = {}; let user_name = people.children[0].getElementsByTagName("a")[0].textContent; let space_url = people.children[0].getElementsByTagName("a")[0].href; let uid = space_url.match(/space-uid-([0-9]*)/)[1]; let sign_all_days = people.children[1].textContent; let sign_month_days = people.children[2].textContent; let sign_time = people.children[3].textContent; let sign_reward = people.children[5].textContent; ret_json["user"] = user_name; ret_json["uid"] = uid; ret_json["avatar"] = "https://avatar-bbs.mt2.cn/uc_server/avatar.php?uid=" + uid + "&size=small"; ret_json["days"] = sign_all_days; ret_json["monthDays"] = sign_month_days; ret_json["time"] = sign_time; ret_json["reward"] = sign_reward; ret_array = ret_array.concat(ret_json); } res(ret_array) }, onerror: function (resp) { console.log(resp); res({}); } }) }) } function changeRankList(data, listtype) { $jq("#ranklist").html(data); $jq('#ranklist').attr('listtype', listtype); } ajaxlist = async (listtype) => { listtype = listtype; if (listtype == 'today') { loadingdelay = false; urlextra = 'list&op=today'; } else if (listtype == 'month') { loadingdelay = false; urlextra = 'list&op=month'; } else if (listtype == 'zong') { loadingdelay = false; urlextra = 'list&op=zong'; } else if (listtype == 'calendar') { loadingdelay = true; urlextra = 'calendar'; } else { loadingdelay = false; urlextra = 'list'; } /* alert(loadingdelay); */ if (listtype == 'todayLatest') { loadingdelay = false; urlextra = 'list&op=&page=0'; let maxPage = await getMaxPage(urlextra); if (maxPage == 0) { return }; let latestPeople = await getPagePeople(maxPage); latestPeople.reverse(); if (latestPeople.length < 10) { let latestPeople_2 = await getPagePeople(maxPage - 1); latestPeople_2.reverse(); latestPeople = latestPeople.concat(latestPeople_2); latestPeople.reverse(); } let peopleHTML = ''; latestPeople.reverse(); console.log(latestPeople); latestPeople.forEach(people => { peopleHTML = peopleHTML + `

    ` + people["user"] + `` + people["time"] + `总天数 ` + people["days"] + `天

    月天数 ` + people["monthDays"] + ` 天 , 上次奖励 ` + people["reward"] + `

    ` }) let latestHTML = `
  • ` + peopleHTML + `
    ` changeRankList(latestHTML, listtype) } else { $jq.ajax({ type: 'GET', url: "plugin.php?id=k_misign:sign&operation=" + urlextra, async: false, dataType: 'html', success: function (data) { /* console.log(data); */ data = data.replace(`今日排行`, `今日排行
  • 今日最先
  • `); changeRankList(data, listtype); }, complete: function (XHR, TS) { XHR = null } }); } } } }, showTodayStar() { /* 显示今日之星,在签到页上 */ if (GM_getValue("v33") && window.location.href.match(mt_config.rexp.k_misign_sign)) { let todayStarParent = $jq(".pg_k_misign .comiis_qdinfo"); let todayStar = document.createElement("ul"); GM_xmlhttpRequest({ url: "/k_misign-sign.html", method: 'get', async: false, headers: { "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.64 Safari/537.36 Edg/101.0.1210.53" }, onload: (r) => { let html = $jq(r.responseText); let todatastarele = html.find("#pt span.xg1"); if (!todatastarele.length) { return; } let todaypeople = todatastarele[0].textContent.replace("今日签到之星:", ''); todayStar.innerHTML = '
  • 今日签到之星' + todaypeople + '
  • '; let comiis_space_box_height = getComputedStyle($jq(".comiis_space_box")[0], null)["height"].replace("px", ""); let comiis_space_box_padding_bottom = getComputedStyle($jq(".comiis_space_box")[0], null)["padding-bottom"].replace("px", ""); comiis_space_box_height = parseInt(comiis_space_box_height); comiis_space_box_padding_bottom = parseInt(comiis_space_box_padding_bottom); let total_height = comiis_space_box_height + comiis_space_box_padding_bottom + 50; GM_addStyle(` .comiis_space_box{ height: ${total_height}px; background-size: 100% 100%; } .pg_k_misign .comiis_qdinfo{ height: 110px !important; }`); todayStarParent.append(todayStar); }, onerror: (r) => { console.log(r); log.error("请求今日之星失败"); } }) } }, showUserUID() { /* 显示用户的uid */ if (GM_getValue("v15") && ((window.location.href.match(mt_config.rexp.forum_post_guide_url) || (window.location.href.match(mt_config.rexp.forum_post)) || (window.location.href.match(mt_config.rexp.plate_url)) || (window.location.href.match(mt_config.rexp.search_url)) || window.location.href.match(/bbs.binmt.cc\/home.php\?mod=space&do=thread&view=me/) || window.location.href.match(/home.php\?mod=space&uid=.+&do=thread&view=me/) ))) { if (!window.GM_isaddShowUidCss) { window.GM_isaddShowUidCss = true; GM_addStyle(` .postli_top_tximg + h2{ height: auto; } `); } window.findUserFormList = false; window.findUserFormListNums = 0; let findSetInval = setInterval(function () { let formList = mt_config.dom_obj.comiis_formlist() ? mt_config.dom_obj.comiis_formlist() : []; formList = formList.length == 0 ? mt_config.dom_obj.comiis_postli() : formList; formList = formList.length == 0 ? mt_config.dom_obj.comiis_mmlist() : formList; window.findUserFormList = formList.length ? true : false; if (findUserFormListNums >= 16) { console.log("已循环16次,未找到帖子"); clearInterval(findSetInval); } if (window.findUserFormList) { GM_addStyle(` .comiis_postli_top.bg_f.b_t h2{ height: auto; }`); function matchUIDByArray(data) { for (let i = 0; i < data.length; i++) { let url = data[i].href; let uid = url.match(mt_config.rexp.mt_uid); if (uid) { return uid[1]; } } return null } $jq.each(formList, (index, value) => { let mtUIDOM = value.getElementsByClassName("mt_uid_set"); if (!mtUIDOM.length) { let childrenByATagetElement = value.getElementsByTagName("a"); let mt_uid = null; mt_uid = matchUIDByArray(childrenByATagetElement); if (mt_uid != null) { let uid_control = document.createElement("a"); let mtUidDomInsertElement = value.getElementsByClassName("top_lev")[0]; let uid_control_height = getComputedStyle(mtUidDomInsertElement, null)["height"]; let uid_control_margin = getComputedStyle(mtUidDomInsertElement, null)["margin"]; let uid_control_padding = getComputedStyle(mtUidDomInsertElement, null)["padding"]; let uid_control_line_height = getComputedStyle(mtUidDomInsertElement, null)["line-height"]; let uid_control_font = getComputedStyle(mtUidDomInsertElement, null)["font"]; let uid_control_bg_color = "#FF7600"; uid_control.className = "mt_uid_set"; uid_control.style = ` font: ${uid_control_font}; background: ${uid_control_bg_color}; color: white; float: left; margin: ${uid_control_margin}; padding: ${uid_control_padding}; height: ${uid_control_height}; line-height: ${uid_control_line_height}; border-radius: 1.5px;`; uid_control.innerHTML = "UID:" + mt_uid; uid_control.onclick = function () { try { GM_setClipboard(mt_uid); popup2.toast(`${mt_uid}已复制`); console.log("复制:", mt_uid) } catch (err) { popup2.toast(`${mt_uid}复制失败`); console.log("复制失败:" + mt_uid, err); } } mtUidDomInsertElement.parentElement.append(uid_control); } } }) console.log("成功找到帖子DOM"); clearInterval(findSetInval); } else { findUserFormListNums += 1; } }, 800) } }, userCheckBoxSettings() { /* 侧边栏配置项 */ function checkboxNode() { return $jq(".whitesevcheckbox"); } function selectedNodeText() { let selectedVal = selectNode().val(); return $jq(`.beauty-select option[value='${selectedVal}']`).text(); } function selectNode() { return $jq(".beauty-select"); } function setCodeNodeCheckedStatus(status) { /* 设置 开关的状态 */ status ? checkboxNode().removeClass("comiis_checkbox_close") : checkboxNode().addClass("comiis_checkbox_close"); } function setLastClickItem() { /* 初始化设置上次点击的select内容 */ let selectNodeNormalVal = GM_getValue("last") == null ? "v2" : GM_getValue("last"); selectNode().val(selectNodeNormalVal); setCodeNodeCheckedStatus(GM_getValue(selectNodeNormalVal) != null ? true : false); } function setSelectNodeChangeEvent() { /* 设置选项的change事件 */ selectNode().change(function () { let selected_value = $jq('.beauty-select').val(); GM_setValue("last", selected_value); let check_value = GM_getValue(selected_value) != null ? true : false; setCodeNodeCheckedStatus(check_value); }); } function setCodeNodeClickEvent() { /* 设置开关的click事件 */ checkboxNode().on("click", (e) => { let selected_value = selectNode().val(); let check_value = GM_getValue(selected_value) != null ? false : true; check_value ? GM_setValue(selected_value, true) : GM_deleteValue(selected_value); let showText = check_value ? '设置-开启' : '设置-关闭'; popup2.toast(showText); setCodeNodeCheckedStatus(check_value); }) } function setSelectNodeCSS() { GM_addStyle(` .beauty-select{ background-color: #fff; height:28px; width: 160px; line-height:28px; border: 1px solid #ececec; background: url(w.png) no-repeat; background-position: 95% 50%; -webkit-appearance: none; /*去掉样式 for chrome*/ appearance:none;/*去掉样式*/ -moz-appearance:none;/*去掉样式*/ }`); } if (window.location.href.match(mt_config.rexp.bbs)) { var setting_content = document.createElement("li"); setting_content.className = "comiis_left_Touch"; setting_content.innerHTML = '