Hide /r/UnexpectedCena

FIND OUT THIS SUNDAY NIGHT AT THE WWE SUUUUPER SLAM (changes /r/UnexpectedCena to /r/videos on reddit)

当前为 2015-08-30 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Hide /r/UnexpectedCena
  3. // @namespace http://foolmoron.io/
  4. // @version JOHN_CENA_19.78
  5. // @description FIND OUT THIS SUNDAY NIGHT AT THE WWE SUUUUPER SLAM (changes /r/UnexpectedCena to /r/videos on reddit)
  6. // @match http://*.reddit.com/*
  7. // @match https://*.reddit.com/*
  8. // @include http://*.reddit.com/*
  9. // @include https://*.reddit.com/*
  10. // @grant unsafeWindow
  11. // @copyright 2015, foolmoron
  12. // ==/UserScript==
  13.  
  14. /*
  15. BBBBBBRRRRRRRRRRRRRRAPADOOOOOOOOOOOOOOOOOOOOOOO
  16. ? ?
  17. ? ?----- ? ?-----
  18. ? ?
  19. ;;::
  20. ;: #
  21. ','#+'. `` '
  22. .:+ + '
  23. :`# , ,
  24. #@ #:# +
  25. ,: ;',``
  26. + .::;'`
  27. + #@@ ;#''+
  28. ` '` '# @' ..
  29. ` ## `@ '@
  30. `, +: ,
  31. ..+@: ``
  32. , @. :
  33. ` @ + '+
  34. : ` . +
  35. ' ' `.# `
  36. ` @:
  37. . @ ; @
  38. ` ` @` . @:
  39. . : `@# ; #.'.
  40. . `@@@ ` :
  41. # @@#@@ . ;`, ; @
  42. '@@@@@@ ;. . `
  43. @@@@; ` # . `' . `;
  44. ''@@: . :. ' : + ' #
  45. ; @@, ` # # @ ` ;
  46. .+ @@@ @; `# ` : +
  47. . ' `,@@# '. # : + `
  48. ## ` .#@@@` ` #` '., #
  49. `+ , :#@ ' .'
  50. , : : ' + #
  51. ': ,.# : + `
  52. ' ' : @ + '+ '@@`
  53. ' : ; ,. ,: .
  54. , : # : , .': . ;' +
  55. . , ` , `; `
  56. , ` . + `@. `` ; ` @@
  57. @ ' : : : . : `@@@
  58. ' ' #+ ` ; ,@@@@#
  59. + ; ` ` `+.#@@@@@@@@@@@
  60. . + ; @@@@@@@@@@@@@@
  61. : @' ,. ; +@@@@@@@@@@@@@@@,
  62. ' ' @@# ` ,@@@@@@@@@@@@@@@@@@
  63. . `#@@@@ # @@@@@@@@@@@@@@@@@@@
  64. @@@@@@@@` # ` @@@@@@@, @@@@@@@@@
  65. @@@@@@@@@ ' , #@@@@@@ @@@@@@@@
  66. @@@@@@@@' # . @@@@@# @@@@@@@ `
  67. @@@@@@@@@ ,# ,` #@@@@# ,:: +
  68. ,@@@@@@@@+ , ` '+ :@@@@@ ' ` '
  69. @@@@@@@ #+ ; + +@ #@@+ ` .
  70. ;@@@@+ ` `#`@ @ @@ # `
  71. . ;@ : #+,.``.,'+#` ,,
  72. + . :` .,,,:. :; .
  73. : ` : :` ,:: ; .
  74. + @ , ,. ; , `
  75. ' ; ;'++#` @ ; ; ,
  76. . + :'. ;` +
  77. : ; ; , @ ,
  78. ` : ,` # @
  79. ; ` , : @ `#
  80. # `` `@ :
  81. : ` ; # #; +
  82. , ` `;+, + + : + +#. ;
  83. + + :##: ` .
  84. ` . @
  85. ' ` ' . ' `
  86. , ' . . @
  87. @####+ . ` ;
  88. ` `
  89. ;
  90. , `` + `;'` ,.
  91. ' .: ` :
  92. ' . ,`
  93. ' , ' , .
  94. ' , ;. .
  95. .: . ' #
  96. .`@ : ; @ #
  97. '+` + ` .; '` + .
  98. # ; # + .+ @ ;+ .
  99. ' ' # ,` ' ` @ `'`` .
  100. ,, #` .` :. , . :
  101. ;+ + @: '`
  102. :. `, ; ' ,# #
  103. # ;. ` .++ , '
  104. ` :' `,` #, : ; ,
  105. ' # # ;
  106. : ,. .
  107. :.,+, .
  108. : #
  109. . '
  110. ` # ,
  111. ' '
  112. ` : :
  113. ` + .
  114. ## ####### ## ## #### ## ###### ######## #### ## ##
  115. /## ##/////## /## /##/##/## /## ##////##/##///// /##/## /## ####
  116. /## ## //##/## /##/##//## /## ## // /## /##//## /## ##//##
  117. /##/## /##/##########/## //## /## /## /####### /## //## /## ## //##
  118. /##/## /##/##//////##/## //##/## /## /##//// /## //##/## ##########
  119. ## /##//## ## /## /##/## //#### //## ##/## /## //####/##//////##
  120. //##### //####### /## /##/## //### //###### /########/## //###/## /##
  121. ///// /////// // // // /// ////// //////// // /// // //
  122. */
  123.  
  124. $(function() {
  125. var U_CANT_SEE_ME = function(element) {
  126. if (!element || !element.getElementsByClassName)
  127. return;
  128. var subreddits = element.getElementsByClassName('subreddit');
  129. for (var s = 0; s < subreddits.length; s++) {
  130. if(subreddits[s].innerHTML == '/r/UnexpectedCena') {
  131. // U CANT SEE IT, THE SUBREDDIT NAME'S HIDDEN
  132. subreddits[s].innerHTML = '/r/videos';
  133. // AND GOODBYE TO ANY SUBREDDIT SPOILING FLAIR THAT EXISTS ON THE POST
  134. var flair = subreddits[s].parentNode.parentNode.getElementsByClassName('linkflairlabel')[0]
  135. if (flair) flair.parentNode.removeChild(flair);
  136. // ARE YOU READY TO BE FOOLED BY A FAKE SCORE BASED ON SURROUNDING POSTS?!?!
  137. var item, prevItem, nextItem, prevScore, nextScore, fakeScore;
  138. item = subreddits[s].parentNode.parentNode.parentNode;
  139. prevItem = item.previousSibling.previousSibling;
  140. nextItem = item.nextSibling.nextSibling;
  141. if (prevItem) prevScore = parseInt(prevItem.getElementsByClassName('score unvoted')[0].innerHTML);
  142. if (nextItem) nextScore = parseInt(nextItem.getElementsByClassName('score unvoted')[0].innerHTML);
  143. if (nextScore && !prevScore) prevScore = nextScore * 1.2;
  144. if (prevScore && !nextScore) nextScore = prevScore / 1.2;
  145. if (prevScore && nextScore) {
  146. var lerp = Math.random();
  147. fakeScore = (1-lerp) * nextScore + (lerp) * prevScore;
  148. } else {
  149. fakeScore = 1000 + 1000 * Math.random();
  150. }
  151. item.getElementsByClassName('score unvoted')[0].innerHTML = Math.round(fakeScore);
  152. }
  153. }
  154. }
  155. U_CANT_SEE_ME(document.getElementById('siteTable'));
  156. // WATCH AS THIS SCRIPT FACES OFF AGAINST RES DYNAMIC PAGE LOADING, THIS SUNDAY NIGHT JUST $49.99
  157. var observer = new MutationObserver(function(mutations) {
  158. for (var i = 0; i < mutations.length; i++) {
  159. for (var j = 0; j < mutations[i].addedNodes.length; j++) {
  160. U_CANT_SEE_ME(mutations[i].addedNodes[j]);
  161. }
  162. }
  163. });
  164. observer.observe(document.getElementById('siteTable'), {childList: true});
  165. });