Add custom external emoji to comments
当前为
// ==UserScript==
// @name Custom emoji for scboy.com
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Add custom external emoji to comments
// @author tianyi
// @include https://www.scboy.com/*
// ==/UserScript==
(function() {
'use strict';
let styles = `
<style>
.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;
}
.edui-dialog-image .edui-image-JimgSearch .edui-image-searchRes {
height: 180px;
}
</style>`;
let urlData = [
{
name: '无语',
url: 'https://pic.youran.im/images/2019/07/11/5f4385db3c9806b08ea15bd9ff444af9d9fe0c3a.png50w_50h.png'
},
{
name: '怒了',
url: 'https://pic.youran.im/images/2019/07/11/5d7c8307af10540909fce6121066249df3935a24.png50w_50h.png'
},
{
name: '柯南',
url: 'https://pic.youran.im/images/2019/07/11/4fac414b5002c3739b1ae24f2fc27b5f150ade24.png50w_50h.png'
},
{
name: '应援',
url: 'https://pic.youran.im/images/2019/07/11/2ab983b2519dc241666254de8e5352fbeedc96bb.png50w_50h.png'
},
{
name: '小智',
url: 'https://pic.youran.im/images/2019/07/11/0edeeb0d10d44302854e636c47f5dc3aa96a9206.png50w_50h.png'
},
{
name: '前排',
url: 'https://pic.youran.im/images/2019/07/11/fbbc45e7aee2f256f691df539db0cfcc35b3be7d.png50w_50h.png'
},
{
name: '吃包',
url: 'https://pic.youran.im/images/2019/07/11/f8cdabfc1b81fd25b85b8457ee49a20a4fc5d91b.png50w_50h.png'
},
{
name: '问号',
url: 'https://pic.youran.im/images/2019/07/11/f5f1ebe50c26d5f6d4e17cb983bd5ae59f103dda.png50w_50h.png'
},
{
name: '月亮',
url: 'https://pic.youran.im/images/2019/07/11/d96dccf8fa248ee34c7e4aba94e813bec28d2dd8.png50w_50h.png'
},
{
name: '可以',
url: 'https://pic.youran.im/images/2019/07/11/967377b83e37a0d5dd13bc0f4e4323abf10e4cbf.png50w_50h.png'
},
{
name: '掀桌',
url: 'https://pic.youran.im/images/2019/07/11/803129b7a1143faabc63c2648335b7d506229e7a.png50w_50h.png'
},
{
name: '爱心',
url: 'https://pic.youran.im/images/2019/07/11/7102c9e25359af8348489ff8529b3bb2c5bd05d0.png50w_50h.png'
},
{
name: '药丸',
url: 'https://pic.youran.im/images/2019/07/11/883e6654176ebcecafd3e52efa8ee842357e18a0.png50w_50h.png'
},
{
name: '滑稽',
url: 'https://pic.youran.im/images/2019/07/11/692cef7ca51f935aaa499de7e4d6048c53f42324.png50w_50h.png'
},
{
name: '哈哈',
url: 'https://pic.youran.im/images/2019/07/11/677c2f5555c1e79fc336a6283fdbbdc7ea88fec4.png50w_50h.png'
},
{
name: '阴阳',
url: 'https://pic.youran.im/images/2019/07/11/65e195a8ac54bb678dd1c1e6ce6c5d4ba02761b3.png50w_50h.png'
},
{
name: '捂脸',
url: 'https://pic.youran.im/images/2019/07/11/9cfd368b370acd40c1b8f933cec3fb24883356a5.png50w_50h.png'
}
];
$(styles).appendTo($('head'));
$('.edui-icon-image').click(function() {
setTimeout(function() {
let $input = $('.edui-image-searchTxt');
let $submit = $('.edui-image-searchAdd');
let $wrapper = $('<div class="custom-images-picker"></div>');
let $ul = $('<ul></ul>').appendTo($wrapper);
$('.edui-image-searchRes').after($wrapper);
urlData.forEach(function(elem) {
let $li = $('<li data-url="' + elem.url + '" title="' + elem.name + '"></li>').css('background-image', 'url(\"' + elem.url + '\"');
$ul.append($li);
});
$ul.children('li').click(function() {
let $this = $(this);
$input.val($this.data('url'));
$submit.click();
});
}, 100);
});
})();