Funnyjunk Submitter Checker

Replace emoticons on Funnyjunk with the text variants.

  1. // ==UserScript==
  2. // @name Funnyjunk Submitter Checker
  3. // @description Replace emoticons on Funnyjunk with the text variants.
  4. // @author kittywithclaws <http://www.funnyjunk.com/user/kittywithclaws>
  5. // @include http://funnyjunk.com/*
  6. // @include https://funnyjunk.com/*
  7. // @include http://www.funnyjunk.com/*
  8. // @include https://www.funnyjunk.com/*
  9. // @version 2.0
  10. // @namespace https://greasyfork.org/users/3806
  11. // ==/UserScript==
  12.  
  13.  
  14. document.onload = startFunction();
  15.  
  16. function startFunction(){
  17. checkSubmitter();
  18. //addNSFWBoardMenu();
  19. console.log("Running first time!");
  20. window.setInterval(function(){
  21. checkSubmitter();
  22. console.log("Script Refresh!");
  23. }, 10000);
  24. }
  25. function checkSubmitter(){
  26. //console.log("Running");
  27. var submittedBy = document.getElementById('avaName');
  28. var submitterString = "NULLBUTTS";
  29. var submitter = "NULLBUTTS";
  30. if(submittedBy != null){
  31. submitterString = submittedBy.firstChild.textContent;
  32. submitter = submitterString;
  33. submitter = submitter.replace(/\s+/g, '');
  34. var channelIndex = submitter.indexOf("Channel:");
  35. if(channelIndex!=-1){
  36. //console.log("channel removed");
  37. submitter = submitter.substring(0,channelIndex);
  38. }
  39. }
  40. //console.log("Submitted by: " + submitter);
  41. var currentUser = document.getElementById('userbarLoginInf');
  42. var userString = "NULLBUTTS2";
  43. if(currentUser.innerText != "anonymous."){
  44. userString = currentUser.children[0].innerHTML;
  45. }
  46. //console.log("Logged in as: " + userString);
  47. var commentUser = document.getElementsByClassName("uName"); // Find the elements
  48. var submitterElement = document.createElement('a');
  49. submitterElement.innerText = "BLAHBLAHBLAH";
  50. submitterElement.className = 'uName';
  51. submitterElement.style.color = "red";
  52. var z = 0;
  53. for(var i = 0; i < commentUser.length; i++){
  54. (function(x,y,s,cu){
  55. //Check if comment is made by uploader
  56. if(cu[x].textContent == s){
  57. /* IMPROVED VERSION
  58. * Adds an OP element which can be coloured seperately
  59. * Personal Preference: Prefer existing functionality.
  60. if(cu[x].nextSibling.className != "OPClass uName"){
  61. var OPTag = document.createElement('a');
  62. OPTag.innerHTML = " [OP]";
  63. OPTag.setAttribute("class", "OPClass uName");
  64. var userRef = "/user/" + userString;
  65. OPTag.setAttribute("href", userRef);
  66. OPTag.style.color = cu[x].style.color;
  67. cu[x].style.color = "#ff6666";
  68. cu[x].parentNode.insertBefore(OPTag, cu[x].nextSibling);
  69. }
  70. */
  71. cu[x].style.color = "#ff6666";
  72. cu[x].style.font = "bold italic 12px Arial,sans-serif";
  73. cu[x].innerText = s + " [OP]";
  74. //SECTION OF CODE CHANGES BACKGROUND OF SUBMITTER'S COMMENTS SLIGHTLY RED
  75. //Disabled for personal preference. Remove the "/*" and "*/" marks to re-enable.
  76. /*
  77. cu[x].parentNode.setAttribute("style", "background-color: #1a0f0f;");
  78. cu[x].parentNode.setAttribute("onmouseover", "this.setAttribute(\"style\", \"background-color: #231919;\")");
  79. cu[x].parentNode.setAttribute("onmouseout", "this.setAttribute(\"style\", \"background-color: #1a0f0f;\")");
  80. */
  81. //END OF BACKGROUND CHANGE
  82. z++;
  83. }
  84. //Check if comment is made by user logged in
  85. if(cu[x].textContent == userString || cu[x].textContent == userString + " [OP]"){
  86. cu[x].style.color = "#ffff33";
  87. cu[x].style.font = "bold italic 12px Arial,sans-serif";
  88. }
  89. //}
  90. })(i, submitterElement, submitter, commentUser)
  91. //z++;
  92. //console.log(z + " changed");
  93. //}
  94. }
  95. //console.log(submitter);
  96. //console.log(z + " changed");
  97. }
  98.  
  99. function addNSFWBoardMenu(){
  100. var NSFWContentEntry = document.getElementsByClassName("f_ie mature forLogged").item(0);
  101. var NSFWBoardMenuEntry = document.createElement('tr');
  102. NSFWBoardMenuEntry.setAttribute("class", "f_ie mature forLogged");
  103. NSFWBoardMenuEntry.setAttribute("rel", "nofollow");
  104. NSFWBoardMenuEntry.setAttribute("style", "");
  105. var NSFWBoardMenuTD = document.createElement('td');
  106. NSFWBoardMenuTD.setAttribute("class", "left_menu_boards left_menu_mature center");
  107.  
  108. var NSFWBoardMenuUL = document.createElement('ul');
  109. NSFWBoardMenuUL.setAttribute("class", "boardsMenu");
  110.  
  111. var NSFWBoardMenuLI = document.createElement('li');
  112.  
  113. var NSFWBoardMenuTitle = document.createElement('span');
  114. NSFWBoardMenuTitle.textContent = "NSFW Boards >";
  115. var NSFWBoardMenuSub = document.createElement('ul');
  116. NSFWBoardMenuSub.setAttribute("class", "boardsMenu_sub");
  117. NSFWBoardMenuSub.setAttribute("style", "display: none;");
  118. NSFWBoardMenuTD.setAttribute("onmouseover", "NSFWBoardMenuSub.setAttribute(\"style\", \"display: block;\")");
  119. NSFWBoardMenuTD.setAttribute("onmouseout", "NSFWBoardMenuSub.setAttribute(\"style\", \"display: none;\")");
  120. var NSFWBoardFurry = document.createElement('li');
  121. NSFWBoardFurry.innerHTML = "<a href =\"/furry/\" class=\"1\" title=\"Furry\">Furry</a>";
  122. var NSFWBoardGay = document.createElement('li');
  123. NSFWBoardGay.innerHTML = "<a href =\"/gay/\" class=\"1\" title=\"Gay\">Gay</a>";
  124. var NSFWBoardHentai = document.createElement('li');
  125. NSFWBoardHentai.innerHTML = "<a href =\"/hentai/\" class=\"1\" title=\"Hentai\">Hentai</a>";
  126. var NSFWBoardBrony = document.createElement('li');
  127. NSFWBoardBrony.innerHTML = "<a href =\"/nsfw_brony/\" class=\"1\" title=\"NSFW Brony\">NSFW Brony</a>";
  128. var NSFWBoardRandom = document.createElement('li');
  129. NSFWBoardRandom.innerHTML = "<a href =\"/random/\" class=\"1\" title=\"Random\">Random</a>";
  130. var NSFWBoardStraight = document.createElement('li');
  131. NSFWBoardStraight.innerHTML = "<a href =\"/straight/\" class=\"1\" title=\"Straight\">Straight</a>";
  132. NSFWBoardMenuSub.appendChild(NSFWBoardFurry);
  133. NSFWBoardMenuSub.appendChild(NSFWBoardGay);
  134. NSFWBoardMenuSub.appendChild(NSFWBoardHentai);
  135. NSFWBoardMenuSub.appendChild(NSFWBoardBrony);
  136. NSFWBoardMenuSub.appendChild(NSFWBoardRandom);
  137. NSFWBoardMenuSub.appendChild(NSFWBoardStraight);
  138. NSFWBoardMenuLI.appendChild(NSFWBoardMenuTitle);
  139. NSFWBoardMenuLI.appendChild(NSFWBoardMenuSub);
  140. NSFWBoardMenuUL.appendChild(NSFWBoardMenuLI);
  141. NSFWBoardMenuTD.appendChild(NSFWBoardMenuUL);
  142. NSFWBoardMenuEntry.appendChild(NSFWBoardMenuTD);
  143. NSFWContentEntry.parentNode.insertBefore(NSFWBoardMenuEntry, NSFWContentEntry.nextSibling);
  144. }