-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
121 lines (116 loc) · 2.96 KB
/
index.html
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Window Size</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<link rel="shortcut icon" href="./favicon.png">
<style>
html, body {
margin: 0;
padding: 0;
position: relative;
height: 100%;
font-size: 100%;
font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif;
}
section {
display: table;
position: relative;
height: 100%;
width: 100%;
text-align: center;
}
div {
display: table-cell;
vertical-align: middle;
}
h1 {
margin: 10px 0;
font-size: 3rem;
}
h3 {
margin: 10px 0;
font-size: 1.6rem;
}
small {
opacity: .5;
}
img {
max-width: 200px;
padding: 1rem;
margin: 1rem;
border: 1px solid #ccc;
}
pre {
margin: 10px;
display: inline-block;
background-color: #f5f5f5;
padding: 1rem;
}
@media (min-width: 1024px) {
h1 {
font-size: 5rem;
}
}
</style>
</head>
<body>
<section>
<div>
<h1 id="outer">000<small>×</small>000</h1>
<h3 id="inner">000<small>×</small>000</h3>
<h4>
<em>
devicePixelRatio: <span id="devicePixelRatio">2</span><br>
dpi_x: <span id="dpi_x">00</span> <small>×</small> 96<br>
dpi_y: <span id="dpi_y">00</span> <small>×</small> 96
</em>
</h4>
<div id="test-div" style="height: 1in; left: -100%; position: absolute; top: -100%; width: 1in;"></div>
</div>
</section>
<hr style="width: 110%">
<section>
<div>
<img
alt
src="./qr-code.png"
aria-hidden="true"
draggable="false"
loading="lazy"
>
</div>
</section>
<script>
(function() {
'use strict';
const devicePixelRatio = window.devicePixelRatio || 1;
const testDiv = document.getElementById('test-div');
const dpi_x = testDiv.offsetWidth * devicePixelRatio;
const dpi_y = testDiv.offsetHeight * devicePixelRatio;
document.getElementById('devicePixelRatio').textContent = devicePixelRatio;
document.getElementById('dpi_x').textContent = dpi_x;
document.getElementById('dpi_y').textContent = dpi_y;
function printSize() {
const x = '<small>×</small>';
document.getElementById('outer').innerHTML = window.outerWidth + x + window.outerHeight;
document.getElementById('inner').innerHTML = window.innerWidth + x + window.innerHeight;
}
let timer;
function delayedPrintSize() {
clearTimeout(timer);
timer = setTimeout(() => {
printSize();
}, 300);
}
window.addEventListener('resize', delayedPrintSize);
window.addEventListener('orientationchange', delayedPrintSize)
delayedPrintSize();
})();
</script>
</body>
</html>