Advertisement
Guest User

Untitled

a guest
Feb 4th, 2013
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.49 KB | None | 0 0
  1. /*
  2. Copyright (c) 2010-2011 James Rodrigues
  3.  
  4. This software is provided 'as-is', without any express or implied
  5. warranty. In no event will the authors be held liable for any damages
  6. arising from the use of this software.
  7.  
  8. Permission is granted to anyone to use this software for any purpose,
  9. including commercial applications, and to alter it and redistribute it
  10. freely, subject to the following restrictions:
  11.  
  12. 1. The origin of this software must not be misrepresented; you must not
  13. claim that you wrote the original software. If you use this software
  14. in a product, an acknowledgment in the product documentation would be
  15. appreciated but is not required.
  16.  
  17. 2. Altered source versions must be plainly marked as such, and must not be
  18. misrepresented as being the original software.
  19.  
  20. 3. This notice may not be removed or altered from any source
  21. distribution.
  22. */
  23.  
  24. // ==UserScript==
  25. // @name NeoGAF User Highlighter
  26. // @namespace com.zombie.net
  27. // @description Highlight user posts, quotes, and threads.
  28. // @include http://www.neogaf.com/forum/*
  29. // @include http://neogaf.com/forum*
  30. //
  31. // ==/UserScript==
  32.  
  33. // These two variables must be set!
  34. //////////////////////////////////
  35. var username = "StalkerUKCG"; // <-- Your GAF username goes between the quotes.
  36. var color = "#01518e"; // <-- This is the highlight color.
  37.  
  38. // Options
  39. //////////////////////////////////
  40. var highlight_avatar_area = true;
  41. var highlight_post_area = true;
  42. var highlight_threads = true;
  43. var highlight_quotes = true;
  44. //////////////////////////////////
  45. //
  46. //
  47. //
  48. //
  49. //
  50. //
  51. //
  52. //
  53. //
  54. //
  55. //
  56. //
  57. //
  58. //
  59.  
  60. // Add jQuery
  61. ///////////////////////////////////////////////
  62. var GM_JQ = document.createElement('script');
  63. GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js';
  64. GM_JQ.type = 'text/javascript';
  65. document.getElementsByTagName('head')[0].appendChild(GM_JQ);
  66. if (window.opera) unsafeWindow=window;
  67.  
  68. // Check if jQuery's loaded
  69. function GM_wait()
  70. {
  71. if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
  72. else { $ = unsafeWindow.jQuery; if(username.length > 0) execJQuery(); }
  73. }
  74.  
  75. GM_wait();
  76.  
  77. // Execute
  78. ////////////////////////////////////////////////
  79. function execJQuery()
  80. {
  81. // thanks to yeef @ neogaf
  82. $.expr[":"].econtains = function(obj, index, meta, stack) {
  83. return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
  84. }
  85.  
  86. var path = window.location.pathname;
  87.  
  88. if((path.search("showpost") > 0) || (path.search("showthread") > 0))
  89. {
  90. var user = $(".bigusername:contains('" + username + "')");
  91.  
  92. if(highlight_avatar_area && highlight_post_area)
  93. user.css('color', 'black').closest('tr').children().css('background-color', '' + color + '');
  94. else
  95. {
  96. if(highlight_avatar_area)
  97. user.css('color', 'black').closest('td').css('background-color', '' + color + '');
  98.  
  99. if(highlight_post_area)
  100. user.css('color', 'black').closest('td').siblings().css('background-color', '' + color + '');
  101. }
  102.  
  103. if(highlight_quotes)
  104. {
  105. $('.post').find('div:contains("' + username + '")').each(function() {
  106. $(this).find('td.quotearea').css('background-color', '' + color + '');
  107. });
  108. }
  109. }
  110. else
  111. {
  112. if(highlight_threads)
  113. {
  114. $('.alt2').find('a:contains("' + username + '")').each(function() {
  115. $(this).closest('tr').children().css('background-color', '' + color + '');
  116. });
  117. }
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement