-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimage.html
More file actions
45 lines (41 loc) · 988 Bytes
/
image.html
File metadata and controls
45 lines (41 loc) · 988 Bytes
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
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Image Viewer</title>
<style>
.hidden {
display: none;
}
.centerImage {
max-width: 100%;
max-height: 100%;
bottom: 0;
left: 0;
margin: auto;
overflow: auto;
position: fixed;
right: 0;
top: 0;
}
</style>
<script>
(function () {
'use strict';
function getQueryStringValue(key) {
var arrSearch = location.search.split(key + '=')[1];
return arrSearch ? decodeURIComponent(arrSearch.split('&')[0].replace(/\+/g, ' ')) : false;
}
window.addEventListener('load', function () {
var imgUrl = getQueryStringValue('img');
var image = document.getElementById('main-image');
image.src = imgUrl;
image.classList.remove('hidden');
}, false);
}());
</script>
</head>
<body>
<img id="main-image" src="" alt="" class="centerImage hidden" />
</body>
</html>