// ==UserScript== // @name 快捷回复乌龟 // @namespace http://tampermonkey.net/ // @version 1.1 // @description 不用拉到最下面就可以回复乌龟表情了 // @author RustyHare // @match *://*.scboy.cc/* // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; //想加表情的话,在这一行里面加东西就行 var imagesNumber=[3,81,156,136,1]; //语法规则:在方括号里面,每两个数值之间加逗号,两端不用加 //比方说:默认是 //var imagesNumber=[3,81,156,136,1]; //加一个赤小兔的135,就变成了 //var imagesNumber=[3,81,156,136,1,135]; //前面不用加两个斜线。斜线表示这行是注释,是不会被程序读取的。 if(window.location.href.indexOf("thread")>-1){ var tid=window.location.href.slice(window.location.href.indexOf("thread")+7,window.location.href.indexOf(".htm")) var emotion=document.getElementById("advanced_reply").parentElement; var textarea=document.getElementById("message"); var ol=document.getElementsByClassName("breadcrumb")[0]; var quickreply=document.createElement("div"); quickreply.style.height="100%"; quickreply.style.position="absolute"; quickreply.style.right="20px"; var replytext=document.createElement("span"); replytext.innerText="快捷回复:"; replytext.id="replytext"; quickreply.appendChild(replytext); var ddiv=document.createElement("div"); ddiv.innerText="快捷添加表情:"; imagesNumber.forEach(function(num){ let img=document.createElement("img"); img.src="https://www.scboy.cc/plugin/scboy_moj/face/sb/"+num.toString()+".png"; img.style.height="21px"; img.dataset.num=num.toString(); img.onclick=function(e){ replytext.innerText="正在发送:"; $.post("?post-create-"+tid+"-1.htm",{ 'doctype':1, 'return_html':0, 'quotepid':0, 'message':'[png:sb:'+e.target.dataset.num.toString()+']' },function(data,status){ if(status=="success"){ replytext.innerText="回复"+e.target.dataset.num.toString()+"成功:"; }else{ replytext.innerText="出问题了:"; } }); } quickreply.appendChild(img); let imgd=document.createElement("img"); imgd.src="https://www.scboy.cc/plugin/scboy_moj/face/sb/"+num.toString()+".png"; imgd.style.width="40px"; imgd.dataset.num=num.toString(); imgd.onclick=function(e){ $('#message').insertAtCaret('[png:sb:'+e.target.dataset.num.toString()+']'); } ddiv.appendChild(imgd); }); ol.appendChild(quickreply); emotion.parentElement.insertBefore(ddiv,emotion); } })();