您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
编程猫发帖防屏蔽防吃格式
当前为
// ==UserScript== // @name 编程猫防屏蔽防吃格式助手 // @namespace https://shequ.codemao.cn/user/201649362 // @version 1.0 // @description 编程猫发帖防屏蔽防吃格式 // @author SMYLuke // @match https://shequ.codemao.cn/community // @match https://shequ.codemao.cn/community/ // @match https://shequ.codemao.cn/community?board=* // @match https://shequ.codemao.cn/community#reload // @match https://codemaoblog.pythonanywhere.com/box3/hash/new // @icon https://cdn-community.codemao.cn/47/community/d2ViXzUwMDFfNjI5MDU1XzIyOF8xNjI2NDMyNDQwMDE0XzRlYWZmNzBk.png // @grant GM_xmlhttpRequest // @grant GM_setValue // @grant GM_getValue // @connect codemaoblog.pythonanywhere.com // @require https://cdn.jsdelivr.net/npm/[email protected] // @license MIT // ==/UserScript== if (location.href === 'https://codemaoblog.pythonanywhere.com/box3/hash/new') { GM_setValue('hash', document.body.innerHTML) } else { 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 () => { const content = document.querySelector(textarea).contentDocument.body; const data = `<!DOCTYPE HTML> <html lang="ch-Zh"> <head> <meta charset="utf-8"> <link href="https://static.codemao.cn/community/prism/prism.min.css" rel="stylesheet" type="text/css" /> </head> <body> ${content.innerHTML} </body> </html>`; 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://codemaoblog.pythonanywhere.com/box3/hash/new"> <input name="text"> <input type="submit"> </form> <script> document.querySelector('input').value = \`${data}\`; document.querySelectorAll('input')[1].click(); </script>`); /*GM_xmlhttpRequest({ url: 'http://codemaoblog.pythonanywhere.com/box3/hash/new', method: 'post', data: {'text': data}, binary: true, onload: ({response: res}) => { console.log(res); } });*/ // setTimeout(() => {document.querySelector(textarea).contentDocument.querySelector('.do-not-shield').setAttribute('src', 'https://codemaoblog.pythonanywhere.com/box3/hash.html?hash=' + document.querySelector(textarea).contentDocument.querySelector('.do-not-shield').contentDocument)}, 1000) if (location.href === 'https://shequ.codemao.cn/community#reload') document.querySelector(textarea).contentDocument.querySelector('.do-not-shield').setAttribute('src', 'https://codemaoblog.pythonanywhere.com/box3/hash.html?hash=' + GM_getValue('hash')); else { alert('防屏蔽成功,将重新加载页面,点击发帖按钮后再点击“使用防屏蔽功能”即可'); setTimeout(() => {location.href = 'https://shequ.codemao.cn/community#reload'; location.reload(); }, 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(); }); }; };