2017-07-22 03:29:31 +00:00
|
|
|
<!DOCTYPE html>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Scrollable test</title>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<script src='mouse-helper.js'></script>
|
|
|
|
<script>
|
|
|
|
for (let i = 0; i < 100; i++) {
|
|
|
|
let button = document.createElement('button');
|
|
|
|
button.textContent = i + ': not clicked';
|
|
|
|
button.id = 'button-' + i;
|
|
|
|
button.onclick = () => button.textContent = 'clicked';
|
|
|
|
button.oncontextmenu = event => {
|
2022-04-27 21:00:07 +00:00
|
|
|
if (![2].includes(event.button)) {
|
|
|
|
return;
|
|
|
|
}
|
2017-07-22 03:29:31 +00:00
|
|
|
event.preventDefault();
|
|
|
|
button.textContent = 'context menu';
|
|
|
|
}
|
2022-04-27 21:00:07 +00:00
|
|
|
button.onmouseup = event => {
|
|
|
|
if (![1,3,4].includes(event.button)) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
event.preventDefault();
|
|
|
|
button.textContent = {
|
|
|
|
3: 'back click',
|
|
|
|
4: 'forward click',
|
|
|
|
1: 'aux click',
|
|
|
|
}[event.button];
|
|
|
|
}
|
2017-07-22 03:29:31 +00:00
|
|
|
document.body.appendChild(button);
|
|
|
|
document.body.appendChild(document.createElement('br'));
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
</body>
|
2022-04-27 21:00:07 +00:00
|
|
|
</html>
|