forked from andrewmd5/LaughingMan.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlaughingman.js
36 lines (32 loc) · 1.21 KB
/
laughingman.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
/**
* Created by Andrew on 12/7/2015.
*/
function LaughingMan() {
this.laughingManImage = "/assets/images/laughingman.gif";
}
LaughingMan.prototype.start = function() {
if (!document.getElementsByTagName) return;
var imageArray = document.getElementsByTagName("img");
var content = new Array();
var activeImages = 0;
for (var i = 0; i < imageArray.length; i++) {
content[activeImages] = imageArray[i];
activeImages++;
}
for (var x = 0, y = imageArray.length; x < y; x++) {
if (content[x]) {
content[x].style.background = "url(" + content[x].src + ")";
if (!content.push || !document.all) {
content[x].height = imageArray[x].height;
content[x].width = imageArray[x].width;
content[x].src = this.laughingManImage;
} else {
content[x].style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',src='img/new_png.png')";
content[x].height = imageArray[x].height;
content[x].width = imageArray[x].width;
content[x].src = this.laughingManImage;
}
}
}
};
var laughingman = new LaughingMan();