Can anyone write a simple Greasemonkey script for me?

Anything that doesn't fit in any other forum.

Moderator: Public Forum Moderators

User avatar

Topic author
jupider
Senior Chat Moderator
Posts: 579
Joined: Mon Sep 01, 2008 5:39 pm

Can anyone write a simple Greasemonkey script for me?

Unread post by jupider » Wed May 05, 2010 5:56 pm

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!
Gobberwart wrote:Jupider is EXACTLY right.
"In the time of war, we would never have left a man stranded."
"Maybe that's why we lost."

User avatar

Gobberwart
Developer
Posts: 3396
Joined: Wed Jun 20, 2007 12:41 am
Location: Melbourne, Australia
Contact:

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

Unread post by Gobberwart » Thu May 06, 2010 6:18 pm

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';
Image

User avatar

Topic author
jupider
Senior Chat Moderator
Posts: 579
Joined: Mon Sep 01, 2008 5:39 pm

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

Unread post by jupider » Sat May 08, 2010 11:18 am

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.)
Last edited by jupider on Sat May 08, 2010 12:21 pm, edited 1 time in total.
Gobberwart wrote:Jupider is EXACTLY right.
"In the time of war, we would never have left a man stranded."
"Maybe that's why we lost."

User avatar

Gobberwart
Developer
Posts: 3396
Joined: Wed Jun 20, 2007 12:41 am
Location: Melbourne, Australia
Contact:

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

Unread post by Gobberwart » Sat May 08, 2010 12:12 pm

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.
Image

Post Reply