// ==UserScript== // @name 编创协Markdown编辑器 // @namespace https://bcmcreator.cn/ // @version 1.5 // @description Markdown编辑器,直接替换编程猫社区论坛内置编辑器,让你的编辑器更好用! // @author 冷鱼闲风 // @match https://shequ.codemao.cn/community // @match https://shequ.codemao.cn/community?board=* // @icon https://pandao.github.io/editor.md/favicon.ico // @grant GM_xmlhttpRequest // @connect * // @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); document.getElementsByClassName("c-model_box--title")[0].style.display= 'none'; document.getElementById("mceu_11").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 box = document.getElementById("mceu_11"); 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:''}, beign: async () => { 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 () => { 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 = '