Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Copyright (c) 2010-2011 James Rodrigues
- This software is provided 'as-is', without any express or implied
- warranty. In no event will the authors be held liable for any damages
- arising from the use of this software.
- Permission is granted to anyone to use this software for any purpose,
- including commercial applications, and to alter it and redistribute it
- freely, subject to the following restrictions:
- 1. The origin of this software must not be misrepresented; you must not
- claim that you wrote the original software. If you use this software
- in a product, an acknowledgment in the product documentation would be
- appreciated but is not required.
- 2. Altered source versions must be plainly marked as such, and must not be
- misrepresented as being the original software.
- 3. This notice may not be removed or altered from any source
- distribution.
- */
- // ==UserScript==
- // @name NeoGAF User Highlighter
- // @namespace com.zombie.net
- // @description Highlight user posts, quotes, and threads.
- // @include http://www.neogaf.com/forum/*
- // @include http://neogaf.com/forum*
- //
- // ==/UserScript==
- // These two variables must be set!
- //////////////////////////////////
- var username = "StalkerUKCG"; // <-- Your GAF username goes between the quotes.
- var color = "#01518e"; // <-- This is the highlight color.
- // Options
- //////////////////////////////////
- var highlight_avatar_area = true;
- var highlight_post_area = true;
- var highlight_threads = true;
- var highlight_quotes = true;
- //////////////////////////////////
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- //
- // Add jQuery
- ///////////////////////////////////////////////
- var GM_JQ = document.createElement('script');
- GM_JQ.src = 'http://ajax.googleapis.com/ajax/libs/jquery/1.5.1/jquery.min.js';
- GM_JQ.type = 'text/javascript';
- document.getElementsByTagName('head')[0].appendChild(GM_JQ);
- if (window.opera) unsafeWindow=window;
- // Check if jQuery's loaded
- function GM_wait()
- {
- if(typeof unsafeWindow.jQuery == 'undefined') { window.setTimeout(GM_wait,100); }
- else { $ = unsafeWindow.jQuery; if(username.length > 0) execJQuery(); }
- }
- GM_wait();
- // Execute
- ////////////////////////////////////////////////
- function execJQuery()
- {
- // thanks to yeef @ neogaf
- $.expr[":"].econtains = function(obj, index, meta, stack) {
- return (obj.textContent || obj.innerText || $(obj).text() || "").toLowerCase() == meta[3].toLowerCase();
- }
- var path = window.location.pathname;
- if((path.search("showpost") > 0) || (path.search("showthread") > 0))
- {
- var user = $(".bigusername:contains('" + username + "')");
- if(highlight_avatar_area && highlight_post_area)
- user.css('color', 'black').closest('tr').children().css('background-color', '' + color + '');
- else
- {
- if(highlight_avatar_area)
- user.css('color', 'black').closest('td').css('background-color', '' + color + '');
- if(highlight_post_area)
- user.css('color', 'black').closest('td').siblings().css('background-color', '' + color + '');
- }
- if(highlight_quotes)
- {
- $('.post').find('div:contains("' + username + '")').each(function() {
- $(this).find('td.quotearea').css('background-color', '' + color + '');
- });
- }
- }
- else
- {
- if(highlight_threads)
- {
- $('.alt2').find('a:contains("' + username + '")').each(function() {
- $(this).closest('tr').children().css('background-color', '' + color + '');
- });
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement