Funnyjunk Submitter Checker v1.1

Highlights OP and user's username in comments sections

  1. // ==UserScript==
  2. // @name Funnyjunk Submitter Checker v1.1
  3. // @description Highlights OP and user's username in comments sections
  4. // @author kittywithclaws <http://www.funnyjunk.com/user/kittywithclaws>
  5. // @include http://funnyjunk.com/*
  6. // @include http://www.funnyjunk.com/*
  7. // @version 1.1
  8. // @namespace https://gf.qytechs.cn/users/9506
  9. // ==/UserScript==
  10.  
  11. document.onload = startFunction();
  12.  
  13. function startFunction(){
  14. checkSubmitter();
  15. console.log("Running first time!");
  16. window.setInterval(function(){
  17. checkSubmitter();
  18. console.log("Script Refresh!");
  19. }, 10000);
  20. }
  21. function checkSubmitter(){
  22. //console.log("Running");
  23. var submittedBy = document.getElementById('cntSbmtBy');
  24. var submitterString = "NULLBUTTS";
  25. var submitter = "NULLBUTTS";
  26. if(submittedBy != null){
  27. submitterString = submittedBy.textContent;
  28. submitter = submitterString.substring(10);
  29. submitter = submitter.replace(/\s+/g, '');
  30. var channelIndex = submitter.indexOf("Channel:");
  31. if(channelIndex!=-1){
  32. //console.log("channel removed");
  33. submitter = submitter.substring(0,channelIndex);
  34. }
  35. }
  36. //console.log("Submitted by: " + submitter);
  37. var currentUser = document.getElementById('userbarLoginInf');
  38. var userString = "NULLBUTTS2";
  39. if(currentUser.innerText != "anonymous."){
  40. userString = currentUser.children[0].innerHTML;
  41. }
  42. //console.log("Logged in as: " + userString);
  43. var commentUser = document.getElementsByClassName("uName"); // Find the elements
  44. var submitterElement = document.createElement('a');
  45. submitterElement.innerText = "BLAHBLAHBLAH";
  46. submitterElement.className = 'uName';
  47. submitterElement.style.color = "red";
  48. var z = 0;
  49. for(var i = 0; i < commentUser.length; i++){
  50. (function(x,y,s,cu){
  51. //Check if comment is made by uploader
  52. if(cu[x].textContent == s){
  53. /* IMPROVED VERSION
  54. * Adds an OP element which can be coloured seperately
  55. * Personal Preference: Prefer existing functionality.
  56. if(cu[x].nextSibling.className != "OPClass uName"){
  57. var OPTag = document.createElement('a');
  58. OPTag.innerHTML = " [OP]";
  59. OPTag.setAttribute("class", "OPClass uName");
  60. var userRef = "/user/" + userString;
  61. OPTag.setAttribute("href", userRef);
  62. OPTag.style.color = cu[x].style.color;
  63. cu[x].style.color = "#ff6666";
  64. cu[x].parentNode.insertBefore(OPTag, cu[x].nextSibling);
  65. }
  66. */
  67. cu[x].style.color = "#ff6666";
  68. cu[x].style.font = "bold italic 12px Arial,sans-serif";
  69. cu[x].innerText = s + " [OP]";
  70. //SECTION OF CODE CHANGES BACKGROUND OF SUBMITTER'S COMMENTS SLIGHTLY RED
  71. //Disabled for personal preference. Remove the "/*" and "*/" marks to re-enable.
  72. /*
  73. cu[x].parentNode.setAttribute("style", "background-color: #1a0f0f;");
  74. cu[x].parentNode.setAttribute("onmouseover", "this.setAttribute(\"style\", \"background-color: #231919;\")");
  75. cu[x].parentNode.setAttribute("onmouseout", "this.setAttribute(\"style\", \"background-color: #1a0f0f;\")");
  76. */
  77. //END OF BACKGROUND CHANGE
  78. z++;
  79. }
  80. //Check if comment is made by user logged in
  81. if(cu[x].textContent == userString || cu[x].textContent == userString + " [OP]"){
  82. cu[x].style.color = "#ffff33";
  83. cu[x].style.font = "bold italic 12px Arial,sans-serif";
  84. }
  85. //}
  86. })(i, submitterElement, submitter, commentUser)
  87. //z++;
  88. //console.log(z + " changed");
  89. //}
  90. }
  91. //console.log(submitter);
  92. //console.log(z + " changed");
  93. }

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址