-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.html
More file actions
44 lines (39 loc) · 1.07 KB
/
test.html
File metadata and controls
44 lines (39 loc) · 1.07 KB
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
<!DOCTYPE html>
<html lang="vi" class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width">
</head>
<body>
<figure>
<div>
<img class="fake-image" src="data:image/svg+xml;charset=utf-8,%3Csvg xmlns%3D'http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg' viewBox%3D'0 0 614 1120'%2F%3E" width="614" data-src="/media/frequent_wind_plan.svg" />
</div>
</figure>
<script>
(function() {
var loadRealImages = function() {
var isOperaMini = Object.prototype.toString.call(window.operamini) === "[object OperaMini]";
alert(isOperaMini);
var imgTags = document.querySelectorAll(".fake-image");
for (i = 0; i < imgTags.length; ++i) {
var tag = imgTags[i];
var img = new Image();
img.onload = function() {
tag.src = this.src;
}
var realSrc = tag.getAttribute("data-src");
if (isOperaMini) realSrc = realSrc.replace(".svg", ".png");
img.src = realSrc;
}
}
window.addEventListener('load', function() {
window.setTimeout(function() {
loadRealImages();
}, 0);
}, false);
})();
</script>
</body>
</html>