-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdialog.html
45 lines (41 loc) · 1.44 KB
/
dialog.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="Example Dialog Window">
<link rel="icon" type="image/x-icon" href="favicon_window.ico">
<title>Example Dialog Window</title>
<style>
body, html {
padding: 0 0;
margin: 0 0;
}
</style>
</head>
<body data-preferred-window-width="250" data-preferred-window-height="140">
<h1 id="question_text">Placeholder</h1>
<button onclick="wm_client.return_dialog('foo'); wm_client.close('true')">foo</button>
<button onclick="wm_client.return_dialog('bar'); wm_client.close('true')">bar</button>
<button onclick="wm_client.return_dialog('buzz'); wm_client.close('true')">buzz</button>
<script src="WindowClient.js"></script>
<script>
// get control over this window
let wm_client = new WindowClient(window.parent)
wm_client.register_message_handler()
wm_client.callbacks.window_arg = (a) => {
window.question_text.innerText = a
}
// require a confirm event before closing(to send the dialog return value)
wm_client.set_confirm("true")
wm_client.callbacks.close_confirm = () => {
wm_client.return_dialog("close")
}
// resize to fixed dimensions(after possible auto-resize from iframe onload)
document.body.onload = () => {
//wm_client.set_size(250, 140)
wm_client.set_fixed_size("true")
}
</script>
</body>
</html>