This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
My goal: I have a list of names for a friend list. If any user is on it, change their post color.
It appears to work in fiddle, http://jsfiddle.net/j935k/7/
But fails on imgur.I've tried many options. (I do get console.log output, so I know it is loading it. )
some of my attempts:
only shows the first user, It should create a list of every div.author
's first-a-child.
$("div.author a:first").each(function() {
var x = $(this).text();
if( nameInFavs(x)) {
$(this).css("color", "orange");
}
});
This matches nothing.
The urls are always in the format of
<a href="/user/foo">foo</a>
so I tried to partial match, or prefix-match without luck. a[href~='/user']
I've written userscripts on other webpages, What am I doing wrong? Is there something special happeneing at imgur?
Code from jsfiddle:
var favs = new Array("foo", "bar");
function nameInFavs(n) {
if(favs.indexOf(n) != -1)
return true;
return false;
}
$("div.author a").each(function(i) {
console.log("i= " i);
var x = $(this).text();
if( nameInFavs(x)) {
$(this).css("color","orange");
}
});
Post Details
- Posted
- 10 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/jquery/comm...