Skip to content

Instantly share code, notes, and snippets.

@MayaLekova
Created May 8, 2015 15:12
Show Gist options
  • Save MayaLekova/368ff771d83972dc201c to your computer and use it in GitHub Desktop.
Save MayaLekova/368ff771d83972dc201c to your computer and use it in GitHub Desktop.
JPGtoLinkAdder
// ==UserScript==
// @name JPGtoLinkAdder
// @namespace mayalekova
// @description Adds "?.jpg" to all links on the page (as described in http://debuggable.com/posts/hacking-a-commercial-airport-wlan:480f4dd5-50a0-40c6-aa60-4afccbdd56cb)
// @version 1
// @grant none
var anchors = document.getElementsByTagName("a");
for(var idx = 0; idx < anchors.length; idx++) {
if(anchors[idx].href.indexOf('?') >= 0){
anchors[idx].href += '&.jpg';
} else {
anchors[idx].href += '?.jpg';
}
}
// ==/UserScript==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment