-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathread-id.html
More file actions
49 lines (46 loc) · 1.59 KB
/
read-id.html
File metadata and controls
49 lines (46 loc) · 1.59 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
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<script>
window.parentOrigin = "*"; // Change to "https://www.prairietest.org" or similar
var ready = function(callback) {
if (document.readyState != "loading") callback();
else document.addEventListener("DOMContentLoaded", callback);
};
ready(() => {
window.addEventListener("message", (event) => {
//if (event.origin !== window.parentOrigin) return; // Uncomment this line for production
if (!event.data) return;
if (event.data.tag == 'init') {
window.secret = event.data.secret;
window.parent.postMessage({tag: 'initialized', secret: window.secret}, window.parentOrigin);
document.getElementById('status').textContent = 'Successfully initialized.';
}
}, false);
});
</script>
</head>
<body>
<p>
This is <tt>read-id.html</tt>
</p>
<p>
Status: <span id="status">Initializing...</span>
</p>
<p>
<label for="uid">UID:</label>
<input id="uid">
<button onclick="window.parent.postMessage({tag: 'read-id', secret: window.secret, uid: document.getElementById('uid').value}, window.parentOrigin);">
Send UID
</button>
</p>
<p>
<label for="uin">UIN:</label>
<input id="uin">
<button onclick="window.parent.postMessage({tag: 'read-id', secret: window.secret, uin: document.getElementById('uin').value}, window.parentOrigin);">
Send UIN
</button>
</p>
</body>
</html>