Hi all -
I've written my first extension for firefox and both wanted to get it out there and get some help.
In a nutshell it redirects you from "xxx.slashdot.org/...." to "slashdot.org/..." where "xxx" is any of the sub-sites of slashdot. It does this because I can't stand their themes.
http://www.pjkh.com/extensions/slashdotredirect/
Here's my questions:
- This extension adds a listener to the onload event so it has to load the entire page before it can swap it out. There's got to be a way to do it earlier, no?
- It doesn't work when you middle click on a link to open it in a background tab. Obviously, I'm not "hooking" in at the right place, but this being my first extension, I'm not entirely sure where to link in to.
Any pointers to source/examples/reference are greatly appreciated!
-philip
Announcing "Slashdot Redirect" Firefox extension..
-
- Posts: 6
- Joined: August 6th, 2003, 1:05 pm
-
- Posts: 98
- Joined: December 8th, 2002, 10:11 pm
- Location: Burbank, IL USA
- Contact:
-
- Posts: 6
- Joined: August 6th, 2003, 1:05 pm
Your welcome! I found that over the last couple of months I would constantly edit the URL to remove the "it" and "games". The others aren't too bad, but those two are awful.
If you have any idea how I can tie into that middle click let me know and I'll add it.
I suspect, it's not tying into the middle click though, my guess is that somewhere there is an "open this url now" function that I want to hook into and modify it there. That would change it before you load it and cover any possible method of opening the url (bookmark, email, pasted, whatever)... I just don't know where to find it yet
But it helps a little bit.
If you have any idea how I can tie into that middle click let me know and I'll add it.
I suspect, it's not tying into the middle click though, my guess is that somewhere there is an "open this url now" function that I want to hook into and modify it there. That would change it before you load it and cover any possible method of opening the url (bookmark, email, pasted, whatever)... I just don't know where to find it yet
But it helps a little bit.
-
- Posts: 1752
- Joined: November 7th, 2002, 9:35 pm
For the second thing, SR_onPageLoad checks against _content; _content is foreground tab contents. Hence you're skipping the check if the content was not loaded in the foreground tab in the outermost frame.
Also, it looks like it will catch URLs like http://example.com/oldstuff/foo.slashdot.org/article.pl (and redirect that to the real /.).
As for the first - not sure, you may want to see what the LiveHTTPHeaders people are doing and see if it helps - I don't actually know if you can rewrite stuff based on what they're using though.
(Stupid Proximitron - won't do the header redirect for me after the reinstall for some reason)
P.S. Your server appears to be serving the XUL file as application/vnd.mozilla.xul+xml for your source view So the browser tries to load it instead...
Also, it looks like it will catch URLs like http://example.com/oldstuff/foo.slashdot.org/article.pl (and redirect that to the real /.).
As for the first - not sure, you may want to see what the LiveHTTPHeaders people are doing and see if it helps - I don't actually know if you can rewrite stuff based on what they're using though.
(Stupid Proximitron - won't do the header redirect for me after the reinstall for some reason)
P.S. Your server appears to be serving the XUL file as application/vnd.mozilla.xul+xml for your source view So the browser tries to load it instead...
poot.
-
- Posts: 6
- Joined: August 6th, 2003, 1:05 pm