// ==UserScript==
// @name Custom emoji for scboy.com
// @namespace http://tampermonkey.net/
// @version 0.8
// @description Add custom external emoji to comments
// @author tianyi
// @include https://www.scboy.com/*
// ==/UserScript==
(function() {
'use strict';
let ueDocument;
let styles = `
<style>
.custom-images-picker {
padding: 0 10px;
}
.custom-images-picker ul {
padding: 0;
margin: 0;
}
.custom-images-picker ul li {
display: inline-block;
margin-right: 5px;
cursor: pointer;
width: 50px;
height: 50px;
background-size: 50px 50px;
}
#edui116_body .edui-dialog-foot {
position: relative;
display: inline-block;
height: auto;
}
#edui116_body .edui-dialog-foot #edui116_buttons {
position: relative;
float: right;
padding-bottom: 10px;
}
</style>`;
let urlData = [
{
name: '无语',
url: 'https://pic.youran.me/images/2020/01/17/5f4385db3c9806b08ea15bd9ff444af9d9fe0c3a.png100w_100h.png'
},
{
name: '怒了',
url: 'https://pic.youran.me/images/2020/01/17/5d7c8307af10540909fce6121066249df3935a24.png100w_100h.png'
},
{
name: '柯南',
url: 'https://pic.youran.me/images/2020/01/17/4fac414b5002c3739b1ae24f2fc27b5f150ade24.png100w_100h.png'
},
{
name: '应援',
url: 'https://pic.youran.me/images/2020/01/17/2ab983b2519dc241666254de8e5352fbeedc96bb.png100w_100h.png'
},
{
name: '小智',
url: 'https://pic.youran.me/images/2020/01/17/0edeeb0d10d44302854e636c47f5dc3aa96a9206.png100w_100h.png'
},
{
name: '前排',
url: 'https://pic.youran.me/images/2020/01/17/fbbc45e7aee2f256f691df539db0cfcc35b3be7d.png100w_100h.png'
},
{
name: '吃包',
url: 'https://pic.youran.me/images/2020/01/17/f8cdabfc1b81fd25b85b8457ee49a20a4fc5d91b.png100w_100h.png'
},
{
name: '问号',
url: 'https://pic.youran.me/images/2020/01/17/f5f1ebe50c26d5f6d4e17cb983bd5ae59f103dda.png100w_100h.png'
},
{
name: '月亮',
url: 'https://pic.youran.me/images/2020/01/17/d96dccf8fa248ee34c7e4aba94e813bec28d2dd8.png100w_100h.png'
},
{
name: '可以',
url: 'https://pic.youran.me/images/2020/01/17/967377b83e37a0d5dd13bc0f4e4323abf10e4cbf.png100w_100h.png'
},
{
name: '掀桌',
url: 'https://pic.youran.me/images/2020/01/17/803129b7a1143faabc63c2648335b7d506229e7a.png100w_100h.png'
},
{
name: '爱心',
url: 'https://pic.youran.me/images/2020/01/17/7102c9e25359af8348489ff8529b3bb2c5bd05d0.png100w_100h.png'
},
{
name: '药丸',
url: 'https://pic.youran.me/images/2020/01/17/883e6654176ebcecafd3e52efa8ee842357e18a0.png100w_100h.png'
},
{
name: '滑稽',
url: 'https://pic.youran.me/images/2020/01/17/692cef7ca51f935aaa499de7e4d6048c53f42324.png100w_100h.png'
},
{
name: '哈哈',
url: 'https://pic.youran.me/images/2020/01/17/677c2f5555c1e79fc336a6283fdbbdc7ea88fec4.png100w_100h.png'
},
{
name: '阴阳',
url: 'https://pic.youran.me/images/2020/01/17/65e195a8ac54bb678dd1c1e6ce6c5d4ba02761b3.png100w_100h.png'
},
{
name: '捂脸',
url: 'https://pic.youran.me/images/2020/01/17/9cfd368b370acd40c1b8f933cec3fb24883356a5.png100w_100h.png'
}
];
let urlData2 = [
{
name: 'AWSL',
url: 'https://pic.youran.me/images/2020/01/17/c37f88cf799f9badf9d84b7671dc3dd98c0fc0c2.png100w_100h.png'
},
{
name: '吹爆',
url: 'https://pic.youran.me/images/2020/01/17/b528220f9c37256ed6a37f05bf118e44b08b81e5.png100w_100h.png'
},
{
name: '高产',
url: 'https://pic.youran.me/images/2020/01/17/9db817cba4a7f4a42398f3b2ec7c0a8e0c247c42.png100w_100h.png'
},
{
name: '打卡',
url: 'https://pic.youran.me/images/2020/01/17/a9cf77c78e1b9b40aa3ed4862402fba008ee2f51.png100w_100h.png'
},
{
name: '酸了',
url: 'https://pic.youran.me/images/2020/01/17/a8cbf3f6b8cd9377eeb15b9172f3cd683b2e4650.png100w_100h.png'
},
{
name: '可以',
url: 'https://pic.youran.me/images/2020/01/17/e08543c71202b36c590094417fcfbb80c3506cd8.png100w_100h.png'
},
{
name: '我全都要',
url: 'https://pic.youran.me/images/2020/01/17/d424d1ad8d14c1c9b8367842bc68c658b9229bc1.png100w_100h.png'
},
{
name: '真香',
url: 'https://pic.youran.me/images/2020/01/17/e68497c775feaac1c3b1a6cd63a50cfb11b767c4.png100w_100h.png'
},
{
name: '不愧是你',
url: 'https://pic.youran.me/images/2020/01/17/9ff2e356797c57ee3b1675ade0883d2d2247be9b.png100w_100h.png'
},
{
name: '妙',
url: 'https://pic.youran.me/images/2020/01/17/0e98299d7decf5eaffad854977946075c3e91cb8.png100w_100h.png'
},
{
name: '秀',
url: 'https://pic.youran.me/images/2020/01/17/50782fbf5d9b7f48f9467b5c53932981e321eedc.png100w_100h.png'
},
{
name: '拳头',
url: 'https://pic.youran.me/images/2020/01/17/35668cc12ae25b9545420e4a85bf21a0bfc03e5d.png100w_100h.png'
},
{
name: '有生之年',
url: 'https://pic.youran.me/images/2020/01/17/f41fdafe2d0fbb8e8bc1598d2cf37e355560103a.png100w_100h.png'
},
{
name: '镇站之宝',
url: 'https://pic.youran.me/images/2020/01/17/24e7a6a6e6383c987215fb905e3ee070aca259b5.png100w_100h.png'
},
{
name: '大师球',
url: 'https://pic.youran.me/images/2020/01/17/f30089248dd137c568edabcb07cf67e0f6e98cf3.png100w_100h.png'
},
{
name: '我太难了',
url: 'https://pic.youran.me/images/2020/01/17/a523f3e4c63e4db1232365765d0ec452f83be97e.png100w_100h.png'
},
{
name: '知识盲区',
url: 'https://pic.youran.me/images/2020/01/17/ccc94600b321a28116081e49ecedaa4ee8728312.png100w_100h.png'
},
{
name: '下次一定',
url: 'https://pic.youran.me/images/2020/01/17/77e87b9317cf9d1cdcc6ec0b0b88cd3e78b02c2c.png100w_100h.png'
},
{
name: '知识增加',
url: 'https://pic.youran.me/images/2020/02/16/142409b595982b8210b2958f3d340f3b47942645.png100w_100h.png'
},
{
name: '猛男必看',
url: 'https://pic.youran.me/images/2020/04/26/c97064450528a0e45c7e7c365a15fbb13fd61d8c.png100w_100h.png'
},
{
name: '???',
url: 'https://pic.youran.me/images/2020/04/26/c1d1e76c12180adc8558f47006fe0e7ded4154bb.png100w_100h.png'
},
{
name: '危',
url: 'https://pic.youran.me/images/2020/04/26/5cc6c3357c4df544dd8de9d5c5c0cec97c7c9a56.png100w_100h.png'
}
];
$(styles).appendTo($('head'));
$('#edui120_body').click(function() {
setTimeout(function() {
ueDocument = document.getElementById('edui116_iframe').contentWindow.document;
let url = ueDocument.getElementById('url');
let width = ueDocument.getElementById('width');
let height = ueDocument.getElementById('height');
let $wrapper = $('<div class="custom-images-picker"></div>');
$('#edui116_buttons').before($wrapper);
// tianyi
let $ul = $('<ul></ul>').appendTo($wrapper);
urlData.forEach(function(elem) {
createItems(elem, $ul);
});
$ul.children('li').click(onClick);
// hot meme
let $ul2 = $('<ul></ul>').appendTo($wrapper);
urlData2.forEach(function(elem) {
createItems(elem, $ul2);
});
$ul2.children('li').click(onClick);
function onClick() {
let $this = $(this);
$(width).val('50');
$(height).val('50');
$(url).val($this.data('url'));
const ke = new KeyboardEvent("keyup", {
bubbles: true, cancelable: true, keyCode: 13
});
url.dispatchEvent(ke);
}
function createItems(elem, $ul) {
let $li = $('<li data-url="' + elem.url + '" title="' + elem.name + '"></li>').css('background-image', 'url(\"' + elem.url + '\"');
$ul.append($li);
}
}, 1000);
});
})();