Greasy Fork is available in English.
编程猫发帖防屏蔽防吃格式
当前为
// ==UserScript== // @name 编程猫防屏蔽防吃格式助手 // @namespace https://shequ.codemao.cn/user/201649362 // @version 1.2.0 // @description 编程猫发帖防屏蔽防吃格式 // @author SMYLuke // @match https://shequ.codemao.cn/community // @match https://shequ.codemao.cn/community/ // @match https://shequ.codemao.cn/community?board=* // @icon https://static.codemao.cn/whitef/favicon.ico // @require https://cdn.jsdelivr.net/npm/[email protected] // @require http://greasyfork.icu/scripts/451480-md5%E5%8A%A0%E5%AF%86/code/md5%E5%8A%A0%E5%AF%86.js?version=1094400 // @license MIT // ==/UserScript== onload = async () => { 'use strict'; let link = document.createElement("link"); link.rel = "stylesheet"; link.type = "text/css"; link.href = "https://unpkg.com/[email protected]/dist/css/mdui.min.css"; document.head.appendChild(link); var doNotShield = { width: 640, height: 480, run: async () => { console.log(md5('<link href="https://static.codemao.cn/community/prism/prism.min.css" rel="stylesheet" type="text/css" /><p>test</p>')) const content = document.querySelector(textarea).contentDocument.body; const data = `<link href="https://static.codemao.cn/community/prism/prism.min.css" rel="stylesheet" type="text/css" />${content.innerHTML}`; document.querySelector(textarea).contentDocument.body.innerHTML = `<iframe style="width: ${doNotShield.width}px; height: ${doNotShield.height}px; display: block; margin: 40px auto; max-width: 100%;" class="do-not-shield"></iframe>`; document.querySelector(textarea).contentDocument.querySelector('.do-not-shield').contentDocument.write(` <form method="post" style="display:none;" action="https://codemaoforumstatic.pythonanywhere.com/new"> <textarea name="text"></textarea> <input type="submit"> </form> <script> document.querySelector('textarea').innerHTML = \`${data}\`; console.log(document.querySelector('input')) document.querySelector('input').click(); </script>`); setTimeout(() => {document.querySelector(textarea).contentDocument.querySelector('.do-not-shield').setAttribute('src', '//codemaoforumstatic.pythonanywhere.com/view-hash.html?hash=' + md5(data, 32))}, 1000) } }; 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").addEventListener("click", () => { window.gui.destroy(); }); };