r/GreaseMonkey • • Feb 27 '12

[Request] Help making very simple script that will add the current url to the end of another url and load the page.

I want to write a script that will basically search the current URL on "karma decay". All it has to do is take the URL of the page that I am on and add it to this url:

http://karmadecay.com/

For example if I am on:

http://i.imgur.com/GBoiG.jpg

Clicking the extension will lead to this

The script getting my current URL :
http://i.imgur.com/GBoiG.jpg

Adding it to this URL 
http://karmadecay.com/ (the last slash is important)

And then coming up with this URL:
http://karmadecay.com/http://i.imgur.com/GBoiG.jpg

And then load the page.

Any ideas?

1 Upvotes

3 comments sorted by

3

u/JohnaldTheRobot Feb 27 '12

How about making a bookmarklet? Just have this as the url:

javascript:var%20orig=location.href;location.replace('http://karmadecay.com/'+orig);

2

u/sentry07 Feb 28 '12

Alternatively:

  javascript:window.open("http://karmadecay.com/"+window.location);  

Nothing wrong with yours, I just prefer to open new windows when doing stuff like this. :)

1

u/grafilicious Feb 28 '12

Question is how do you want to trigger the search? Have an extra link on the page?