OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <title>Fullscreen and Mouse Lock Scripts</title> | 4 <title>Fullscreen and Mouse Lock Scripts</title> |
5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
6 | 6 |
7 function enterFullscreen() { | 7 function enterFullscreen() { |
8 console.log("enterFullscreen()"); | 8 console.log("enterFullscreen()"); |
9 document.getElementById('container').webkitRequestFullScreen( | 9 document.getElementById('container').webkitRequestFullScreen( |
10 Element.ALLOW_KEYBOARD_INPUT); | 10 Element.ALLOW_KEYBOARD_INPUT); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 function lockMouse1AndEnterFullscreen() { | 69 function lockMouse1AndEnterFullscreen() { |
70 console.log("lockMouse1AndEnterFullscreen()"); | 70 console.log("lockMouse1AndEnterFullscreen()"); |
71 lockMouse1(); | 71 lockMouse1(); |
72 enterFullscreen(); | 72 enterFullscreen(); |
73 } | 73 } |
74 | 74 |
75 </script> | 75 </script> |
76 </head> | 76 </head> |
77 <body title="This tooltip should not be shown if the mouse is locked."> | 77 <body title="This tooltip should not be shown if the mouse is locked."> |
78 <div id="container"> | 78 <div id="container"> |
79 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen()<
/button><br> | 79 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen()
[f]</button><br> |
80 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen()</bu
tton><br> | 80 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen() [x]
</button><br> |
81 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1()</button><br> | 81 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1() [1]</button><br
> |
82 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2()</button><br> | 82 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2() [2]</button><br
> |
83 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou
se1()</button><br> | 83 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou
se1() [d]</button><br> |
84 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu
tton><br> | 84 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu
tton><br> |
85 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse()</button><br> | 85 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse() [u]</button>
<br> |
86 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou
se1()">enterFullscreenAndLockMouse1()</button><br> | 86 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou
se1()">enterFullscreenAndLockMouse1() [b]</button><br> |
87 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr
een()">lockMouse1AndEnterFullscreen()</button><br> | 87 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr
een()">lockMouse1AndEnterFullscreen() [B]</button><br> |
88 <div id="lockTarget1">lockTarget1</div> | 88 <div id="lockTarget1">lockTarget1</div> |
89 <div id="lockTarget2">lockTarget2</div> | 89 <div id="lockTarget2">lockTarget2</div> |
90 </div> | 90 </div> |
91 This text is outside of the container that is made fullscreen. This text shoul
d not be visible when fullscreen. | 91 This text is outside of the container that is made fullscreen. This text shoul
d not be visible when fullscreen. |
92 </body> | 92 </body> |
| 93 <script> |
| 94 document.body.onkeypress = function (e) { |
| 95 switch (String.fromCharCode(e.charCode)) { |
| 96 case "f": enterFullscreen(); break; |
| 97 case "x": exitFullscreen(); break; |
| 98 case "1": lockMouse1(); break; |
| 99 case "2": lockMouse2(); break; |
| 100 case "d": delayedLockMouse1(); break; |
| 101 case "u": unlockMouse(); break; |
| 102 case "b": enterFullscreenAndLockMouse1(); break; |
| 103 case "B": lockMouse1AndEnterFullscreen(); break; |
| 104 } |
| 105 } |
| 106 </script> |
93 </html> | 107 </html> |
94 </html> | |
OLD | NEW |