Custom emoji for scboy.com

Add custom external emoji to comments

2020-01-09 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

// ==UserScript==
// @name         Custom emoji for scboy.com
// @namespace    http://tampermonkey.net/
// @version      0.2
// @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'
		}
	];

	let urlData2 = [
	{
		name: 'AWSL',
		url: 'https://pic.youran.im/images/2020/01/09/c37f88cf799f9badf9d84b7671dc3dd98c0fc0c2.png50w_50h.png'
	},
	{
		name: '吹爆',
		url: 'https://pic.youran.im/images/2020/01/09/b528220f9c37256ed6a37f05bf118e44b08b81e5.png50w_50h.png'
	},
	{
		name: '高产',
		url: 'https://pic.youran.im/images/2020/01/09/9db817cba4a7f4a42398f3b2ec7c0a8e0c247c42.png50w_50h.png'
	},
	{
		name: '打卡',
		url: 'https://pic.youran.im/images/2020/01/09/a9cf77c78e1b9b40aa3ed4862402fba008ee2f51.png50w_50h.png'
	},
	{
		name: '酸了',
		url: 'https://pic.youran.im/images/2020/01/09/a8cbf3f6b8cd9377eeb15b9172f3cd683b2e4650.png50w_50h.png'
	},
	{
		name: '可以',
		url: 'https://pic.youran.im/images/2020/01/09/e08543c71202b36c590094417fcfbb80c3506cd8.png50w_50h.png'
	},
	{
		name: '我全都要',
		url: 'https://pic.youran.im/images/2020/01/09/d424d1ad8d14c1c9b8367842bc68c658b9229bc1.png50w_50h.png'
	},
	{
		name: '真香',
		url: 'https://pic.youran.im/images/2020/01/09/e68497c775feaac1c3b1a6cd63a50cfb11b767c4.png50w_50h.png'
	},
	{
		name: '不愧是你',
		url: 'https://pic.youran.im/images/2020/01/09/9ff2e356797c57ee3b1675ade0883d2d2247be9b.png50w_50h.png'
	},
	{
		name: '妙',
		url: 'https://pic.youran.im/images/2020/01/09/0e98299d7decf5eaffad854977946075c3e91cb8.png50w_50h.png'
	},
	{
		name: '秀',
		url: 'https://pic.youran.im/images/2020/01/09/50782fbf5d9b7f48f9467b5c53932981e321eedc.png50w_50h.png'
	},
	{
		name: '拳头',
		url: 'https://pic.youran.im/images/2020/01/09/35668cc12ae25b9545420e4a85bf21a0bfc03e5d.png50w_50h.png'
	},
	{
		name: '有生之年',
		url: 'https://pic.youran.im/images/2020/01/09/f41fdafe2d0fbb8e8bc1598d2cf37e355560103a.png50w_50h.png'
	},
	{
		name: '镇站之宝',
		url: 'https://pic.youran.im/images/2020/01/09/24e7a6a6e6383c987215fb905e3ee070aca259b5.png50w_50h.png'
	},
	{
		name: '大师球',
		url: 'https://pic.youran.im/images/2020/01/09/f30089248dd137c568edabcb07cf67e0f6e98cf3.png50w_50h.png'
	},
	{
		name: '我太难了',
		url: 'https://pic.youran.im/images/2020/01/09/a523f3e4c63e4db1232365765d0ec452f83be97e.png50w_50h.png'
	},
	{
		name: '知识盲区',
		url: 'https://pic.youran.im/images/2020/01/09/ccc94600b321a28116081e49ecedaa4ee8728312.png50w_50h.png'
	},
	{
		name: '下次一定',
		url: 'https://pic.youran.im/images/2020/01/09/77e87b9317cf9d1cdcc6ec0b0b88cd3e78b02c2c.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>');
			$('.edui-image-searchRes').after($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);
				$input.val($this.data('url'));
				$submit.click();
			}

			function createItems(elem, $ul) {
				let $li = $('<li data-url="' + elem.url + '" title="' + elem.name + '"></li>').css('background-image', 'url(\"' + elem.url + '\"');
				$ul.append($li);
			}
		}, 100);
	});
})();