4chan+

Adds some kool features to 4chan!

  1. // ==UserScript==
  2. // @name 4chan+
  3. // @namespace http://tampermonkey.net/
  4. // @version 2.4
  5. // @description Adds some kool features to 4chan!
  6. // @author MrSkeletal
  7. // @match http://boards.4chan.org/*
  8. // @match https://boards.4chan.org/*
  9. // @grant none
  10. // @run-at document-end
  11. // ==/UserScript==
  12.  
  13. (function() {
  14. 'use strict';
  15. // Your code here...
  16. var Names = ['Wizard','Professional ShitPoster','Hiding In The Closet','A White Guy','Redpilled','A Black Guy','Faggot','Grill','Full Time Neet','Lurker','Jewd','Chad','Stacy','Basement Dweller','1337_H@x0r','Underage','EdgeLord','NORMIE','Nazi','Pesant','FAG','Suicidal','Weeb','I <3 Hentai','Woke','FBI','Mod In Disguise','Not A Cop'];
  17. var ValidNameColors = ['#ff66ff','#ff3300','#b3ffb3','#669999','#3399ff'];
  18. var HTMLNames = document.getElementsByClassName('name');
  19. var HTMLGET = document.getElementsByClassName('postNum desktop');
  20. var theme = document.getElementById('styleSelector');
  21. var TModernOn = false;
  22. var nav = document.getElementsByClassName('navLinks desktop')[0];
  23. var board = window.location.pathname.match(/\/[^\/]+\//)[0];
  24.  
  25. //ToolBar
  26. //
  27. function Update(){
  28. //underline subjects
  29. //Add NickNames
  30. function ChangeNames(list){
  31. for (var i=0;i<HTMLNames.length;i++){
  32. if (HTMLNames[i].id != 'colored'){
  33. HTMLNames[i].style.color = ValidNameColors[Math.floor((Math.random() * ValidNameColors.length) + 0)];
  34. HTMLNames[i].id = 'colored';
  35. }
  36. if (HTMLNames[i].innerHTML == 'Anonymous'){
  37. HTMLNames[i].title = "Username was originally Anonymous";
  38. HTMLNames[i].innerHTML = list[Math.floor((Math.random() * list.length) + 0)];
  39. }
  40. }
  41. }
  42. //
  43. var nsfwNames = ['Currently Masterbaiting','NSA','Tits man','Ass man','Lurker','Kinky','Embassidor of porn','Porn merchant'];
  44. switch(board){
  45. default:
  46. ChangeNames(Names);
  47. break;
  48. case "/b/":
  49. case "/pol/":
  50. ChangeNames(Names);
  51. break;
  52. case "/bant/":
  53. ChangeNames(Names);
  54. break;
  55. case "/aco/":
  56. case "/r/":
  57. case "/gif/":
  58. case "/hr/":
  59. case "/t/":
  60. case "/y/":
  61. case "/d/":
  62. case "/e/":
  63. case "/s/":
  64. case "/hc/":
  65. case "/h/":
  66. ChangeNames(nsfwNames);
  67. break;
  68. }
  69. //GetHighlighter
  70. for (var i2=0;i2<HTMLGET.length;i2++){
  71. var GET = HTMLGET[i2].childNodes[1].text;
  72. var Len = GET.length - 1;
  73. var Dupes = 0;
  74. for (var l = Len; GET[l] == GET[l - 1]; l--){
  75. Dupes++;
  76. }
  77. if (GET[Len] == GET[Len - 1] & HTMLGET[i2].childNodes[1].id != 'Checked'){
  78. HTMLGET[i2].childNodes[1].style.backgroundColor = ValidNameColors[Math.floor((Math.random() * ValidNameColors.length) + 0)];
  79. HTMLGET[i2].childNodes[1].style.color = "black";
  80. HTMLGET[i2].childNodes[1].id = 'Checked';
  81. switch(Dupes){
  82. default:
  83. var saying = "GET ";
  84. HTMLGET[i2].childNodes[1].title = saying;
  85. HTMLGET[i2].childNodes[0].innerHTML = saying + HTMLGET[i2].childNodes[0].innerHTML;
  86. break;
  87. case 1:
  88. saying = "Dubs ";
  89. HTMLGET[i2].childNodes[1].title = saying;
  90. HTMLGET[i2].childNodes[0].innerHTML = saying + HTMLGET[i2].childNodes[0].innerHTML;
  91. break;
  92. case 2:
  93. saying = "Trips ";
  94. HTMLGET[i2].childNodes[1].title = saying;
  95. HTMLGET[i2].childNodes[0].innerHTML = saying + HTMLGET[i2].childNodes[0].innerHTML;
  96. break;
  97. case 3:
  98. saying = "Quads ";
  99. HTMLGET[i2].childNodes[1].title = saying;
  100. HTMLGET[i2].childNodes[0].innerHTML = saying + HTMLGET[i2].childNodes[0].innerHTML;
  101. break;
  102. }
  103. }
  104. }
  105. //TestTheme
  106. if (theme.options[theme.selectedIndex].value == 'Test'){
  107. //BG
  108. document.body.style.backgroundColor = '#cccccc';
  109. document.getElementById('header-bar').style.backgroundColor = '#9BAEC8';
  110. //Post Form
  111. document.getElementById('postForm').style.backgroundColor = '#444b5d';
  112. document.getElementById('postForm').style.border = '3px solid #282c37';
  113. document.getElementById('postForm').style.marginLeft = '35%';
  114. document.getElementById('postForm').style.borderRadius = '4px';
  115. //
  116. var PR = document.getElementsByClassName('post reply');
  117. var OP = document.getElementsByClassName('post op');
  118. for (i=0;i<PR.length;i++){
  119. PR[i].style.backgroundColor = '#444b5d';
  120. PR[i].style.color = '#e6e6e6';
  121. PR[i].style.border = '3px solid #282c37';
  122. PR[i].style.borderRadius = '4px';
  123. PR[i].style.margin = '14px';
  124. }
  125. for (i=0;i<OP.length;i++){
  126. OP[i].style.backgroundColor = '#444b5d';
  127. OP[i].style.color = '#e6e6e6';
  128. OP[i].style.border = '3px solid #282c37';
  129. OP[i].style.borderRadius = '4px';
  130. OP[i].style.margin = '14px';
  131. }
  132. }
  133. //loop
  134. setTimeout(Update,500);
  135. }
  136. function OneTimeUpdate(){
  137. //add tools
  138. var toolMenu = document.createElement('div');
  139. toolMenu.setAttribute("style","background-Color: #5f92ca; top: 50%; position: fixed; zIndex: 99999999; border: 3px solid #6699ff; padding: 5px; left: 50%; transform: translate(-50%, -50%)");
  140. toolMenu.style.display = 'none';
  141. document.body.appendChild(toolMenu);
  142. //Header
  143. var TMText = document.createElement('h1');
  144. TMText.innerHTML = 'Tools Menu';
  145. toolMenu.appendChild(TMText);
  146. //Features
  147. //Highlighter
  148. var TMText2 = document.createElement('h4');
  149. TMText2.innerHTML = 'Features Undone';
  150. toolMenu.appendChild(TMText2);
  151. var TMAH = document.createElement('div');
  152. TMAH.id = 'TMHLDiv';
  153. //exit
  154. var TMExit = document.createElement('button');
  155. TMExit.innerHTML = 'Exit';
  156. toolMenu.appendChild(TMExit);
  157. TMExit.addEventListener('click',function(){
  158. toolMenu.style.display = 'none';
  159. });
  160. //Add Theme (TEST)
  161. var TModern = document.createElement('option');
  162. TModern.value = 'Test';
  163. TModern.innerHTML = 'Test';
  164. theme.appendChild(TModern);
  165. //add some tools
  166. if(nav !== undefined){
  167. nav.innerHTML += " [";
  168. var Settings = document.createElement('a');
  169. Settings.id = 'SID';
  170. Settings.innerHTML = 'Tools';
  171. Settings.style.cursor = 'pointer';
  172. nav.appendChild(Settings);
  173. nav.innerHTML += "]";
  174. document.getElementById('SID').addEventListener("click",function(){
  175. toolMenu.style.display = 'inline';
  176. });
  177. }
  178. //Add message for board
  179. var message = document.createElement('div');
  180. message.className = 'boardSubtitle';
  181. document.getElementsByClassName("boardBanner")[0].appendChild(message);
  182. console.log(board);
  183. var bantMSG = ["anime","Reminder that the animal of /bant/ is the blobfish","/b/ With flags","Death to frogposters",">coke without peanuts"];
  184. var animeMSG = ["Dubs > Subs","Dubs < Subs","Your waifu is shit"];
  185. var bMSG = ["NORMIES GET OUT REEEEEE","Not your personal army","Where porn is more common than memes","Dont be a gullible idiot","Home of Anonymous"];
  186. var nsfwMSG = ['Got some alone time eh ;)','The NSA is gonna love watching this','If you get caught, just blame it on ghosts','Kinky','2d > 3d','2d < 3d','Got a fine taste'];
  187. var r9kMSG = ['No chads allowed','NORMIES GET OUT REEEEEE','<p style="color:#B5BD67;"> >Feels Bad Man </p>'];
  188. var travelMSG = ['When you need a destination who are you gonna call ' + board + '!','More likly to get out than most people'];
  189. switch(board){
  190. case "/bant/":
  191. message.innerHTML = bantMSG[Math.floor((Math.random() * bantMSG.length) + 0)];
  192. break;
  193. case "/r9k/":
  194. message.innerHTML = r9kMSG[Math.floor((Math.random() * r9kMSG.length) + 0)];
  195. break;
  196. case "/n/":
  197. case "/o/":
  198. case "/out/":
  199. message.innerHTML = travelMSG[Math.floor((Math.random() * travelMSG.length) + 0)];
  200. break;
  201. case "/a/":
  202. case "/c/":
  203. case "/w/":
  204. case "/m/":
  205. case "/cgl/":
  206. case "/jp/":
  207. case "/cm/":
  208. message.innerHTML = animeMSG[Math.floor((Math.random() * animeMSG.length) + 0)];
  209. break;
  210. case "/b/":
  211. message.innerHTML = bMSG[Math.floor((Math.random() * bMSG.length) + 0)];
  212. document.getElementsByClassName("boardSubtitle")[0].remove();
  213. break;
  214. case "/aco/":
  215. case "/r/":
  216. case "/gif/":
  217. case "/hr/":
  218. case "/t/":
  219. case "/y/":
  220. case "/d/":
  221. case "/e/":
  222. case "/s/":
  223. case "/hc/":
  224. case "/h/":
  225. message.innerHTML = nsfwMSG[Math.floor((Math.random() * nsfwMSG.length) + 0)];
  226. break;
  227. default:
  228. message.innerHTML = "This Board Doesnt Have Messages Yet!";
  229. }
  230. }
  231. //
  232. new OneTimeUpdate();
  233. new Update();
  234. console.log('Started 4chan+ With No Errors!');
  235. //EVENTS
  236.  
  237. //
  238. })();