Homestar Runner Wiki Forum

A companion to the Homestar Runner Wiki
It is currently Thu Oct 05, 2023 5:46 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: H*R Wiki Bookmarklet
PostPosted: Wed May 10, 2006 5:16 pm 
Offline
User avatar

Joined: Wed May 10, 2006 4:46 pm
Posts: 3
Location: Chicago
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.


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 10:06 pm 
Offline
User avatar

Joined: Mon Jan 17, 2005 1:00 am
Posts: 3849
Location: Best Coast
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.

_________________
Image


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 10:44 pm 
Offline
User avatar

Joined: Mon May 10, 2004 6:05 am
Posts: 5636
Location: swirlee.org for great justice
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.

_________________
StrongCanada wrote:
Jordan, you are THE SUCK at kissing! YAY! Just thought you should know! Rainbows! Sunshine!


Top
 Profile  
 
 Post subject:
PostPosted: Wed May 10, 2006 11:02 pm 
Offline
User avatar

Joined: Mon May 10, 2004 6:05 am
Posts: 5636
Location: swirlee.org for great justice
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/';
})()

_________________
StrongCanada wrote:
Jordan, you are THE SUCK at kissing! YAY! Just thought you should know! Rainbows! Sunshine!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group