wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
riddles >> general problem-solving / chatting / whatever >> Help with Greasemonkey
(Message started by: TenaliRaman on Sep 9th, 2007, 9:48pm)

Title: Help with Greasemonkey
Post by TenaliRaman on Sep 9th, 2007, 9:48pm
I have learnt a bit of Greasemonkey scripting. I would like to finally write a greasemonkey script for multiple quotes as discussed in one of the earlier threads. But thats quite a bit in the future for me.

Before that, to start off, i am trying to write a small greasemonkey script for ignoring users on this forum (the attempt is to not display the posts of that particular user). I just thought it might be a fun project to start with.

I was just viewing the source of the generated pages in wu forum and i realise that
1. i will have to find the anchor tag that has "username=<user>"
2. Go 3 tables up and ignore those tables.

Doing 1 is quite easy. I am not sure i have seen an example of 2 yet. Any ideas would be greatly appreciated.

-- AI

Title: Re: Help with Greasemonkey
Post by Sameer on Sep 9th, 2007, 10:33pm
Oh my gosh!!! :o I was just thinking of this today and was googling around if there was any script to do so!! Please do this ASAP... I think lot of us needs it!!   :-X

Title: Re: Help with Greasemonkey
Post by towr on Sep 9th, 2007, 11:49pm
For the selected table (element) set
style.display='none';
Or, if you still want to see there was a post there
style.visibility='hidden';

Title: Re: Help with Greasemonkey
Post by TenaliRaman on Sep 10th, 2007, 1:13am
A basic version is ready, which removes posts of a "particular" user at the moment. Its very basic and simple (i mean its hardly 10 lines of code) at the moment. Lot of improvements are possible and i will try to gradually add them to the script.

I am attaching the script with this post. So, you can get some immediate relief, if you catch my drift.

-- AI
P.S -> Remove the txt extension

Title: Re: Help with Greasemonkey
Post by TenaliRaman on Sep 10th, 2007, 1:24am

on 09/09/07 at 23:49:11, towr wrote:
For the selected table (element) set
style.display='none';
Or, if you still want to see there was a post there
style.visibility='hidden';

Thats a good idea. Infact, i think i should be able to attach a button, where will allow you to see a particular removed post on click. By default, we can keep them hidden. Though, i am not particularly sure of how i am going to do that with greasemonkey, unless it allows me add custom java scripts to the HTML page.

-- AI
P.S -> I need ideas though on dynamic addition of ignored users, without manually rewriting script every time. Is it possible to do with greasemonkey?

Title: Re: Help with Greasemonkey
Post by towr on Sep 10th, 2007, 1:45am

on 09/10/07 at 01:24:08, TenaliRaman wrote:
i am not particularly sure of how i am going to do that with greasemonkey, unless it allows me add custom java scripts to the HTML page.
There are ways to do that. I think it's used in the math symbol userscript as well. So you could dig around in that code for inspiration.



Quote:
I need ideas though on dynamic addition of ignored users, without manually rewriting script every time. Is it possible to do with greasemonkey?
Aside from using cookies, I doubt it. You'd have to make a proper firefox extension.

Title: Re: Help with Greasemonkey
Post by Eigenray on Sep 10th, 2007, 2:34am
Use [link=http://diveintogreasemonkey.org/api/index.html]GM_setValue and GM_getValue[/link].  These variables will appear in about:config under greasemonkey.scriptvals.<namespace>/<name>.<key>

Title: Re: Help with Greasemonkey
Post by SMQ on Sep 10th, 2007, 5:04am
However, the GM_* functions only work under Firefox/NS9 with Greasemonkey; they're not portable to IE, Safari, etc. if that's a consideration.

--SMQ

Title: Re: Help with Greasemonkey
Post by Sameer on Sep 10th, 2007, 9:20am
Small question!! I am not good with this, so how do I go about using it? And by the way you want to actually not use the "actual" username in your attached script just to be politically correct!!  ;)

Title: Re: Help with Greasemonkey
Post by TenaliRaman on Sep 10th, 2007, 10:42am
I bring to thee my super duper grease monkey script.........
Ok its not super duper, its a tad bit nicer than the earlier version. It will allow you to see some of the removed posts and if you still feel yucky, you can hide them back.



on 09/10/07 at 09:20:11, Sameer wrote:
Small question!! I am not good with this, so how do I go about using it?

1. Remove the txt extension of the file.
[edit]The forum software has renamed the file, the filename should something like <ignore_the_idiots>.js[/edit]
2. If you dont have firefox, get firefox.
3. Install greasemonkey add-on for the firefox.
(Greasemonkey-like softwares do exist for other browsers, but i dont know how well my script works in other browsers)
4. Open my super duper greasemonkey script in firefox. Greasemonkey will ask you whether you want to install this uber script. Click on "yes"(you have no option).


Quote:
And by the way you want to actually not use the "actual" username in your attached script just to be politically correct!!  ;)

Oh, that name is just a test example. Replace that with anything you may wish. ::)

-- AI

Title: Re: Help with Greasemonkey
Post by TenaliRaman on Sep 10th, 2007, 11:11am

on 09/10/07 at 02:34:18, Eigenray wrote:
Use [link=http://diveintogreasemonkey.org/api/index.html]GM_setValue and GM_getValue[/link].  These variables will appear in about:config under greasemonkey.scriptvals.<namespace>/<name>.<key>

Hey, neat idea. I will give it a try.


on 09/10/07 at 05:04:34, SMQ wrote:
However, the GM_* functions only work under Firefox/NS9 with Greasemonkey; they're not portable to IE, Safari, etc. if that's a consideration.

Well, its worth a shot. People can use whichever works for them. Though, they will be losing out on some functionality.

(Note : People who maybe expecting this super-duper-reloaded script, dont hold your breath. I am not sure, i can even finish it  :-/)


on 09/10/07 at 01:45:17, towr wrote:
Aside from using cookies, I doubt it. You'd have to make a proper firefox extension.

Hmm, would have to look at the APIs. If its easy to do as it is in greasemonkey, i might just give it a shot. (Though, i am not particularly sure how my boss would feel about it ;D)

-- AI



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board