forked from afeld/mustachio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbookmarklet.js
18 lines (17 loc) · 950 Bytes
/
bookmarklet.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// original
javascript:(function(){
var URL = 'http://mustachify.me/magickly?mustachify=true&src=';
var images = document.getElementsByTagName('img');
var i;
for (i = 0; i < images.length; i += 1){
var image = images[i];
var src = image.getAttribute('src');
if (image.src[0] === '/'){
image.setAttribute('src', URL + encodeURIComponent(window.location.origin + src));
} else if (src.match(/^https?:\/\//)) {
image.setAttribute('src', URL + encodeURIComponent(src));
}
}
})();
// JSMin'd
javascript:(function(){var URL='http://mustachify.me/magickly?mustachify=true&src=';var images=document.getElementsByTagName('img');var i;for(i=0;i<images.length;i+=1){var image=images[i];var src=image.getAttribute('src');if(image.src[0]==='/'){image.setAttribute('src',URL+encodeURIComponent(window.location.origin+src));}else if(src.match(/^https?:\/\//)){image.setAttribute('src',URL+encodeURIComponent(src));}}})();