-
Notifications
You must be signed in to change notification settings - Fork 0
/
example2.html
71 lines (61 loc) · 2.28 KB
/
example2.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Shared Windows ver:2.0</title>
<script src="sharedwnd.js" async=false defer></script>
<style>
body {
background-color: #000;
overflow: hidden;
}
#output {
color: #fff;
height:auto;
}
#output table {
border: 1px solid white;
border-collapse: collapse;
width: 80%;
}
#output table td {
border: 1px solid white;
padding: 5px;
width: 20%;
}
</style>
</head>
<body>
<div id="output"></div>
<script>
window.onload = function() {
initSharedWnd();
}
window.onunload = function() {
clearSharedWnd();
}
let out = document.getElementById("output");
var interval = setInterval(function() {
let innerHTML = "";
if(localStorage.getItem("shwndid")) {
let shwndid = parseInt(sessionStorage.getItem("shwndid"));
let info = "<td>"+window.screenX+"</td><td>"+window.screenY + "</td><td>"+window.innerWidth + "</td><td>"+window.innerHeight+"</td>";
localStorage.setItem("shwndid"+shwndid,info);
innerHTML = "<table>";
innerHTML += "<tr><td colspan='5'>Number of windows: "+localStorage.getItem("shwndid")+", id: "+sessionStorage.getItem("shwndid")+"</td></tr>";
innerHTML += "<tr><td>id</td><td>X</td><td>Y</td><td>Width</td><td>Height</td></tr>";
innerHTML += "<tr><td>Current window</td>"+info+"</tr>";
let ls = localStorage.getItem("shwndid");
let arr = ls.split(",");
for(let i in arr) {
// list.innerHTML += arr[i] + ": "+ localStorage.getItem("shwndid"+arr[i])+"\n";
innerHTML += "<tr><td>"+arr[i]+"</td>"+localStorage.getItem("shwndid"+arr[i])+"</tr>";
}
innerHTML += "</table>";
}
out.innerHTML = innerHTML;
}, 25);
</script>
</body>
</html>