SSS

Really highlights sss

  1. // ==UserScript==
  2. // @name SSS
  3. // @namespace pendevin
  4. // @description Really highlights sss
  5. // @include http://boards.endoftheinter.net/showmessages.php?*
  6. // @include https://boards.endoftheinter.net/showmessages.php?*
  7. // @require http://code.jquery.com/jquery-2.1.3.min.js
  8. // @version 2
  9. // ==/UserScript==
  10.  
  11.  
  12. //add userIDs of people you want strobed
  13. //this is apple juice and John Egbert
  14. const STROBED=$([4897,22887]);
  15.  
  16.  
  17. //ll breaks without noconflict jquery
  18. this.$ = this.jQuery = jQuery.noConflict(true);
  19.  
  20. //livelinks compatiblity *JQUERY
  21. //calls the function on each message-container in a document, including ones added by livelinks
  22. function livelinks(func,extraParams){
  23. if(extraParams==undefined)
  24. extraParams=null;
  25. //run the function on the message-containers currently on the page
  26. $('#u0_1 .message-container').each(function(i,container){
  27. func(container,extraParams);
  28. });
  29. //run it on any message-containers added in the future
  30. $('#u0_1').on(
  31. 'DOMNodeInserted',
  32. extraParams,
  33. function(e){
  34. if($(e.target).children('.message-container').length){
  35. $(e.target).children('.message-container').each(function(i,container){
  36. func(container,e.data);
  37. });
  38. }
  39. }
  40. );
  41. }
  42.  
  43. //adds a style to a document and returns the style object *JQUERY
  44. //css is a string, id is an optional string that determines the object's id
  45. function addStyle(css,id){
  46. //create a style
  47. var style=$('<style type="text/css">');
  48. //add the css data to it
  49. style.html(css);
  50. if(id){
  51. //remove any style that has our id
  52. $('#'+id).remove();
  53. //give our style the id after removing the other stuff. idk if it matters, but i'm too lazy to find out
  54. style.attr('id',id);
  55. }
  56. //add the style into the head
  57. $('head').append(style);
  58. //we're outta here
  59. return style;
  60. }
  61.  
  62. function strobe(userids){
  63. var colors=['#ff0000','#ff8000','#ffff00','#00ff00','#0000ff','#ff00ff'];
  64. var text=['#ffffff','#ffffff','#000000','#000000','#ffffff','#000000'];
  65. var css='';
  66. userids.each(function(i,userid){
  67. css+='.message-container>.message-top[userID="'+userid+'"], .quoted-message>.message-top[userID="'+userid+'"]{'+
  68. 'background-color:'+colors[num]+';'+
  69. 'color:'+text[num]+';'+
  70. '}'+
  71. '.message-container>.message-top[userID="'+userid+'"] a, .quoted-message>.message-top[userID="'+userid+'"] a{'+
  72. 'color:'+text[num]+';'+
  73. '}'+
  74. '.message-container>.message-top[userID="'+userid+'"] a:visited, .quoted-message>.message-top[userID="'+userid+'"] a:visited{'+
  75. 'color:'+text[num]+';'+
  76. '}'
  77. });
  78. addStyle(css,'sss');
  79. num=(num+1)%6;
  80. }
  81.  
  82. //tags message-tops with userids
  83. //should call it with livelinks imo *JQUERY
  84. function userids(container){
  85. $(container).find('.message-top').each(function(i,top){
  86. top=$(top);
  87. //get userid attribute from the profile link
  88. top.attr('userID',top.children('a[href*="user="]').attr('href').split('user=')[1]);
  89. });
  90. }
  91.  
  92. livelinks(userids);
  93. var num=0;
  94. window.setInterval(strobe,50,STROBED);