Custom emoji for scboy.com

Add custom external emoji to comments

当前为 2019-12-17 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Custom emoji for scboy.com
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Add custom external emoji to comments
  6. // @author tianyi
  7. // @include https://www.scboy.com/*
  8. // ==/UserScript==
  9.  
  10. (function() {
  11. 'use strict';
  12.  
  13. let styles = `
  14. <style>
  15. .custom-images-picker ul {
  16. padding: 0;
  17. margin: 0;
  18. }
  19. .custom-images-picker ul li {
  20. display: inline-block;
  21. margin-right: 5px;
  22. cursor: pointer;
  23. width: 50px;
  24. height: 50px;
  25. }
  26.  
  27. .edui-dialog-image .edui-image-JimgSearch .edui-image-searchRes {
  28. height: 180px;
  29. }
  30. </style>`;
  31.  
  32. let urlData = [
  33. {
  34. name: '无语',
  35. url: 'https://pic.youran.im/images/2019/07/11/5f4385db3c9806b08ea15bd9ff444af9d9fe0c3a.png50w_50h.png'
  36. },
  37. {
  38. name: '怒了',
  39. url: 'https://pic.youran.im/images/2019/07/11/5d7c8307af10540909fce6121066249df3935a24.png50w_50h.png'
  40. },
  41. {
  42. name: '柯南',
  43. url: 'https://pic.youran.im/images/2019/07/11/4fac414b5002c3739b1ae24f2fc27b5f150ade24.png50w_50h.png'
  44. },
  45. {
  46. name: '应援',
  47. url: 'https://pic.youran.im/images/2019/07/11/2ab983b2519dc241666254de8e5352fbeedc96bb.png50w_50h.png'
  48. },
  49. {
  50. name: '小智',
  51. url: 'https://pic.youran.im/images/2019/07/11/0edeeb0d10d44302854e636c47f5dc3aa96a9206.png50w_50h.png'
  52. },
  53. {
  54. name: '前排',
  55. url: 'https://pic.youran.im/images/2019/07/11/fbbc45e7aee2f256f691df539db0cfcc35b3be7d.png50w_50h.png'
  56. },
  57. {
  58. name: '吃包',
  59. url: 'https://pic.youran.im/images/2019/07/11/f8cdabfc1b81fd25b85b8457ee49a20a4fc5d91b.png50w_50h.png'
  60. },
  61. {
  62. name: '问号',
  63. url: 'https://pic.youran.im/images/2019/07/11/f5f1ebe50c26d5f6d4e17cb983bd5ae59f103dda.png50w_50h.png'
  64. },
  65. {
  66. name: '月亮',
  67. url: 'https://pic.youran.im/images/2019/07/11/d96dccf8fa248ee34c7e4aba94e813bec28d2dd8.png50w_50h.png'
  68. },
  69. {
  70. name: '可以',
  71. url: 'https://pic.youran.im/images/2019/07/11/967377b83e37a0d5dd13bc0f4e4323abf10e4cbf.png50w_50h.png'
  72. },
  73. {
  74. name: '掀桌',
  75. url: 'https://pic.youran.im/images/2019/07/11/803129b7a1143faabc63c2648335b7d506229e7a.png50w_50h.png'
  76. },
  77. {
  78. name: '爱心',
  79. url: 'https://pic.youran.im/images/2019/07/11/7102c9e25359af8348489ff8529b3bb2c5bd05d0.png50w_50h.png'
  80. },
  81. {
  82. name: '药丸',
  83. url: 'https://pic.youran.im/images/2019/07/11/883e6654176ebcecafd3e52efa8ee842357e18a0.png50w_50h.png'
  84. },
  85. {
  86. name: '滑稽',
  87. url: 'https://pic.youran.im/images/2019/07/11/692cef7ca51f935aaa499de7e4d6048c53f42324.png50w_50h.png'
  88. },
  89. {
  90. name: '哈哈',
  91. url: 'https://pic.youran.im/images/2019/07/11/677c2f5555c1e79fc336a6283fdbbdc7ea88fec4.png50w_50h.png'
  92. },
  93. {
  94. name: '阴阳',
  95. url: 'https://pic.youran.im/images/2019/07/11/65e195a8ac54bb678dd1c1e6ce6c5d4ba02761b3.png50w_50h.png'
  96. },
  97. {
  98. name: '捂脸',
  99. url: 'https://pic.youran.im/images/2019/07/11/9cfd368b370acd40c1b8f933cec3fb24883356a5.png50w_50h.png'
  100. }
  101. ];
  102.  
  103. $(styles).appendTo($('head'));
  104.  
  105. $('.edui-icon-image').click(function() {
  106. setTimeout(function() {
  107. let $input = $('.edui-image-searchTxt');
  108. let $submit = $('.edui-image-searchAdd');
  109. let $wrapper = $('<div class="custom-images-picker"></div>');
  110. let $ul = $('<ul></ul>').appendTo($wrapper);
  111.  
  112. $('.edui-image-searchRes').after($wrapper);
  113.  
  114. urlData.forEach(function(elem) {
  115. let $li = $('<li data-url="' + elem.url + '" title="' + elem.name + '"></li>').css('background-image', 'url(\"' + elem.url + '\"');
  116. $ul.append($li);
  117. });
  118.  
  119. $ul.children('li').click(function() {
  120. let $this = $(this);
  121. $input.val($this.data('url'));
  122. $submit.click();
  123. });
  124. }, 100);
  125. });
  126. })();