?.jpg

Subscribe to ?.jpg 14 posts, 5 voices

 
suvvy User

can somebody please make me a script for greasemonkey that automaticall adds ?.jpg to every URL?
i've heard it's really simple, but i can't do JS for my life!

 
znerp Scriptwright

Is that to every link, or to the location of the window? To add it to every link, the following would work...

for (i = document.links.length - 1; i >= 0; i--) 
  document.links[i].href += "?.jpg"

 
suvvy User

how would i install this into greasemonkey?

 
suvvy User

so like if i type www.google.com/ then it would become www.google.com/?.jpg

 
znerp Scriptwright

So you want whatever address you go to to have ?.jpg appended to it? If that's the case, ignore my previous post .. you'd want...

window.location.replace(window.location.href + "?.jpg")

To install this in greasemonkey, right click the monkey face in the corner and select "New user script...". Fill in the details, and then paste that line into the script. Save it and then it should simply work.

 
suvvy User

thank you so much!

 
JoeSimmons Scriptwright

May I ask why you want ?.jpg on every url?
Also add *?.jpg* to the list of excludes or else your url bar will get infinitely filled up with ?.jpg's.
Or, without adding it to the list of includes, just replace that other line of script with this, and it will only run on the pages without ?.jpg in the url already

if(location.href.indexOf("?.jpg") == -1) location.href += "?.jpg";

 
suvvy User

right now i have to add specific sites, is there any way to do that for all sites?

 
JoeSimmons Scriptwright

Add

*

to the include list. The asterisk means all sites.

 
znerp Scriptwright

[...] or else your url bar will get infinitely filled up with ?.jpg's.
That's a very good point. That one's a schoolboy error, but one that I seem to make surprisingly often.

 
JoeSimmons Scriptwright

lol znerp

 
Pnoexz Scriptwright

Im not sure how it is an useful script, but ive put JoeSimmons' code into a .user.js file so you can install it without having to do it yourself :P

http://userscripts.org/scripts/show/31681

 
znerp Scriptwright

... why?

 
bunedoggle Scriptwright

So did I:

http://userscripts.org/scripts/show/32316