// ==UserScript== // @name 编程猫防屏蔽防吃格式助手 // @namespace https://shequ.codemao.cn/user/201649362 // @version 0.6 // @description 编程猫发帖防屏蔽防吃格式 // @author SMYLuke // @match https://shequ.codemao.cn/community // @match https://shequ.codemao.cn/community?board=* // @icon https://cdn-community.codemao.cn/47/community/d2ViXzUwMDFfNjI5MDU1XzIyOF8xNjI2NDMyNDQwMDE0XzRlYWZmNzBk.png // @grant GM_xmlhttpRequest // @connect static.box3.codemao.cn // @require https://cdn.jsdelivr.net/npm/lil-gui@0.16 // @license MIT // @downloadURL none // ==/UserScript== onload = (async () => { 'use strict'; let link = document.createElement("link"); link.rel = "stylesheet"; link.type = "text/css"; link.href = "https://unpkg.com/mdui@1.0.2/dist/css/mdui.min.css"; document.head.appendChild(link); var doNotShield = { width: 640, height: 480, run: async () => { const content = document.querySelector(textarea).contentDocument.body; const data = `
${encodeURI(content.innerHTML)} `; GM_xmlhttpRequest({ method: "post", url: "https://static.box3.codemao.cn/block", data: data, binary: true, async onload({ response }) { document.querySelector(textarea).contentDocument.body.innerHTML = ``; }, }); } }; const textarea = "#react-tinymce-0_ifr"; 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: "编程猫防屏蔽防吃格式助手"}); window.gui.domElement.style.top = "unset"; window.gui.domElement.style.bottom = "0"; window.gui.domElement.style.userSelect = "none"; window.gui.add(doNotShield, "width", 10, 1000, 10).name("宽度(px)"); window.gui.add(doNotShield, "height", 10, 1000, 10).name("高度(px)"); window.gui.add(doNotShield, "run").name("使用防屏蔽功能"); }); document.querySelector("#root > div > div.r-index--main_cont > div > div:nth-child(4) > div > div.c-model_box--content_wrap > div > a").contenDocument.body.addEventListener("click", () => { window.gui.destroy(); }); });