Page 1 of 1

Can anyone write a simple Greasemonkey script for me?

Posted: Wed May 05, 2010 5:56 pm
by jupider
It's not even Paradox related...
A while ago, IMDb added a stupid "Link this trivia" link after every single fucking trivia item. Needless to say I find this extremely annoying. If anyone has the knowledge, desire, and/or heart to write something simple that just hides the link (and maybe even the <hr> below it) for me, I could send you a simple "thank you" package in-game.

Thanks!

Re: Can anyone write a simple Greasemonkey script for me?

Posted: Thu May 06, 2010 6:18 pm
by Gobberwart
Should be pretty simple actually, just set the style on the "linksoda" class to "visibility: hidden" for anything on imdb.

While a greasemonkey script would be easy enough, but have you considered the Stylish Firefox extension? It lets you change the properties of any style on any page/site using a GUI. Check it out at https://addons.mozilla.org/en-US/firefox/addon/2108

For greasemonkey, something like this should probably work (not tested, might need some tweaking). Rather than setting the style, it just removes the element.

Code: Select all

var allTriviaLinks = document.getElementsByClassName('linksoda');
var thisTriviaLink;
for (var i = 0; i < allTriviaLinks.length; i++) {
    thisTriviaLink = allTriviaLinks[i];
    thisTriviaLink.parent.removeChild(thisTriviaLink);
}
If you want to leave the element there but just hide it, change the "removeChild" line to

Code: Select all

thisTriviaLink.style.visibility = 'hidden';

Re: Can anyone write a simple Greasemonkey script for me?

Posted: Sat May 08, 2010 11:18 am
by jupider
The Greasemonkey thing worked, but I went ahead and got Stylish and I like it better, although, you said:
Stylish [...] lets you change the properties of any style on any page/site using a GUI.
Where exactly is this GUI?? All I can seem to get is a cryptic "New style" window with "Name", "Tags", and a text box, presumably for the code.

I did manage to find an existing IMDb Style that I like and added the functionality of removing the stated links, but I am having difficulty in figuring out how to remove the <hr>s from the trivia page (they would be in the "soda" class of the <div> on that page, so I'm trying to figure out the proper syntax.)

Re: Can anyone write a simple Greasemonkey script for me?

Posted: Sat May 08, 2010 12:12 pm
by Gobberwart
jupider wrote:Where exactly is this GUI?? All I can seem to get is a cryptic "New style" window with "Name", "Tags", and a text box, presumably for the code.
Meh, ok so it's not that good of a GUI :) Should be possible to just create a style called "IMDB Trivia Link Remover" or similar, then add something like this to the text box:

Code: Select all

@-moz-document domain("imdb.com") {
  .linksoda {visibility:hidden}
 }
Or something. I dunno, I don't actually use it myself, just thought it might be marginally easier.