Kekeke Enhancer

Kekeke Set Blacklist to Block Unwanted Pics & Night Mode

  1. // ==UserScript==
  2. // @name Kekeke Enhancer
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9
  5. // @description Kekeke Set Blacklist to Block Unwanted Pics & Night Mode
  6. // @author Johann
  7. // @icon http://www.google.com/s2/favicons?domain=https://kekeke.cc/
  8. // @include https://kekeke.cc/*
  9. // @grant GM_addStyle
  10. // @require https://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js
  11. // ==/UserScript==
  12.  
  13.  
  14.  
  15. setTimeout(function(){
  16.  
  17.  
  18. GM_addStyle('.SquareCssResource-chatNameHover, .SquareCssResource-chatContent:hover {background:#eef !important;}');
  19. GM_addStyle('.SquareCssResource-message:hover, .SquareCssResource-chatDate:hover {background:#eef !important; color:#cf3a3a !important; font-weight:bold !important; text-shadow:none !important}');
  20. GM_addStyle('.SquareCssResource-chatContent.SquareCssResource-replyToMe.SquareCssResource-even:hover {background:#eef !important; color:#cf3a3a !important; font-weight:bold !important; text-shadow:none !important}');
  21. GM_addStyle('.SquareCssResource-chatContent.SquareCssResource-replyToMe:hover {background:#eef !important; color:#cf3a3a !important; font-weight:bold !important; text-shadow:none !important}');
  22.  
  23.  
  24. $('<td class="gwt-MenuItem" id="gwt-uid-l" role="menuitem" title="檢視在黑名單中的用戶,點擊用戶名即可對其解除封鎖。">檢視名單</td>').insertAfter('.gwt-MenuItem:contains("Q & A")');
  25. $('<td class="gwt-MenuItemSeparator"><div class="menuSeparatorInner"></div></td>').insertAfter('.gwt-MenuItem:contains("Q & A")');
  26. $('<td class="gwt-MenuItem" id="gwt-uid-b" role="menuitem" title="在圖片區塊的用戶名側邊添加黑名單鍵,點擊可封鎖該位用戶。">黑名單</td>').insertAfter('.gwt-MenuItem:contains("Q & A")');
  27. $('<td class="gwt-MenuItemSeparator"><div class="menuSeparatorInner"></div></td>').insertAfter('.gwt-MenuItem:contains("Q & A")');
  28. $('<td class="gwt-MenuItem" id="gwt-uid-d" role="menuitem" title="開關黑夜模式。">關燈</td>').insertAfter('.gwt-MenuItem:contains("Q & A")');
  29. $('<td class="gwt-MenuItemSeparator"><div class="menuSeparatorInner"></div></td>').insertAfter('.gwt-MenuItem:contains("Q & A")');
  30.  
  31. function Hover() {
  32.  
  33. $('.gwt-MenuItem').hover(function(){
  34.  
  35. $(this).addClass("gwt-MenuItem-selected");
  36.  
  37. }, function () {
  38.  
  39. $(this).removeClass("gwt-MenuItem-selected");
  40.  
  41. }); }
  42.  
  43.  
  44. $('.gwt-MenuItem:contains("關燈")').click(function(){
  45. $(this).toggleClass('init');
  46. if($(this).hasClass('init')){ $(this).html('開燈'); $('#gwt-uid-b').css('color','#f5deb3'); $('#gwt-uid-b.gwt-MenuItem.init').css('color','#c00');
  47. $('td').has('.SquareCssResource-squareHeader.GlobalCssResource-zhFont').css('background','#333'); $('.SquareCssResource-squareHeader.GlobalCssResource-zhFont').css('background','#333');
  48. if($('.gwt-Image[title*="統一暱稱"]').length < 1) {
  49. $('<td><div><img src="https://kekeke.cc/com.liquable.hiroba/emoji/emoji_one/1f60e_2x.png" class="gwt-Image" title="統一暱稱顏色" style="cursor: pointer; width:21px; height:21px; margin:1.5px;"></div></td>')
  50. .insertBefore('.SquareCssResource-submitInputButton'); } Hover();
  51. $('.gwt-Image[title*="統一暱稱"]').click(function(){ $(this).toggleClass('init');
  52. if($(this).hasClass('init') && $('#gwt-uid-d').hasClass('init')) {
  53. GM_addStyle('.GlobalCssResource-colorNickname {color: #999 !important}'); $(this).attr('src','https://kekeke.cc/com.liquable.hiroba/emoji/emoji_one/1f60e_2x.png'); } else location.reload(true); });
  54.  
  55. // custom
  56. GM_addStyle('#gwt-uid-b {color: #f5deb3} \
  57. #gwt-uid-b.gwt-MenuItem.init {color: #c00} \
  58. #new-line {background: #333} \
  59. .SquareCssResource-chatContent {cursor:pointer}');
  60.  
  61. // global
  62. GM_addStyle('a, a *, a, a:visited {color: #409B9B}');
  63.  
  64. // header
  65. GM_addStyle('.SquareCssResource-squareHeader .GlobalCssResource-colorBox .GlobalCssResource-noOfCrowd {background: #333} \
  66. .GlobalCssResource-statusPanel.gwt-MenuBar table>tbody>tr {background: #333} \
  67. .GlobalCssResource-statusPanel.gwt-MenuBar table td {color: #f5deb3} \
  68. .gwt-MenuBar .gwt-MenuItem-selected {background:#999}');
  69.  
  70. // table
  71. GM_addStyle('table[style*="rgb(255, 255, 170)"] {background:#333 !important} \
  72. .google-visualization-table-table th, .google-visualization-table-table td {background:#333 !important}');
  73.  
  74. // selector
  75. GM_addStyle('.SquareCssResource-eventSection .SquareCssResource-eventSectionModeSelector {background: #222; color: #fff}');
  76.  
  77. // poster
  78. GM_addStyle('.gwt-InlineHTML, .gwt-viz-container, .gwt-Label.SquareCssResource-posterContent {color: #fff} \
  79. .SquareCssResource-posterPanel {background: #222} \
  80. .SquareCssResource-eventSection {background: #333}\
  81. .KmarkCssResource-kmark p, .KmarkCssResource-kmark ol, .KmarkCssResource-kmark ul {color: #999} \
  82. .SquareCssResource-mediaFlow .SquareCssResource-mediaHeader {background: #333; color: #409B9B}');
  83.  
  84. // float-box
  85. GM_addStyle('.SquareCssResource-smileyTabPane {background: #444; color:#eee} \
  86. .gwt-DialogBox .dialogMiddleCenter {background: #333; color:#eee} \
  87. .gwt-ListBox, input[type=text], textarea {background: #444; color: #fff}');
  88.  
  89. // room-title
  90. GM_addStyle('.SquareCssResource-squareHeader .SquareCssResource-squareHeaderAddress {color: #409B9B; background: #333}');
  91.  
  92. // input-area
  93. GM_addStyle('.SquareCssResource-chatRoom .SquareCssResource-inputArea {background: #333; color: #409B9B} \
  94. .SquareCssResource-inputArea .SquareCssResource-messageInputField, .SquareCssResource-chatRoom .SquareCssResource-nicknameField {background: #444; color: #fff}');
  95.  
  96. // chat-room
  97. GM_addStyle('.SquareCssResource-chatRoom .SquareCssResource-replyToMe {background: #222 !important} \
  98. table.SquareCssResource-chatRoom, .SquareCssResource-chatRoom .SquareCssResource-chatContent, .SquareCssResource-dockPanelCenter, .SquareCssResource-dockPanelRight {background: #333} \
  99. .SquareCssResource-chatRoom .SquareCssResource-chatContent, .SquareCssResource-chatRoom .SquareCssResource-chatContent.SquareCssResource-even {background: #333; font-weight: bold; font-size: 14px} \
  100. .SquareCssResource-chatRoom .SquareCssResource-chatContent .SquareCssResource-message {color: #999;}'); //text-shadow: 0 0 3px #000
  101.  
  102. }
  103. if ($('.gwt-Image[title*="統一暱稱"]').hasClass('init')) { location.reload(true); }
  104.  
  105. if(!$(this).hasClass('init')) { $(this).html('關燈'); $('#gwt-uid-b').css('color','initial'); $('#gwt-uid-b.gwt-MenuItem.init').css('color','#c00'); $('.gwt-Image[title*="統一暱稱"]').remove();
  106. $('td').has('.SquareCssResource-squareHeader.GlobalCssResource-zhFont').css('background','#fff'); $('.SquareCssResource-squareHeader.GlobalCssResource-zhFont').css('background','#fff');
  107.  
  108. // custom
  109. GM_addStyle('#gwt-uid-b {color: initial} \
  110. #gwt-uid-b.gwt-MenuItem.init {color: #c00} \
  111. #new-line {background: initial} \
  112. .SquareCssResource-chatContent {cursor:default}');
  113.  
  114. // global
  115. GM_addStyle('a, a *, a, a:visited {color: #0c4a8a}');
  116.  
  117. // header
  118. GM_addStyle('.SquareCssResource-squareHeader .GlobalCssResource-colorBox .GlobalCssResource-noOfCrowd {background: initial} \
  119. .GlobalCssResource-statusPanel.gwt-MenuBar table>tbody>tr {background: initial} \
  120. .GlobalCssResource-statusPanel.gwt-MenuBar table td {color: initial} \
  121. .gwt-MenuBar .gwt-MenuItem-selected {background: #E0EDFE}');
  122.  
  123. // table
  124. GM_addStyle('table[style*="rgb(255, 255, 170)"] {background:#ffffaa !important} \
  125. .google-visualization-table-table th, .google-visualization-table-table td {background:#fff !important}');
  126.  
  127. // selector
  128. GM_addStyle('.SquareCssResource-eventSection .SquareCssResource-eventSectionModeSelector {background: #fff; color: #333}');
  129.  
  130. // poster
  131. GM_addStyle('.gwt-InlineHTML, .gwt-viz-container, .gwt-Label.SquareCssResource-posterContent {color: initial} \
  132. .SquareCssResource-posterPanel {background: #f6efe4} \
  133. .SquareCssResource-eventSection {background: #fff} \
  134. .KmarkCssResource-kmark p, .KmarkCssResource-kmark ol, .KmarkCssResource-kmark ul {color: #333} \
  135. .SquareCssResource-mediaFlow .SquareCssResource-mediaHeader {background: #eaf6e5; color: #2b8f00}');
  136.  
  137. // float-box
  138. GM_addStyle('.SquareCssResource-smileyTabPane {background: #fff; color:#333} \
  139. .gwt-DialogBox .dialogMiddleCenter {background: #fff; color:#333} \
  140. .gwt-ListBox, input[type=text], textarea {background: #fff; color: #333}');
  141.  
  142. // room-title
  143. GM_addStyle('.SquareCssResource-squareHeader .SquareCssResource-squareHeaderAddress {color: #0c4a8a; background: #fff}');
  144.  
  145. // input-area
  146. GM_addStyle('.SquareCssResource-chatRoom .SquareCssResource-inputArea {background: #e8eef5; color: #333} \
  147. .SquareCssResource-inputArea .SquareCssResource-messageInputField, .SquareCssResource-chatRoom .SquareCssResource-nicknameField {background: #fff; color: #333}');
  148.  
  149. // chat-room
  150. GM_addStyle('.SquareCssResource-chatRoom .SquareCssResource-replyToMe {background: #fdfdba!important} \
  151. table.SquareCssResource-chatRoom, .SquareCssResource-chatRoom .SquareCssResource-chatContent, .SquareCssResource-dockPanelCenter, .SquareCssResource-dockPanelRight {background: initial} \
  152. .SquareCssResource-chatRoom .SquareCssResource-chatContent {background: #eaf6e5; font-weight: initial; font-size: 13px} \
  153. .SquareCssResource-chatRoom .SquareCssResource-chatContent.SquareCssResource-even {background: #fff; font-weight: initial; font-size: 13px} \
  154. .SquareCssResource-chatRoom .SquareCssResource-chatContent .SquareCssResource-message {color:#333;}'); //text-shadow:none
  155.  
  156. }
  157. });
  158.  
  159. $('.gwt-MenuItem:contains("黑名單")').click(function(){
  160. $(this).toggleClass('init');
  161. if($(this).hasClass('init')){ append(); block(); $(this).css('color','#c00'); }
  162. else { $('.blocked').remove(); if($('#gwt-uid-d').hasClass('init')){ $(this).css('color','#f5deb3'); } else $(this).css('color','initial'); }
  163. });
  164.  
  165. $('.gwt-MenuItem:contains("檢視名單")').click(function(){
  166. var headline = $('.gwt-MenuBar.gwt-MenuBar-horizontal.GlobalCssResource-statusPanel.SquareCssResource-squareStatusPanel');
  167. $(this).toggleClass('init');
  168. if($(this).hasClass('init')){
  169. $('<table id="new-line" style="border-top:1px solid #bbb"></table>').appendTo(headline);
  170. $(JSON.parse(localStorage.getItem("blacklistValues"))).each(function () {
  171. $('<td class="gwt-MenuItem banned" role="menuitem" title="' + '將『' + this + '』從黑名單中剔除' + '" style="cursor:pointer">' + this + '</td>').appendTo('#new-line');
  172. });
  173. $('<a style="margin-left:10px">黑名單:</a>').insertBefore('.gwt-MenuItem.banned:first');
  174. $('.gwt-MenuItem.banned:contains("removed")').remove();
  175.  
  176. $('.gwt-MenuItem.banned').hover(function(){
  177.  
  178. $(this).addClass("gwt-MenuItem-selected");
  179.  
  180. }, function () {
  181.  
  182. $(this).removeClass("gwt-MenuItem-selected");
  183.  
  184. });
  185.  
  186. }
  187. else { $('#new-line').remove(); }
  188.  
  189. $('.gwt-MenuItem.banned').click(function() {
  190. var user = $(this)[0].innerText; console.log("解除封鎖 " + user);
  191. if(localStorage.getItem("blacklistValues") !== null) localStorage.setItem('blacklistValues', localStorage.getItem("blacklistValues").replace(user,'removed'));
  192. $(this).html('已解除');
  193. });
  194.  
  195. });
  196.  
  197. }, 1000);
  198.  
  199.  
  200. setInterval(function() { blacklist(); }, 1000);
  201.  
  202.  
  203. function append() {
  204.  
  205. $('.SquareCssResource-mediaHeaderLeft').each(function() { if ( $(this).find('.blocked').length < 1 ) {
  206. $(this).append('<a class="blocked" style="cursor:pointer" title="將此用戶加入黑名單,停止顯示其所發送的任何圖片。">加入黑名單</a>'); }
  207.  
  208. });
  209. }
  210.  
  211. function blacklist() {
  212.  
  213. var blacklist = JSON.parse(localStorage.getItem("blacklistValues"));
  214. $(blacklist).each(function () {
  215. $('.SquareCssResource-media').has('.gwt-HTML:contains("' + this + '")').hide();
  216.  
  217. });
  218. }
  219.  
  220. function block() {
  221.  
  222. $('.blocked').click(function() {
  223.  
  224. var blacklistValues= $(this).parent().find('.gwt-HTML')[0].innerText.split("@")[0].trim(); console.log("黑名單 " + blacklistValues);
  225. var data;
  226.  
  227. if (localStorage.getItem("blacklistValues") === null)
  228. data = [];
  229. else
  230. data = JSON.parse(localStorage.getItem("blacklistValues"));
  231.  
  232. data.push(blacklistValues);
  233.  
  234. localStorage.setItem("blacklistValues",JSON.stringify(data));
  235.  
  236. $(JSON.parse(localStorage.getItem("blacklistValues"))).each(function () { $('.SquareCssResource-media').has('.gwt-HTML:contains("' + this + '")').hide(); });
  237.  
  238. });
  239.  
  240. }