| Homestar Runner Wiki Forum http://forum.hrwiki.org/ |
|
| H*R Wiki Bookmarklet http://forum.hrwiki.org/viewtopic.php?f=1&t=8274 |
Page 1 of 1 |
| Author: | teh_toaster [ Wed May 10, 2006 5:16 pm ] |
| Post subject: | H*R Wiki Bookmarklet |
Here is a bookmarklet that I find handy in going straight to a page in the wiki from any toon, sb_email, or whatever page from HR. [url=javascript:(function(){if(location.href.indexOf('homestarrunner.com/')>0){l=window.location+'';h=l.replace('http://www.homestarrunner.com/','http://www.hrwiki.org/index.php/');window.location=h.replace('.html','');}else location.href='http://www.homestarrunner.com';})()]H*RWiki Lookup[/url] Just find the bookmarklet in your list of bookmarks and it will take you to that toon's page in HRWiki. If for some reason you're not already at H*R, you will be taken there. Has been tested and works in FF 1.5.0.3, Opera 9.0, and IE 6.0. Gauruntee? Warin-tea? No-way! Code: javascript:
(function(){ javascript:(function(){if(location.href.indexOf('homestarrunner.com/')>0){l=window.location+'';h=l.replace('http://www.homestarrunner.com/','http://www.hrwiki.org/index.php/');window.location=h.replace('.html','');}else location.href='http://www.homestarrunner.com';})() If the links don't show up all pretty-like, just create a bookmark with the listed code as the URL, all on one line. |
|
| Author: | ed 'lim' smilde [ Wed May 10, 2006 10:06 pm ] |
| Post subject: | |
You forgot a '{' after the 'else', but other than that, w00000000000. It has to be all one line so here's the code as just one: Code: javascript:(function(){javascript:(function(){ if(location.href.indexOf('homestarrunner.com/')>0){l=window.location+'';h=l.replace('http://www.homestarrunner.com/','http://www.hrwiki.org/index.php/'); window.location=h.replace('.html','');} else {location.href='http://www.homestarrunner.com';})() If you have greasemonkey I would reccomend Phlip's greasemonkey script. It contains somethin' like this.
|
|
| Author: | InterruptorJones [ Wed May 10, 2006 10:44 pm ] |
| Post subject: | |
Actually, the code both of you posted is broken. teh_toaster's is broken 'cause of that extra javasript:(function(){ at the beginning and Ed, the "forgotten" bracket you added wasn't forgotten at all. The following code works: Code: javascript:(function(){if(location.href.indexOf('homestarrunner.com/')>0){l=window.location+'';h=l.replace('http://www.homestarrunner.com/','http://www.hrwiki.org/index.php/');window.location=h.replace('.html','');}else location.href='http://www.homestarrunner.com';})() Here's a less, er, compressed version so you can see what's going on: Code: javascript:(function(){
if(location.href.indexOf('homestarrunner.com/') > 0) { l = window.location + ''; h = l.replace('http://www.homestarrunner.com/', 'http://www.hrwiki.org/index.php/'); window.location = h.replace('.html' , ''); } else location.href = 'http://www.homestarrunner.com'; })() Edit: I also just noticed that it only works if you're at www.homestarrunner.com. If you're at http://homestarrunner.com/* it fails. |
|
| Author: | InterruptorJones [ Wed May 10, 2006 11:02 pm ] |
| Post subject: | |
Totally illegal double post: I just couldn't resist. Here's my version that works with or without the "www." and is 69 characters shorter to boot (tested on Firefox 1.5 and IE6): Code: javascript:(function(){l=location+'';if(l.indexOf('homestarrunner.com/')>0) location='http://www.hrwiki.org/index.php/'+l.split('/')[3].split('.')[0];else location='http://www.homestarrunner.com/';})() And here's the unabridged version: Code: javascript:(function(){
l = location + ''; if(l.indexOf('homestarrunner.com/') > 0) location = 'http://www.hrwiki.org/index.php/' + l.split('/')[3].split('.')[0]; else location = 'http://www.homestarrunner.com/'; })() |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|