// ==UserScript== // @name 编程猫使用优化 // @namespace https://shequ.codemao.cn/user/438403 // @version 1.30.178 // @description 对于在使用编程猫中遇到的各种问题的部分优化 // @author 小鱼yuzifu // @match *://shequ.codemao.cn/* // @icon https://static.codemao.cn/coco/player/unstable/B1F3qc2Hj.image/svg+xml?hash=FlHXde3J3HLj1PtOWGgeN9fhcba3 // @grant GM_xmlhttpRequest // @require https://code.jquery.com/jquery-3.6.1.min.js // @require https://unpkg.com/sweetalert/dist/sweetalert.min.js // @require https://cdn.jsdelivr.net/npm/lil-gui@0.16 // @require https://cdn.jsdelivr.net/npm/tldjs@2.3.1/tld.min.js // @license 616 SB License // @downloadURL none // ==/UserScript== (function () { 'use strict'; if (window.location.href.indexOf("writer") != -1 || window.location.href.indexOf("publish") != -1) { return false } function titleChange(content) { if (document.querySelector("title") && document.querySelector("title").innerHTML != content) { document.querySelector("title").innerHTML = content } } $('head').append('') setInterval(() => { try { if (window.location.href.indexOf("community") != -1) { titleChange("论坛 | 编程猫社区") } if (window.location.href.indexOf("work_shop") != -1) { if (parseInt(window.location.href.slice(25 + 10,)) && document.querySelector(".r-work_shop-r-details--details_wrap .r-work_shop-r-details--header_cont .r-work_shop-r-details--title p")) { titleChange("工作室 | " + document.querySelector(".r-work_shop-r-details--details_wrap .r-work_shop-r-details--header_cont .r-work_shop-r-details--title p").innerHTML + " | 编程猫社区") } else { titleChange("工作室 | 编程猫社区") } } if (window.location.href.indexOf("discover") != -1) { titleChange("发现 | 编程猫社区") } if (window.location.href.indexOf("gallery") != -1) { if (parseInt(window.location.href.slice(25 + 8,)) && document.querySelector(".r-gallery-r-detail--name")) { titleChange("活动 | " + document.querySelector(".r-gallery-r-detail--name").innerHTML + " | 编程猫社区") } else { titleChange("活动 | 编程猫社区") } } if (window.location.href.indexOf("user") != -1) { titleChange("个人中心 | " + document.querySelector(".r-user-c-banner--name").innerHTML + " | 编程猫社区") } if (window.location.href.indexOf("work") != -1) { titleChange("作品 | " + document.querySelector(".r-work-c-work_info--work_name").innerHTML + " | 编程猫社区") } if (window.location.href.indexOf("studio") != -1) { titleChange("活动 | " + document.querySelector(".r-studio--studio_title").innerHTML + " | 编程猫社区") } if (window.location.href.indexOf("setting") != -1) { titleChange("设置 | 编程猫社区") } if (window.location.href.indexOf("course") != -1) { titleChange("课程 | 编程猫社区") } if (window.location.href.indexOf("mall") != -1) { titleChange("素材 | 编程猫社区") } if (window.location.href.indexOf("my") != -1) { titleChange("作品管理 | 编程猫社区") } //尝试制作防劫持 if ((window.location.href.indexOf("message") != -1 || window.location.href.indexOf("community") != -1 || window.location.href.indexOf("wiki/forum/") != -1) && document.querySelector('iframe')) { var iframes = document.querySelectorAll('iframe'); for (var i = 0; i < iframes.length; i++) { if (tldjs.getDomain(iframes[i].getAttribute("src")) != "pickduck.cn") { iframes[i].style.position = 'inherit' if (!iframes[i].getAttribute("sandbox") && iframes[i] != document.querySelector(".mce-edit-area iframe")) { iframes[i].setAttribute("sandbox", 'allow-forms allow-scripts allow-same-origin allow-popups') iframes[i].setAttribute("src", iframes[i].getAttribute("src")) } } } var embeds = document.querySelectorAll('embed'); for (i = 0; i < embeds.length; i++) { var embed_to_iframe = document.createElement("iframe") embed_to_iframe.style.width = embeds[i].style.width embed_to_iframe.style.height = embeds[i].style.height embed_to_iframe.setAttribute("src", embeds[i].getAttribute("src")) embeds[i].parentNode.replaceChild(embed_to_iframe, embeds[i]); } } if (document.querySelector(".r-404--container") != null) { titleChange("404 | 编程猫社区") if (document.querySelector("a").innerHTML == "返回首页") { document.querySelector("a").innerHTML = "3秒后返回首页" } else { if (document.querySelector("a").innerHTML != "返回首页喽~") { document.querySelector("a").innerHTML = ((parseFloat(document.querySelector("a").innerHTML.slice(0,)) * 10 - 1) / 10) + "秒后返回首页" } if (Math.ceil(parseFloat(document.querySelector("a").innerHTML.slice(0,))) == "0") { window.location.href = "https://shequ.codemao.cn/" document.querySelector("a").innerHTML = "返回首页喽~" } } } } catch (e) { } }, 100) GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/creation-tools/v1/user/center/honor", data: document.cookie, binary: true, async onload({ response }) { /* 这里是自定义Logo */ $(".c-navigator--logo_wrap img").remove() let PICKCAT = localStorage.getItem('customLogo') || "PICKCAT"; $(".c-navigator--logo_wrap").append(`${PICKCAT}`) if (localStorage.getItem('customLogo') == "赛马娘") { swal({ title: "俺の愛馬が!" }) .then(() => { new Audio("https://static.codemao.cn/coco/player/unstable/SyisvMdzh.audio/wav?hash=Fk-Rt4mrWi5ORbC1AD8qs49BFPhJ").play() }) } $("li[data-watch_event='下载APP-入口tab']").after(`
  • 设置
  • `); document.documentElement.style.setProperty('--main-color', localStorage.getItem('main-color') || '#fec433'); document.documentElement.style.setProperty('--second-color', localStorage.getItem('second-color') || '#f6b206'); document.documentElement.style.setProperty('--person-setting', localStorage.getItem('person-setting') || 'pic'); document.documentElement.style.setProperty('--person-color', localStorage.getItem('person-color') || '#000'); document.documentElement.style.setProperty('--person-bg', localStorage.getItem('person-bg') || 'url(https://cdn-community.codemao.cn/community_frontend/asset/banner_65b4a.png)'); document.documentElement.style.setProperty('--highlight-color', localStorage.getItem('highlight-color') || '#ec443d'); document.documentElement.style.setProperty('--isLevelShown', localStorage.getItem('isLevelShown') || ''); try { document.querySelector('meta[name="theme-color"]').content = localStorage.getItem('main-color') || '#fec433' } catch (e) { } $(".c-dialog--dialog_cover").after(`
    导航栏标题
    主题设置
    浅色 深色 自动
    主色调
    辅色调
    突出色调
    个人中心背景
    图片 纯色
    等级显示
    铃铛红点清除
    作品再创作查询
    账号“登录用户名”设置
    编创协Markdown编辑器
    论坛自动翻页(实验性)
    首页排版
    新人指导 代码岛3.0精选 点猫精选 新作喵喵看 训练师小课堂 优秀工作室 原创少儿小说 编程TV 社区星推荐
    自定义CSS样式
    `); if ((window.location.href.indexOf("work/") != -1) && (parseInt(window.location.href.slice(25 + 5,)))) { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/creation-tools/v1/works/" + parseInt(window.location.href.slice(25 + 5,)), data: document.cookie, binary: true, async onload({ response }) { if (JSON.parse(response).type == 'NEMO') { setInterval(() => { if (document.querySelector('.r-work-c-player--player_fun .r-work-c-player--player_rotate_screen') == null) { $('.r-work-c-player--player_full_screen').after(``); $(".r-work-c-player--player_fun .r-work-c-player--player_rotate_screen").click(function () { rotateDeg -= 90; document.documentElement.style.setProperty('--rotateDeg', 'rotate(' + rotateDeg + 'deg)'); document.documentElement.style.setProperty('--OppoRotateDeg', 'rotate(' + -rotateDeg + 'deg)'); //document.getElementById('player_cover').contentWindow.document.querySelector('body').style.transform='rotate(' + -rotateDeg + 'deg)' }) } if (document.querySelector('.r-work-c-player--player_control_bar .r-work-c-player--player_rotate_screen') == null) { $('.r-work-c-player--player_control_bar .r-work-c-player--reset_btn').css("right", 136 + 'px') $('.r-work-c-player--quit_fullscreen_btn').before(`
    旋转屏幕
    `); $(".r-work-c-player--player_control_bar .r-work-c-player--player_rotate_screen").click(function () { rotateDeg -= 90; document.documentElement.style.setProperty('--rotateDeg', 'rotate(' + rotateDeg + 'deg)'); document.documentElement.style.setProperty('--OppoRotateDeg', 'rotate(' + -rotateDeg + 'deg)'); //document.getElementById('player_cover').contentWindow.document.querySelector('body').style.transform='rotate(' + -rotateDeg + 'deg)' }) } }, 100) var rotateDeg = 0 } } }) } var theme, whiles function to_light() { theme = "light" document.documentElement.style.setProperty('--main-color', localStorage.getItem('main-color') || '#fec433'); document.documentElement.style.setProperty('--second-color', localStorage.getItem('second-color') || '#f6b206'); document.querySelector('meta[name="theme-color"]').content = localStorage.getItem('main-color') || '#fec433' clearInterval(whiles) whiles = setInterval(() => { try { document.querySelector('.forum_editor .mce-edit-area.mce-container.mce-panel iframe').contentWindow.document.body.style.backgroundColor = '' document.querySelector('.forum_editor .mce-edit-area.mce-container.mce-panel iframe').contentWindow.document.body.style.color = '' } catch (e) { } }) if ((window.location.href.indexOf("community") != -1 || window.location.href.indexOf("wiki/forum/") != -1) && parseInt(window.location.href.slice(25 + 10,)) && document.querySelector('iframe[allowfullscreen]')) { document.querySelector('iframe[allowfullscreen]').src = document.querySelector('iframe[allowfullscreen]').src if (document.querySelector('iframe[allowfullscreen]').attachEvent) { document.querySelector('iframe[allowfullscreen]').attachEvent("onload", function () { document.querySelector('iframe[allowfullscreen]').contentWindow.postMessage('light', '*'); }); } else { document.querySelector('iframe[allowfullscreen]').onload = function () { document.querySelector('iframe[allowfullscreen]').contentWindow.postMessage('light', '*'); }; } } try { $(".darkmode").remove() } catch (e) { } } function to_dark() { theme = "dark" document.documentElement.style.setProperty('--main-color', '#666666'); document.documentElement.style.setProperty('--second-color', '#525252'); document.querySelector('meta[name="theme-color"]').content = '#666666' clearInterval(whiles) whiles = setInterval(() => { try { document.querySelector('.forum_editor .mce-edit-area.mce-container.mce-panel iframe').contentWindow.document.body.style.backgroundColor = '#525252' document.querySelector('.forum_editor .mce-edit-area.mce-container.mce-panel iframe').contentWindow.document.body.style.color = '#fff' } catch (e) { } }) if ((window.location.href.indexOf("community") != -1 || window.location.href.indexOf("wiki/forum/") != -1) && parseInt(window.location.href.slice(25 + 10,)) && document.querySelector('iframe[allowfullscreen]')) { document.querySelector('iframe[allowfullscreen]').src = document.querySelector('iframe[allowfullscreen]').src if (document.querySelector('iframe[allowfullscreen]').attachEvent) { document.querySelector('iframe[allowfullscreen]').attachEvent("onload", function () { document.querySelector('iframe[allowfullscreen]').contentWindow.postMessage('dark', '*'); }); } else { document.querySelector('iframe[allowfullscreen]').onload = function () { document.querySelector('iframe[allowfullscreen]').contentWindow.postMessage('dark', '*'); }; } } $("head").append(` `) } $("body").after(``) $('#custom-sett textarea').on('change', () => { localStorage.setItem('custom-sett', document.querySelector('#custom-sett textarea').value) document.querySelector('#custom-setts').innerHTML = document.querySelector('#custom-sett textarea').value }) $('input#main-color').on('change', () => { localStorage.setItem('main-color', document.querySelector('input#main-color').value); if (theme == 'light') { document.documentElement.style.setProperty('--main-color', document.querySelector('input#main-color').value); document.querySelector('meta[name="theme-color"]').content = localStorage.getItem('main-color') || '#fec433' } }) $('input#second-color').on('change', () => { if (theme == 'light') { document.documentElement.style.setProperty('--second-color', document.querySelector('input#second-color').value); } localStorage.setItem('second-color', document.querySelector('input#second-color').value); }) $('input#highlight-color').on('change', () => { document.documentElement.style.setProperty('--highlight-color', document.querySelector('input#highlight-color').value); localStorage.setItem('highlight-color', document.querySelector('#highlight-color').value); }) $('input#level-shown').on('change', () => { if (document.querySelector('input#level-shown').checked) { document.documentElement.style.setProperty('--isLevelShown', ''); localStorage.setItem('isLevelShown', ''); } else { document.documentElement.style.setProperty('--isLevelShown', 'none'); localStorage.setItem('isLevelShown', 'none'); } }) $('input#auto-turn').on('change', () => { if (document.querySelector('input#auto-turn').checked) { localStorage.setItem('auto-turn', 'true'); } else { localStorage.setItem('auto-turn', ''); } }) $('input#md-use').on('change', () => { if (document.querySelector('input#md-use').checked) { localStorage.setItem('md-use', 'true'); } else { localStorage.setItem('md-use', ''); swal("将要刷新页面以保存修改", { buttons: ["取消", "确认"], }) .then((value) => { if (value) { window.location.reload(); } }) } }) $('input#customLogo').on('change', () => { localStorage.setItem('customLogo', document.querySelector('input#customLogo').value); $(".c-navigator--logo_wrap img").remove() let PICKCAT = localStorage.getItem('customLogo') || "PICKCAT"; if (document.querySelector('.pickcat')) { document.querySelector('.pickcat').innerHTML = PICKCAT } else { $(".c-navigator--logo_wrap").append(`${PICKCAT}`) } }) $('input[value="pic"]').on('change', () => { document.documentElement.style.setProperty('--person-color', ''); document.documentElement.style.setProperty('--person-bg', localStorage.getItem('person-bg') || 'url(https://cdn-community.codemao.cn/community_frontend/asset/banner_65b4a.png)'); localStorage.setItem('person-setting', 'pic'); document.documentElement.style.setProperty('--person-setting', 'pic'); document.querySelector('#person-bg-btn').style.display = 'block'; document.querySelector('#person-color').style.display = 'none'; if ((window.location.href.indexOf("user") != -1) && (JSON.parse(response).user_id != parseInt(window.location.href.slice(25 + 5,)))) { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/creation-tools/v1/user/center/honor?user_id=" + parseInt(window.location.href.slice(25 + 5,)), data: document.cookie, binary: true, async onload({ response }) { if (JSON.parse(response).user_cover == '') { document.documentElement.style.setProperty('--person-bg', 'url(https://cdn-community.codemao.cn/community_frontend/asset/banner_65b4a.png)'); document.documentElement.style.setProperty('--person-color', ''); } else { document.documentElement.style.setProperty('--person-bg', 'url(' + JSON.parse(response).user_cover + ')'); document.documentElement.style.setProperty('--person-color', ''); } } }) } }) $('input[value="color"]').on('change', () => { document.documentElement.style.setProperty('--person-color', localStorage.getItem('person-color') || '#000'); document.documentElement.style.setProperty('--person-bg', ''); localStorage.setItem('person-setting', "color"); document.documentElement.style.setProperty('--person-setting', "color"); document.querySelector('#person-bg-btn').style.display = 'none'; document.querySelector('#person-color').style.display = 'block' if ((window.location.href.indexOf("user") != -1) && (JSON.parse(response).user_id != parseInt(window.location.href.slice(25 + 5,)))) { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/creation-tools/v1/user/center/honor?user_id=" + parseInt(window.location.href.slice(25 + 5,)), data: document.cookie, binary: true, async onload({ response }) { if (JSON.parse(response).user_cover == '') { document.documentElement.style.setProperty('--person-bg', 'url(https://cdn-community.codemao.cn/community_frontend/asset/banner_65b4a.png)'); document.documentElement.style.setProperty('--person-color', ''); } else { document.documentElement.style.setProperty('--person-bg', 'url(' + JSON.parse(response).user_cover + ')'); document.documentElement.style.setProperty('--person-color', ''); } } }) } }) $('input[fish]').on('change', function () { document.querySelector('li[data-watch_event="' + this.value + '-入口tab"]').style.display = this.checked ? '' : 'none'; localStorage.setItem('isShown' + this.value, this.checked); }) $('input[fish2]').on('change', function () { document.documentElement.style.setProperty(this.value, this.checked ? '' : 'none'); localStorage.setItem(this.value, this.checked ? '' : 'none'); }) $('input[value="light"]').on('change', function () { localStorage.setItem('theme', "light"); to_light() }) $('input[value="dark"]').on('change', function () { localStorage.setItem('theme', "dark"); to_dark() }) $('input[value="auto"]').on('change', function () { localStorage.setItem('theme', "auto"); if (!window.matchMedia("(prefers-color-scheme: light)").matches) { to_dark() } else { to_light() } }) $('#person-color').on('change', function () { document.documentElement.style.setProperty('--person-color', this.value); localStorage.setItem('person-color', this.value); }) $('#person-bg-btn').on('click', function () { document.querySelector('#person-bg').click() }) if (localStorage.getItem('isLevelShown') == 'none') { document.querySelector('input#level-shown').checked = false; } else { document.querySelector('input#level-shown').checked = true; } var i; for (i of document.querySelectorAll('input[fish]')) { if (localStorage.getItem('isShown' + i.value) != null) { if (localStorage.getItem('isShown' + i.value) == 'true') { document.querySelector('li[data-watch_event="' + i.value + '-入口tab"]').style.display = '' i.checked = true } else { document.querySelector('li[data-watch_event="' + i.value + '-入口tab"]').style.display = 'none' i.checked = false } } } for (i of document.querySelectorAll('input[fish2]')) { if (localStorage.getItem(i.value) != null) { if (localStorage.getItem(i.value) == 'none') { document.documentElement.style.setProperty(i.value, 'none'); i.checked = false } else { document.documentElement.style.setProperty(i.value, ''); i.checked = true } } } $('#person-bg').on('change', function () { var file = this.files[0]; if (!/image\/\w+/.test(file.type)) { return false; } if (typeof FileReader != 'undefined') { var reader = new FileReader(); var imgFile; reader.readAsDataURL(file); reader.onload = function (e) { imgFile = e.target.result; document.documentElement.style.setProperty('--person-bg', 'url(' + imgFile + ')'); localStorage.setItem('person-bg', 'url(' + imgFile + ')'); }; } else { var URL = window.URL || window.webkitURL; var imageURL = URL.createObjectURL(file); document.documentElement.style.setProperty('--person-bg', 'url(' + imageURL + ')'); localStorage.setItem('person-bg', 'url(' + imageURL + ')'); } }) function remixCheck(num, list) { if (num.length == 0) { return list } for (var a of num) { if (a.is_published == 1 || a.is_published == 0) { try { list[0].push(a.id) list[1].push(a.author.nickname) list[2].push(a.is_published) } catch (e) { } } if (a.children != "[]") { remixCheck(a.children) } } return list } $('#remixCheck-btn').on('click', () => { var inputment = document.createElement("input"); inputment.className = "swal-content__input" if ((window.location.href.indexOf("work/") != -1) && (parseInt(window.location.href.slice(25 + 5,)))) { inputment.value = parseInt(window.location.href.slice(25 + 5,)) } else { inputment.value = '' } swal("请输入你要查询的作品ID", { content: inputment, }) .then((value) => { if (value) { if (inputment.value != '') { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/tiger/work/tree/" + inputment.value, data: document.cookie, binary: true, async onload({ response }) { if (response == undefined) { swal({ title: "错误", text: "未知原因", icon: "error" }) } else if (JSON.parse(response).children == undefined) { swal({ title: "错误", text: "请检查一下自己的作品ID是否输入正确!", icon: "error" }) } else { var s = remixCheck(JSON.parse(response).children, [[], [], []]) if (s[0].length != 0) { var copymefuck = document.createElement("table"); copymefuck.style = "width:100%;border-spacing: 10px;" for (var ppp = 0; ppp < s[0].length; ppp++) { var aaa = document.createElement("tr") aaa.setAttribute("published", s[2][ppp]) aaa.innerHTML += "" + s[0][ppp] + "" + s[1][ppp] + "" copymefuck.appendChild(aaa) } swal({ content: copymefuck, title: "有" + s[0].length + "个再创作了!", icon: "warning" }) document.querySelector('.swal-content').style = "max-height: 400px;overflow: auto;" $(copymefuck).before("

    隐藏未发布的

    ") $('.pubornot').on('click', function () { if (document.querySelector('.pubornot').id == "hidenotpub") { $('tr[published="0"]').css("display", "none") document.querySelector('.swal-title').innerHTML = "有" + document.querySelectorAll('tr[published="1"]').length + "个再创作并发布的了!" document.querySelector('.pubornot').id = "shownotpub" document.querySelector('.pubornot').innerHTML = "显示未发布的" } else { $('tr[published="0"]').css("display", "") document.querySelector('.swal-title').innerHTML = "有" + s[0].length + "个再创作了!" document.querySelector('.pubornot').id = "hidenotpub" document.querySelector('.pubornot').innerHTML = "隐藏未发布的" } }) } else { swal({ title: "好耶!", text: "目前没有人再创作并发布此作品!", icon: "success" }) } } } }) } else { swal({ title: "错误", text: "请输入作品ID!", icon: "error" }) } } }); }) $('#username-btn').on('click', () => { var inputment = document.createElement("input"); inputment.className = "swal-content__input" swal({ title: "请输入你要更改的登录用户名", text: "这个用户名将作为你的登录账号使用", content: inputment, }) .then((value) => { if (value) { if (inputment.value != '') { swal({ title: "警告", text: `你的用户名是:${inputment.value}\n这里作再三强调,只能修改一次\n你确定吗?`, icon: "warning", dangerMode: true, buttons: true }) .then((value) => { if (value) { $.ajax({ type: "PATCH", url: "https://api.codemao.cn/tiger/v3/web/accounts/username", contentType: "application/json;charset=UTF-8", data: JSON.stringify({ username: inputment.value, }), dataType: "json", xhrFields: { withCredentials: true }, success: function () { swal({ title: "成功", text: `你现在的用户名是:${inputment.value}\n以后你就可以用这个来登录你的编程猫账号了!`, icon: "success" }) }, error: function (res) { swal({ title: "错误", text: res.responseJSON.error_message, icon: "error" }) console.log(res.responseJSON); } }); } }) } else { swal({ title: "错误", text: "请输入用户名!", icon: "error" }) } } }) }) /*这里不知道为啥不能for整,所以只好这样*/ $('#mess-del-btn').on('click', () => { swal({ text: "开始清除!", buttons: false, timer: 3000 }) GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/message-record?query_type=LIKE_FORK&limit=200&offset=0", data: document.cookie, binary: true, async onload({ response }) { for (var y = 0; y < JSON.parse(response).total; y += 200) { messDel(y, "LIKE_FORK") } } }) GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/message-record?query_type=SYSTEM&limit=200&offset=0", data: document.cookie, binary: true, async onload({ response }) { for (var y = 0; y < JSON.parse(response).total; y += 200) { messDel(y, "SYSTEM") } } }) GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/message-record?query_type=COMMENT_REPLY&limit=200&offset=0", data: document.cookie, binary: true, async onload({ response }) { for (var y = 0; y < JSON.parse(response).total; y += 200) { messDel(y, "COMMENT_REPLY") } swal({ text: "你的铃铛红点已清除,再也不会急死强迫症的你了~", buttons: false, timer: 3000 }) } }) }) async function messDel(offset, types) { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/message-record?query_type=" + types + "&limit=200&offset=" + offset, data: document.cookie, binary: true, async onload({ response }) { } }) } const addRipple = function (e) { let overlay = $("
    ") overlay.removeClass("animate"); const x = parseInt(e.pageX - $(this).offset().left) - (overlay.width() / 2); const y = parseInt(e.pageY - $(this).offset().top) - (overlay.height() / 2); overlay.css( { left: x, top: y } ).addClass("animate"); $(this).append(overlay) setTimeout(() => { overlay.remove() }, 500) } let rippleList = ['.c-navigator--header-content .c-navigator--nav_wrap .c-navigator--item a', ".c-navigator--dropdown-wrap li a", ".r-community--send_btn", "li[data-watch_event='旋转-入口tab']", ".r-community-c-forum_sender--option", ".r-home-c-community_star--user_recommend_item", ".r-user-c-banner--btn", ".c-navigator--logout", ".c-navigator--cont .c-navigator--item", ".r-community-c-forum_sender--select_area span", ".r-community--forum_list div li", ".r-community--board_item", ".r-home-c-work_card--work_card" ] setInterval(() => { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/creation-tools/v1/user/center/honor", data: document.cookie, binary: true, async onload({ response }) { var options if (JSON.parse(response).user_id) { if (!localStorage.getItem('user' + JSON.parse(response).user_id)) { localStorage.setItem('user' + JSON.parse(response).user_id, JSON.parse(response).fans_total + "," + JSON.parse(response).liked_total) } if (localStorage.getItem('user' + JSON.parse(response).user_id).split(',')[0] != JSON.parse(response).fans_total) { options = { body: `现在你的粉丝数为:${JSON.parse(response).fans_total},比上次多了${JSON.parse(response).fans_total - localStorage.getItem('user' + JSON.parse(response).user_id).split(',')[0]}个`, icon: "https://static.codemao.cn/coco/player/unstable/B1F3qc2Hj.image/svg+xml?hash=FlHXde3J3HLj1PtOWGgeN9fhcba3", tag: "fans_total" } var n = Notification.requestPermission(function (status) { new Notification("粉丝数", options); // 显示通知 }); } if (localStorage.getItem('user' + JSON.parse(response).user_id).split(',')[1] != JSON.parse(response).liked_total) { options = { body: `现在你的点赞数为:${JSON.parse(response).liked_total},比上次多了${JSON.parse(response).liked_total - localStorage.getItem('user' + JSON.parse(response).user_id).split(',')[1]}个`, icon: "https://static.codemao.cn/coco/player/unstable/B1F3qc2Hj.image/svg+xml?hash=FlHXde3J3HLj1PtOWGgeN9fhcba3", tag: "liked_total" } var k = Notification.requestPermission(function (status) { new Notification("点赞数", options); // 显示通知 }); } localStorage.setItem('user' + JSON.parse(response).user_id, JSON.parse(response).fans_total + "," + JSON.parse(response).liked_total) } } } ) GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/message-record/count", data: document.cookie, binary: true, async onload({ response }) { try { $("li[data-watch_event='消息-评论'] a .c-navigator--reply_count").css("display", "none") $("li[data-watch_event='消息-赞'] a .c-navigator--reply_count").css("display", "none") $("li[data-watch_event='消息-系统'] a .c-navigator--reply_count").css("display", "none") $(".c-navigator--message span").css("display", "none") } catch (error) { } if (JSON.parse(response)[0].count == 0) { if (document.querySelector("li[data-watch_event='消息-评论'] a .c-navigator--reply_count")) { $("li[data-watch_event='消息-评论'] a .c-navigator--reply_count").css("display", "none") } } else { if (document.querySelector("li[data-watch_event='消息-评论'] a .c-navigator--reply_count")) { $("li[data-watch_event='消息-评论'] a .c-navigator--reply_count:first-child").css("display", "") document.querySelector("li[data-watch_event='消息-评论'] a .c-navigator--reply_count").innerHTML = `(${JSON.parse(response)[0].count})` } else { $("li[data-watch_event='消息-评论'] a").append(`(${JSON.parse(response)[0].count})`) } } if (JSON.parse(response)[1].count == 0) { if (document.querySelector("li[data-watch_event='消息-赞'] a .c-navigator--reply_count")) { $("li[data-watch_event='消息-赞'] a .c-navigator--reply_count").css("display", "none") } } else { if (document.querySelector("li[data-watch_event='消息-赞'] a .c-navigator--reply_count")) { $("li[data-watch_event='消息-赞'] a .c-navigator--reply_count:first-child").css("display", "") document.querySelector("li[data-watch_event='消息-赞'] a .c-navigator--reply_count").innerHTML = `(${JSON.parse(response)[1].count})` } else { $("li[data-watch_event='消息-赞'] a").append(`(${JSON.parse(response)[1].count})`) } } if (JSON.parse(response)[2].count == 0) { if (document.querySelector("li[data-watch_event='消息-系统'] a .c-navigator--reply_count")) { $("li[data-watch_event='消息-系统'] a .c-navigator--reply_count").css("display", "none") } } else { if (document.querySelector("li[data-watch_event='消息-系统'] a .c-navigator--reply_count")) { $("li[data-watch_event='消息-系统'] a .c-navigator--reply_count:first-child").css("display", "") document.querySelector("li[data-watch_event='消息-系统'] a .c-navigator--reply_count").innerHTML = `(${JSON.parse(response)[2].count})` } else { $("li[data-watch_event='消息-系统'] a").append(`(${JSON.parse(response)[2].count})`) } } if (JSON.parse(response)[0].count + JSON.parse(response)[1].count + JSON.parse(response)[2].count == 0) { if (document.querySelector(".c-navigator--message span")) { $(".c-navigator--message span").css("display", "none") } } else { if (document.querySelector(".c-navigator--message span")) { $(".c-navigator--message span:first-child").css("display", "") document.querySelector(".c-navigator--message span").innerHTML = `${JSON.parse(response)[0].count + JSON.parse(response)[1].count + JSON.parse(response)[2].count > 99 ? "99+" : JSON.parse(response)[0].count + JSON.parse(response)[1].count + JSON.parse(response)[2].count}` } else { $(".c-navigator--message").append(`${JSON.parse(response)[0].count + JSON.parse(response)[1].count + JSON.parse(response)[2].count > 99 ? "99+" : JSON.parse(response)[0].count + JSON.parse(response)[1].count + JSON.parse(response)[2].count}`) } } } }) }, 1000) setInterval(() => { try { $(".r-home-c-creativityComponent--creativity .r-home-c-creativityComponent--box .r-home-c-creativityComponent--detail .r-home-c-creativityComponent--text-box .r-home-c-creativityComponent--introduction img").attr("src", "https://static.codemao.cn/coco/player/unstable/r1Z2a8yEj.image/png?hash=Fpf08Z93Z-LgvoMLKzbyACyAvroC") } catch (e) { } for (i of rippleList) { if (!$(i).hasClass('yzf-animate')) { $(i).addClass("yzf-animate") $(i).css({ position: 'relative', overflow: 'hidden', transition: '0.1s ease-in' }) if (i == ".r-home-c-community_star--user_recommend_item") { $(i).children("a").mousedown(addRipple) } else { $(i).mousedown(addRipple) } } } if (((window.location.href.indexOf("community") != -1) || (window.location.href.indexOf("wiki") != -1)) && !(parseInt(window.location.href.slice(25 + 10,))) && (window.location.href.indexOf("wiki/forum/") == -1)) { if (Boolean(localStorage.getItem('md-use')) && document.getElementsByClassName("r-community-c-forum_sender--option")[0].style.display != 'none') { bcx_markdown() } var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; var windowHeight = document.documentElement.clientHeight || document.body.clientHeight; var scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; $(".r-community--scroll_to_top").remove() if (document.querySelector('#yzfnb') == null) { $(".r-index--main_cont").after('
    ') } if (scrollTop + windowHeight >= scrollHeight) { try { if (Boolean(localStorage.getItem('auto-turn'))) { document.documentElement.scrollTop = 0 document.querySelector('.r-community--forum_list .c-pagination--btn.c-pagination--page-container li:last-child').click() } } catch (err) { } } } try { var reactTinymce = document.querySelector('.mce-edit-area iframe') for (i of reactTinymce.contentWindow.document.querySelectorAll('img')) { if (i.className.indexOf("encode") == -1) { i.src = i.src i.className = 'encode' i.removeAttribute('alt') } }; } catch (e) { } if ((window.location.href.indexOf("community") != -1) || (window.location.href.indexOf("wiki/forum/") != -1)) { /* if (document.querySelector('.r-community--forum_list2') == null) { $('.r-community--forum_list').after("") } if (document.querySelector('.r-community--forum_list div:not(div[class])') != null && document.querySelector(".r-community--forum_filter") != null && document.querySelector("#fan") == null) { var forum_list = document.querySelectorAll('.r-community--forum_list div:not(div[class])') for (i of forum_list) { let oCopy = i.cloneNode(true) $('.r-community--forum_list2').append(oCopy) } $('.r-community--forum_list div:not(div[class])').css('display', 'none') $('.r-community--forum_filter').after(document.querySelector('.r-community--forum_list2').innerHTML) $('.r-community--forum_list').append("
    ") }*/ } if ((window.location.href.indexOf("/message") != -1)) { scrollTop = document.documentElement.scrollTop || document.body.scrollTop; windowHeight = document.documentElement.clientHeight || document.body.clientHeight; scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight; try { document.querySelector('.r-message--load_more').style.opacity = 0 } catch (err) { } if (scrollTop + windowHeight >= scrollHeight) { try { document.querySelector('.r-message--load_more').click() } catch (err) { } } var user_face for (user_face of document.querySelectorAll('.r-message-c-comments--user_face')) { if (user_face.className.indexOf("encode") == -1) { user_face.classList.add("encode"); user_face_now(user_face) } } for (user_face of document.querySelectorAll('.r-message-c-buy--user_face')) { if (user_face.className.indexOf("encode") == -1) { user_face.classList.add("encode"); user_face_now(user_face) } } for (user_face of document.querySelectorAll('.r-message-c-system_message--user_face')) { if (user_face.className.indexOf("encode") == -1) { user_face.classList.add("encode"); user_face_now(user_face) } } } }, 100) function user_face_now(user_face) { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/creation-tools/v1/user/center/honor?user_id=" + user_face.href.slice(25 + 5,), data: document.cookie, binary: true, async onload({ response }) { if (!JSON.parse(response).avatar_url) { user_face.style.backgroundImage = "url('https://cdn-community.codemao.cn/47/community/d2ViXzEwMDFfMTYwMTg3NDJfMTYwMTg3NDJfMTYyNjU3ODkzOTI2M185MGJlYmIyNQ.png')" user_face.style.filter = "grayscale(1)"; } else { user_face.style.backgroundImage = "url('" + JSON.parse(response).avatar_url + "')" } } }) } document.querySelector('#custom-sett textarea').value = localStorage.getItem('custom-sett') document.querySelector('#custom-setts').innerHTML = document.querySelector('#custom-sett textarea').value $("head").append(` `); $("head").append(` `); $("li[data-watch_event='设置-入口tab']").click(function () { $("#yzf-settings").css("display", "block") $("#yzf-settings").css("transform", "translateY(0)") $("#yzf-close").click(() => { $(".c-dialog--dialog_wrap").css("opacity", "0"); $("#yzf-settings").css("transform", "translateY(-20px)") setTimeout(() => { $('.c-dialog--dialog_wrap').removeClass('c-dialog--visiable c-dialog--show') $(".c-dialog--dialog_wrap").css("opacity", ""); $("#yzf-settings").css("display", "none") }, 200) }) $("#main-color").val(localStorage.getItem('main-color') || '#fec433') $("#second-color").val(localStorage.getItem('second-color') || '#f6b206') $("#person-color").val(localStorage.getItem('person-color') || '#000') $("#highlight-color").val(localStorage.getItem('highlight-color') || '#ec443d') document.querySelector('input#md-use').checked = Boolean(localStorage.getItem('md-use')) ? true : false document.querySelector('input#auto-turn').checked = Boolean(localStorage.getItem('auto-turn')) ? true : false $(".c-dialog--dialog_wrap").addClass('c-dialog--visiable c-dialog--show') }); if (localStorage.getItem('theme') == 'light' || localStorage.getItem('theme') == null) { document.querySelector('input[value="light"]').checked = true to_light() } else if (localStorage.getItem('theme') == 'dark') { document.querySelector('input[value="dark"]').checked = true to_dark() } else { if (localStorage.getItem('theme') == 'auto') { document.querySelector('input[value="auto"]').checked = true const themeMedia = window.matchMedia("(prefers-color-scheme: light)"); if (!themeMedia.matches) { to_dark() } else { to_light() } themeMedia.addListener(e => { if (localStorage.getItem('theme') == 'auto') { if (!e.matches) { to_dark() } else { to_light() } } }); } } if (localStorage.getItem('person-setting') == 'color') { document.querySelector('input[value="color"]').checked = true document.querySelector('#person-bg-btn').style.display = 'none'; document.querySelector('#person-color').style.display = 'block'; document.documentElement.style.setProperty('--person-color', localStorage.getItem('person-color') || '#000'); document.documentElement.style.setProperty('--person-bg', ''); } else { document.querySelector('input[value="pic"]').checked = true document.querySelector('#person-bg-btn').style.display = 'block'; document.querySelector('#person-color').style.display = 'none'; document.documentElement.style.setProperty('--person-color', ''); document.documentElement.style.setProperty('--person-bg', localStorage.getItem('person-bg') || 'url(https://cdn-community.codemao.cn/community_frontend/asset/banner_65b4a.png)'); } if ((window.location.href.indexOf("user") != -1) && (JSON.parse(response).user_id != parseInt(window.location.href.slice(25 + 5,)))) { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/creation-tools/v1/user/center/honor?user_id=" + parseInt(window.location.href.slice(25 + 5,)), data: document.cookie, binary: true, async onload({ response }) { if (JSON.parse(response).user_cover == '') { document.documentElement.style.setProperty('--person-bg', 'url(https://cdn-community.codemao.cn/community_frontend/asset/banner_65b4a.png)'); document.documentElement.style.setProperty('--person-color', ''); } else { document.documentElement.style.setProperty('--person-bg', 'url(' + JSON.parse(response).user_cover + ')'); document.documentElement.style.setProperty('--person-color', ''); } } }) } } }) $("head").append(` `); class Circle { constructor({ origin, speed, color, angle, context }) { this.origin = origin this.position = { ...this.origin } this.color = color this.speed = speed this.angle = angle this.context = context this.renderCount = 0 } draw() { this.context.fillStyle = this.color this.context.beginPath() this.context.arc(this.position.x, this.position.y, 2, 0, Math.PI * 2) this.context.fill() } move() { this.position.x = (Math.sin(this.angle) * this.speed) + this.position.x this.position.y = (Math.cos(this.angle) * this.speed) + this.position.y + (this.renderCount * 0.3) this.renderCount++ } } class Boom { constructor({ origin, context, circleCount = 16, area }) { this.origin = origin this.context = context this.circleCount = circleCount this.area = area this.stop = false this.circles = [] } randomArray(range) { const length = range.length const randomIndex = Math.floor(length * Math.random()) return range[randomIndex] } randomColor() { const range = ['8', '9', 'A', 'B', 'C', 'D', 'E', 'F'] return '#' + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) + this.randomArray(range) } randomRange(start, end) { return (end - start) * Math.random() + start } init() { for (let i = 0; i < this.circleCount; i++) { const circle = new Circle({ context: this.context, origin: this.origin, color: this.randomColor(), angle: this.randomRange(Math.PI - 1, Math.PI + 1), speed: this.randomRange(1, 6) }) this.circles.push(circle) } } move() { this.circles.forEach((circle, index) => { if (circle.position.x > this.area.width || circle.position.y > this.area.height) { return this.circles.splice(index, 1) } circle.move() }) if (this.circles.length == 0) { this.stop = true } } draw() { this.circles.forEach(circle => circle.draw()) } } class CursorSpecialEffects { constructor() { this.computerCanvas = document.createElement('canvas') this.renderCanvas = document.createElement('canvas') this.computerContext = this.computerCanvas.getContext('2d') this.renderContext = this.renderCanvas.getContext('2d') this.globalWidth = window.innerWidth this.globalHeight = window.innerHeight this.booms = [] this.running = false } handleMouseDown(e) { const boom = new Boom({ origin: { x: e.clientX, y: e.clientY }, context: this.computerContext, area: { width: this.globalWidth, height: this.globalHeight } }) boom.init() this.booms.push(boom) this.running || this.run() } handlePageHide() { this.booms = [] this.running = false } init() { const style = this.renderCanvas.style style.position = 'fixed' style.top = style.left = 0 style.zIndex = '999999999999999999999999999999999999999999' style.pointerEvents = 'none' style.width = this.renderCanvas.width = this.computerCanvas.width = this.globalWidth style.height = this.renderCanvas.height = this.computerCanvas.height = this.globalHeight document.body.append(this.renderCanvas) window.addEventListener('mousedown', this.handleMouseDown.bind(this)) window.addEventListener('pagehide', this.handlePageHide.bind(this)) } run() { this.running = true if (this.booms.length == 0) { return this.running = false } requestAnimationFrame(this.run.bind(this)) this.computerContext.clearRect(0, 0, this.globalWidth, this.globalHeight) this.renderContext.clearRect(0, 0, this.globalWidth, this.globalHeight) this.booms.forEach((boom, index) => { if (boom.stop) { return this.booms.splice(index, 1) } boom.move() boom.draw() }) this.renderContext.drawImage(this.computerCanvas, 0, 0, this.globalWidth, this.globalHeight) } } const cursorSpecialEffects = new CursorSpecialEffects() cursorSpecialEffects.init() //声明一下,这个是经过冷鱼授权的了(他的委托),所以并上去了 function bcx_markdown() { try { var box = document.querySelector('.mce-tinymce') box.style.display = 'none'; document.getElementsByClassName("r-community-c-forum_sender--container")[0].style.width = '100%'; document.getElementsByClassName("r-community-c-forum_sender--option")[0].style.display = 'none'; var doNotShield = { obj: { height: 380, mddata: '带全屏按钮+文本', banner: '', lx: '', lxx: '', fq: '', cs: 0, id: 0, name: '', xjm: '', cookie: '', tzidc: '', gs: '', ram: 0, user: '', avatar_url: '', bcmid: '', csa: 0, yqtz: '', size: '', js: '' }, beign: async () => { if (doNotShield.obj.csa == 1) { alert('你目前在测试,无法进行创建正式帖哦!请刷新网页再试!'); } else { if (document.getElementsByClassName("r-community-c-forum_sender--title_input")[0].value == '') { alert('请先在 (【发帖关键字】请输入标题(5-50字符以内】)输入框内写上本次文章标题。'); } else { doNotShield.obj.name = document.getElementsByClassName("r-community-c-forum_sender--title_input")[0].value; if (doNotShield.obj.cs == 0) { doNotShield.obj.cs += 1; GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/users/details", data: document.cookie, binary: true, async onload({ response }) { doNotShield.obj.id = JSON.parse(response).id; doNotShield.obj.user = JSON.parse(response).nickname; doNotShield.obj.avatar_url = JSON.parse(response).avatar_url; GM_xmlhttpRequest({ method: "get", url: "https://api.bcmcreator.cn/MD/edit/examples/savea.php?id=" + doNotShield.obj.id + "&name=" + doNotShield.obj.name, binary: true, async onload({ response }) { doNotShield.obj.xjm = response; var p = document.createElement('iframe'); p.height = "1000px"; p.width = "100%"; p.id = "myFrame"; p.src = "https://api.bcmcreator.cn/MD/edit/examples/full.php?id=" + doNotShield.obj.id + "&xjm=" + doNotShield.obj.xjm + "&name=" + doNotShield.obj.name; p.scrolling = "no"; box.parentNode.insertBefore(p, box); }, }); }, }); } else { alert('你已经创建Markdown帖子了,不能再创建,请在帖子内修改。'); } } } }, run: async () => { if (doNotShield.obj.csa == 1) { alert('你目前在测试,无法进行发布哦!只有正式帖才能发布,请刷新网页吧!'); } else { try { if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '热门活动') { doNotShield.obj.fq = '17'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '积木编程乐园') { doNotShield.obj.fq = '2'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '工作室&师徒') { doNotShield.obj.fq = '10'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '你问我答') { doNotShield.obj.fq = '5'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '神奇代码岛') { doNotShield.obj.fq = '3'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '图书馆') { doNotShield.obj.fq = '27'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == 'CoCo应用创作') { doNotShield.obj.fq = '2'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == 'Python乐园') { doNotShield.obj.fq = '11'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '源码精灵') { doNotShield.obj.fq = '26'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == 'NOC编程猫比赛') { doNotShield.obj.fq = '13'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '灌水池塘') { doNotShield.obj.fq = '7'; } if (document.getElementsByClassName("r-community-c-forum_sender--active")[0].innerText == '训练师小课堂') { doNotShield.obj.fq = '28'; } if (doNotShield.obj.mddata == '带全屏按钮+文本') { doNotShield.obj.lx = '1'; doNotShield.obj.lxx = '2'; } else { doNotShield.obj.lx = '2'; doNotShield.obj.lxx = '3'; } doNotShield.obj.ram = Math.ceil(Math.random() * 999999999); doNotShield.obj.gs = new Object(); doNotShield.obj.gs.content = '

    ' + doNotShield.obj.js + '

    '; doNotShield.obj.gs.title = doNotShield.obj.name; GM_xmlhttpRequest({ url: "https://api.codemao.cn/web/forums/boards/" + doNotShield.obj.fq + "/posts", method: "POST", data: JSON.stringify(doNotShield.obj.gs), headers: { "Content-type": "application/json;charset=UTF-8", "User-Agent": "Mozilla/4.0 (compatible; MSIE .0; Windows NT 6.1; Trident/4.0; SLCC2;)", "Host": "api.codemao.cn", "Cookie": document.cookie }, async onload({ response }) { doNotShield.obj.bcmid = JSON.parse(response).id; GM_xmlhttpRequest({ method: "get", url: "https://api.bcmcreator.cn/MD/bcmFORM.php?name=" + doNotShield.obj.name + "&id=" + doNotShield.obj.id + "&xjm=" + doNotShield.obj.xjm + "&ram=" + doNotShield.obj.ram + "&bcmid=" + doNotShield.obj.bcmid + "&tx=" + doNotShield.obj.avatar_url + "&user=" + doNotShield.obj.user, async onload({ response }) { if (doNotShield.obj.bcmid != undefined) { window.open('https://shequ.codemao.cn/community/' + doNotShield.obj.bcmid); } else { alert('发帖失败,原因是:' + response); } }, }); } }); } catch (err) { alert('请选择发帖分区!'); } } }, tz: async () => { if (doNotShield.obj.mddata == '带全屏按钮+文本') { doNotShield.obj.lx = '1'; } else { doNotShield.obj.lx = '2'; } window.open('https://api.bcmcreator.cn/MD/bcmMD.php?width=' + doNotShield.obj.height + '&title=' + document.getElementsByClassName("r-community-c-forum_sender--title_input")[0].value + '&md=' + doNotShield.obj.xjm + '&k=' + doNotShield.obj.lx + '&id=' + doNotShield.obj.id); }, tzid: async () => { if (doNotShield.obj.csa == 1) { alert('你目前在测试,无法进行导入帖子哦!请刷新网页才可以导入!'); } else { if (doNotShield.obj.size != '') { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/users/details", data: document.cookie, binary: true, async onload({ response }) { doNotShield.obj.id = JSON.parse(response).id; GM_xmlhttpRequest({ method: "get", url: "https://api.bcmcreator.cn/MD/getMD.php?id=" + doNotShield.obj.id + "&lj=" + doNotShield.obj.size.split("{!")[1].split("!}")[0], binary: true, async onload({ response }) { doNotShield.obj.xjm = JSON.parse(response).xjm; doNotShield.obj.name = JSON.parse(response).name; document.getElementsByClassName("r-community-c-forum_sender--title_input")[0].value = doNotShield.obj.name; var p = document.createElement('iframe'); p.height = "1000px"; p.width = "100%"; p.id = "myFrame"; p.src = "https://api.bcmcreator.cn/MD/edit/examples/full.php?id=" + doNotShield.obj.id + "&xjm=" + doNotShield.obj.xjm + "&name=" + doNotShield.obj.name; p.scrolling = "no"; box.parentNode.insertBefore(p, box); }, }); } }) } else { if (doNotShield.obj.tzidc == '') { alert('请输入论坛帖子ID,才能导入进来哦!'); } else { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/users/details", data: document.cookie, binary: true, async onload({ response }) { doNotShield.obj.id = JSON.parse(response).id; GM_xmlhttpRequest({ method: "get", url: "https://api.bcmcreator.cn/MD/getMD.php?id=" + doNotShield.obj.id + "&bcmid=" + doNotShield.obj.tzidc, binary: true, async onload({ response }) { doNotShield.obj.xjm = JSON.parse(response).xjm; doNotShield.obj.name = JSON.parse(response).name; document.getElementsByClassName("r-community-c-forum_sender--title_input")[0].value = doNotShield.obj.name; var p = document.createElement('iframe'); p.height = "1000px"; p.width = "100%"; p.id = "myFrame"; p.src = "https://api.bcmcreator.cn/MD/edit/examples/full.php?id=" + doNotShield.obj.id + "&xjm=" + doNotShield.obj.xjm + "&name=" + doNotShield.obj.name; p.scrolling = "no"; box.parentNode.insertBefore(p, box); }, }); } }) } } } }, cs: async () => { if (doNotShield.obj.csa == 1) { alert('你目前在测试,无法进行发布哦!只有正式帖才能发布,请刷新网页吧!'); } else { doNotShield.obj.csa = 1; var p = document.createElement('iframe'); p.height = "1000px"; p.width = "100%"; p.id = "myFrame"; p.src = "https://api.bcmcreator.cn/MD/edit/examples/full.php"; p.scrolling = "no"; box.parentNode.insertBefore(p, box); } } }; GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/users/details", data: document.cookie, binary: true, async onload({ response }) { GM_xmlhttpRequest({ method: "get", url: "https://api.bcmcreator.cn/MD/bcmGetMD.php?id=" + JSON.parse(response).id, binary: true, async onload({ response }) { doNotShield.obj.yqtz = JSON.parse(response).data; }, }); } }) document.querySelector("#root > div > div.r-index--main_cont > div > div.r-community--right_search_container > div > div.r-community--search_header > a.r-community--send_btn").addEventListener("click", () => { window.gui = new lil.GUI({ title: "编创协Markdown编辑器" }); window.gui.domElement.style.top = "unset"; window.gui.domElement.style.bottom = "0"; window.gui.domElement.style.userSelect = "none"; const first = window.gui.addFolder('初次使用'); first.add(doNotShield, "cs").name("[测试]本地Markdown帖子"); first.add(doNotShield, "beign").name("正式创建Markdown帖子"); const styles = window.gui.addFolder('样式处理'); styles.add(doNotShield.obj, 'height', 380, 8000).name("帖子高度(px)"); styles.add(doNotShield.obj, 'mddata', ['带全屏按钮+文本', '纯文本']).name("帖子类型"); styles.add(doNotShield.obj, 'banner').name("小banner链接(可空)"); styles.add(doNotShield.obj, 'js').name("简要介绍(可空,字数<42)"); styles.add(doNotShield, "tz").name("预览效果"); const send = window.gui.addFolder('发帖按钮'); send.add(doNotShield, "run").name("发布帖子"); const anaphasis = window.gui.addFolder('后期维护'); anaphasis.add(doNotShield.obj, 'size', doNotShield.obj.yqtz.split("#¥")).name("已创建"); anaphasis.add(doNotShield.obj, 'tzidc').name("帖子ID"); anaphasis.add(doNotShield, "tzid").name("导入帖子"); }); document.querySelector("#root > div > div.r-index--main_cont > div > div:nth-child(4) > div > div.c-model_box--content_wrap > div > a").addEventListener("click", () => { window.gui.destroy() }); } catch (err) { } } })();