// ==UserScript== // @name 编程猫使用优化 // @namespace https://shequ.codemao.cn/user/438403 // @version 1.38.236 // @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://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/jquery/3.6.0/jquery.min.js // @require https://lf26-cdn-tos.bytecdntp.com/cdn/expire-1-M/sweetalert/2.1.2/sweetalert.min.js // @require https://fastly.jsdelivr.net/npm/lil-gui@0.16 // @require https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/tldjs/2.3.1/tld.min.js // @require https://lf9-cdn-tos.bytecdntp.com/cdn/expire-1-M/viewerjs/1.10.4/viewer.min.js // @require https://greasyfork.org/scripts/465118-librarycomment/code/libraryComment.js?version=1229105 // @license 616 SB License // @downloadURL none // ==/UserScript== (function () { "use strict"; if (window.location.href.indexOf("writer") != -1) { return false; } if (window.location.href.indexOf("publish") != -1) { let publish_on = setInterval(() => { if (window.location.href.indexOf("publish") == -1) { window.location.reload(); clearInterval(publish_on); } }, 100); return false; } function titleChange(content) { if (document.querySelector("title") && document.querySelector("title").innerHTML != content) { document.querySelector("title").innerHTML = content; } } $("head").append( ` ` ); if (!document.querySelector('meta[name="theme-color"]')) { $("head").append(``); } setInterval(() => { GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/creation-tools/v1/user/center/honor", data: document.cookie, binary: true, onload({ response }) { localStorage.setItem("twikoo", `{"nick":"${JSON.parse(response).nickname}","mail":"","link":"${"https://shequ.codemao.cn/user/" + JSON.parse(response).user_id}"}`); }, }); try { if (window.location.href.indexOf("community") != -1 || window.location.href.indexOf("wiki/forum") != -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 + " | 编程猫社区"); if (document.querySelector(".c-model_box--show:not(.target,.abc) .r-work_shop-r-details-component-project_dialog--project_box_wrap")) { document.querySelector(".c-model_box--show:not(.target)").classList.add("target"); document.querySelector(".c-model_box--show .r-work_shop-r-details-component-project_dialog--project_box_wrap").classList.add("target"); $(".c-model_box--show .r-work_shop-r-details-component-project_dialog--project_box_wrap").after("
"); $(".c-model_box--show .r-work_shop-r-details-component-project_dialog--project_box_wrap.target").remove(); $(".c-model_box--show .r-work_shop-r-details-component-project_dialog--project_box_wrap").append( `隐藏未发布的
"); $(".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", ".r-community--search_container .r-community--my_options .r-community--option", ".r-gallery-c-theme_card--card_item", ]; 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-reactid='.0.0.0.0.0.3.0.0.1.0.0'] .index__reply_count___1nqAb")) { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.0'] .index__reply_count___1nqAb").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 (document.querySelector("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.0'] .index__reply_count___1nqAb")) { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.0'] a span.index__reply_count___1nqAb:nth-child(2)").css("display", ""); document.querySelector("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.0'] .index__reply_count___1nqAb").innerHTML = `(${JSON.parse(response)[0].count})`; } else { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.0'] 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-reactid='.0.0.0.0.0.3.0.0.1.0.1'] .index__reply_count___1nqAb")) { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.1'] .index__reply_count___1nqAb").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 (document.querySelector("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.1'] .index__reply_count___1nqAb")) { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.1'] a span.index__reply_count___1nqAb:nth-child(2)").css("display", ""); document.querySelector("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.1'] .index__reply_count___1nqAb").innerHTML = `(${JSON.parse(response)[1].count})`; } else { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.1'] 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-reactid='.0.0.0.0.0.3.0.0.1.0.2'] .index__reply_count___1nqAb")) { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.2'] .index__reply_count___1nqAb").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 (document.querySelector("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.2'] .index__reply_count___1nqAb")) { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.2'] a span.index__reply_count___1nqAb:nth-child(2)").css("display", ""); document.querySelector("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.2'] .index__reply_count___1nqAb").innerHTML = `(${JSON.parse(response)[2].count})`; } else { $("li[data-reactid='.0.0.0.0.0.3.0.0.1.0.2'] 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(".index__user_wrap___11XZU .index__message___3tAMD span")) { $(".index__user_wrap___11XZU .index__message___3tAMD 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}` ); } if (document.querySelector(".index__user_wrap___11XZU .index__message___3tAMD span")) { $(".index__user_wrap___11XZU .index__message___3tAMD span:first-child").css("display", ""); document.querySelector(".index__user_wrap___11XZU .index__message___3tAMD 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 { $(".index__user_wrap___11XZU .index__message___3tAMD").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) { for (h of document.querySelectorAll(i)) { if (!$(h).hasClass("yzf-animate")) { $(h).addClass("yzf-animate"); $(h).css({ position: "relative", overflow: "hidden", transition: "0.1s ease-in", }); if (i == ".r-home-c-community_star--user_recommend_item") { $(h).children("a").mousedown(addRipple); } else { $(h).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 && window.location.href.indexOf("wiki/book") == -1 && window.location.href.indexOf("wiki/cartoon") == -1 && window.location.href.indexOf("wiki/novel") == -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(() => { if (document.querySelector(".c-dialog--dialog_wrap")) { $(".c-dialog--dialog_wrap").removeClass("c-dialog--visiable c-dialog--show"); $(".c-dialog--dialog_wrap").css("opacity", ""); $("#yzf-settings").css("display", "none"); } else { $(".c-dialog--dialog_cover").fadeOut(200); $("#yzf-settings").fadeOut(200); } }, 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; if (document.querySelector(".c-dialog--dialog_wrap")) { $(".c-dialog--dialog_wrap").addClass("c-dialog--visiable c-dialog--show"); } else { $(".c-dialog--dialog_cover").css("zIndex", "100").fadeIn(200); } }); 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)"); } GM_xmlhttpRequest({ method: "get", url: "https://api.codemao.cn/web/users/details", data: document.cookie, binary: true, async onload({ response }) { if (window.location.href.indexOf("user") != -1 && JSON.parse(response).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.querySelector(".r-user-c-banner--banner .r-user-c-banner--background").style.setProperty("background-image", "url(https://cdn-community.codemao.cn/community_frontend/asset/banner_65b4a.png)", "important"); } else { document.querySelector(".r-user-c-banner--banner .r-user-c-banner--background").style.setProperty("background-image", "url(" + JSON.parse(response).user_cover + ")", "important"); } }, }); } }, }); } }, 100); })(); $("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 = '