forked from craigcoles/Craig-Will-Fix-It
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFixIt.js
60 lines (44 loc) · 1.72 KB
/
FixIt.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
(function(){
// the minimum version of jQuery we want
var v = "1.3.2";
// check prior inclusion and version
if (window.jQuery === undefined || window.jQuery.fn.jquery < v) {
var done = false;
var script = document.createElement("script");
script.src = "https://ajax.googleapis.com/ajax/libs/jquery/" + v + "/jquery.min.js";
script.onload = script.onreadystatechange = function(){
if (!done && (!this.readyState || this.readyState == "loaded" || this.readyState == "complete")) {
done = true;
initMyBookmarklet();
}
};
document.getElementsByTagName("head")[0].appendChild(script);
} else {
initMyBookmarklet();
}
function initMyBookmarklet() {
(window.myBookmarklet = function() {
var jimmy=function(){
for(var img=document.images,i=0;i<img.length;i++){
// var imagename = img[i].src.match('.*/(.*?).(jpe?g|gif|png)');
var imageSrc = img[i].src.match('savile|Savile');
var imageAlt = img[i].alt.match('savile|Savile');
if (imageSrc || imageAlt) {
var width = img[i].width;
var height = img[i].height;
img[i].style.height = height;
img[i].style.width = width;
if(width&&height) {
img[i].setAttribute("width", width);
img[i].setAttribute("height", height);
img[i].src='https://craig-will-fixit.s3.amazonaws.com/nspcc-logo.jpeg';
//img[i].style.background="url('https://craig-will-fixit.s3.amazonaws.com/nspcc-logo.jpeg') no-repeat center center";
}
}
}
return false
};
jimmy();
})();
}
})();