Wikidot-Emoji

Put some emoji on the textarea.

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Wikidot-Emoji
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Put some emoji on the textarea.
// @author       HelloOSMe
// @match        http://*.wikidot.com/*
// @match        https://*.wikidot.com/*
// @grant        none
// ==/UserScript==
function show_bar(){
    setTimeout(()=>show_emoji_bar(),2000);
    setTimeout(()=>show_emoji_bar_editpage(),2000);
}
function show(){
    var a=document.getElementsByClassName('options'),c="",b="",d=document.getElementsByClassName('post-container');
    var j=3;
    for(var i=0;i<d.length;i++){
        c=d[i].id;
        c=c.slice(1);
        c=c.slice(1);
        c=c.slice(1);
        c=c.slice(1);
        b=a[j].innerHTML;
        a[j].innerHTML="<strong><a href=\"javascript:;\" onclick=\"postReply(event,"+c+");setTimeout(()=>show_emoji_bar(),2000);\" class=\"btn btn-small btn-sm\">回复</a></strong>"+b;
        console.log(d[i]);
        console.log(i);
        console.log(a[j]);
        console.log(j);
        j=j+4;
    }
}
function send_to_script(){
    var a=document.head || document.getElementsByTagName('head')[0],b=document.createElement('script'),d=document.createElement('style');
    var c=["function show_emoji_bar(){",
    "var a=document.getElementById('np-editor-panel'),b=document.createElement('div');",
    "var c=\"<ul>\";",
    "for(var i=0;i<29;i++){",
    "    if(i>9){",
    "        c+=\"<li><a style=\\\"background:#77777744!important;margin:1px;border:#77777777 solid 1px;\\\" href=\\\"javascript:;\\\" onclick=\\\"$j('textarea').val($j('textarea').val()+'[[image http://图.tk/\"+String.fromCharCode(i+97-10)+\"]]');\\\"><img alt=\\\"\\\" width=\\\"22px\\\" src=\\\"http://图.tk/\"+String.fromCharCode(i+97-10)+\"\\\"/></a></il>\";",
    "    }else{",
    "        c+=\"<li><a style=\\\"background:#77777744!important;margin:1px;border:#77777777 solid 1px;\\\" href=\\\"javascript:;\\\" onclick=\\\"$j('textarea').val($j('textarea').val()+'[[image http://图.tk/\"+String.fromCharCode(i+48)+\"]]');\\\"><img alt=\\\"\\\" width=\\\"22px\\\" src=\\\"http://图.tk/\"+String.fromCharCode(i+48)+\"\\\"/></a></il>\";",
    "    }",
    "}",
    "c+=\"</ul>\";",
    "b.innerHTML=c;",
    "a.appendChild(b);}",
    "function show_emoji_bar_editpage(){",
    "var a=document.getElementById('wd-editor-toolbar-panel'),b=document.createElement('div');",
    "var c=\"<ul>\";",
    "for(var i=0;i<29;i++){",
    "    if(i>9){",
    "        c+=\"<li><a style=\\\"background:#77777744!important;margin:1px;border:#77777777 solid 1px;\\\" href=\\\"javascript:;\\\" onclick=\\\"$j('textarea').val($j('textarea').val()+'[[image http://图.tk/\"+String.fromCharCode(i+97-10)+\"]]');\\\"><img alt=\\\"\\\" width=\\\"22px\\\" src=\\\"http://图.tk/\"+String.fromCharCode(i+97-10)+\"\\\"/></a></il>\";",
    "    }else{",
    "        c+=\"<li><a style=\\\"background:#77777744!important;margin:1px;border:#77777777 solid 1px;\\\" href=\\\"javascript:;\\\" onclick=\\\"$j('textarea').val($j('textarea').val()+'[[image http://图.tk/\"+String.fromCharCode(i+48)+\"]]');\\\"><img alt=\\\"\\\" width=\\\"22px\\\" src=\\\"http://图.tk/\"+String.fromCharCode(i+48)+\"\\\"/></a></il>\";",
    "    }",
    "}",
    "c+=\"</ul>\";",
    "b.innerHTML=c;",
    "a.appendChild(b);}"].join('\n');
    b.innerHTML=c;
    a.appendChild(b);
    d.innerHTML=".options a.btn-primary{display:none;}";
    a.appendChild(d);
}
(function() {
    'use strict';
    send_to_script();
    if(document.getElementsByTagName('textarea').length==0){
        WIKIDOT.modules.ForumViewThreadModule.listeners.newPost(event,null);
    }
    show_bar();
    setTimeout(()=>show(),1000);
})();