Last active
December 19, 2015 04:28
-
-
Save agentlame/5896995 to your computer and use it in GitHub Desktop.
Highlight Your Comments in subs you mod.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==UserScript== | |
| // @name Highlight Mod Comments | |
| // @namespace http://use.i.E.your.homepage/ | |
| // @version 0.1 | |
| // @description enter something useful | |
| // @include http://reddit.com/* | |
| // @include https://reddit.com/* | |
| // @include http://*.reddit.com/* | |
| // @include https://*.reddit.com/* | |
| // @copyright 2012+, You | |
| // ==/UserScript== | |
| function main() { | |
| console.log('using toolbox utils version: ' + TBUtils.version); | |
| var things = $('div.thing .entry'); | |
| TBUtils.getModSubs(function(mySubs) { | |
| TBUtils.forEachChunked(things, 20, 500, function each(thing){ | |
| var user = TBUtils.getThingInfo(thing).user; | |
| var sub = TBUtils.getThingInfo(thing).subreddit; | |
| if(user === reddit.logged && $.inArray(sub, mySubs) !== -1){ | |
| $(thing).css('background-color', 'lightgreen'); | |
| } | |
| console.log(user); | |
| }, function complete() { | |
| console.log('hmc: done'); | |
| }); | |
| }); | |
| } | |
| // Add scripts to page | |
| (function () { | |
| var utilsURL = 'http://agentlame.github.io/toolbox/tbutils.js'; | |
| $('head').prepend('<script type="text/javascript" src='+ utilsURL +'></script>'); | |
| // CSS | |
| var css = '\ | |
| \\\ | |
| '; | |
| // Add CSS. | |
| var s = document.createElement('style'); | |
| s.type = "text/css"; | |
| s.textContent = css; | |
| document.head.appendChild(s); | |
| // Do not add script to page until TBUtils is added. | |
| (function loadLoop () { | |
| setTimeout(function () { | |
| if (TBUtils === undefined) { | |
| loadLoop(); | |
| } else { | |
| init(); | |
| } | |
| }, 250); | |
| })(); | |
| function init() { | |
| // Add settings | |
| var m = document.createElement('script'); | |
| m.textContent = "(" + main.toString() + ')();'; | |
| document.head.appendChild(m); | |
| } | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment