blob: f12f429491342ebd04df786d1d88edacc8cd3e84 (
plain)
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
|
<!DOCTYPE html>
<script src="utils.js"></script>
<style>
body, html {
margin: 0;
padding; 0;
background-color: #bfb;
}
</style>
<body>
<div>Child frame</div>
</body>
<script>
"use strict";
let cancel_mousedown = false;
window.addEventListener("load", () => {
window.addEventListener("message", event => {
let data = event.data;
if (data.type == "cancel-mousedown")
cancel_mousedown = data.param;
});
window.addEventListener("mousedown", e => {
let msg = "not-canceled";
if (cancel_mousedown) {
e.preventDefault();
msg = "canceled";
}
sendMessage(window.top, "mousedown", msg);
});
window.addEventListener("mouseup", e => sendMessage(window.top, "mouseup"));
sendMessage(parent, "load");
});
</script>
|