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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 function lockMouse1AndEnterFullscreen() { | 89 function lockMouse1AndEnterFullscreen() { |
90 console.log("lockMouse1AndEnterFullscreen()"); | 90 console.log("lockMouse1AndEnterFullscreen()"); |
91 lockMouse1(); | 91 lockMouse1(); |
92 enterFullscreen(); | 92 enterFullscreen(); |
93 } | 93 } |
94 | 94 |
95 </script> | 95 </script> |
96 </head> | 96 </head> |
97 <body title="This tooltip should not be shown if the mouse is locked."> | 97 <body title="This tooltip should not be shown if the mouse is locked."> |
98 <div id="container"> | 98 <div id="container"> |
99 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen()<
/button><br> | 99 <button id="enterFullscreen" onclick="enterFullscreen();">enterFullscreen()
[f]</button><br> |
100 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen()</bu
tton><br> | 100 <button id="exitFullscreen" onclick="exitFullscreen();">exitFullscreen() [x]
</button><br> |
101 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1()</button><br> | 101 <button id="lockMouse1" onclick="lockMouse1();">lockMouse1() [1]</button><br
> |
102 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2()</button><br> | 102 <button id="lockMouse2" onclick="lockMouse2();">lockMouse2() [2]</button><br
> |
103 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou
se1()</button><br> | 103 <button id="delayedLockMouse1" onclick="delayedLockMouse1();">delayedLockMou
se1() [d]</button><br> |
104 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu
tton><br> | 104 <button id="spamLockMouse2" onclick="spamLockMouse2();">spamLockMouse2()</bu
tton><br> |
105 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse()</button><br> | 105 <button id="unlockMouse" onclick="unlockMouse();">unlockMouse() [u]</button>
<br> |
106 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou
se1()">enterFullscreenAndLockMouse1()</button><br> | 106 <button id="enterFullscreenAndLockMouse1" onclick="enterFullscreenAndLockMou
se1()">enterFullscreenAndLockMouse1() [b]</button><br> |
107 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr
een()">lockMouse1AndEnterFullscreen()</button><br> | 107 <button id="lockMouse1AndEnterFullscreen" onclick="lockMouse1AndEnterFullscr
een()">lockMouse1AndEnterFullscreen() [B]</button><br> |
108 <div id="lockTarget1">lockTarget1</div> | 108 <div id="lockTarget1">lockTarget1</div> |
109 <div id="lockTarget2">lockTarget2</div> | 109 <div id="lockTarget2">lockTarget2</div> |
110 </div> | 110 </div> |
111 This text is outside of the container that is made fullscreen. This text shoul
d not be visible when fullscreen. | 111 This text is outside of the container that is made fullscreen. This text shoul
d not be visible when fullscreen. |
112 </body> | 112 </body> |
| 113 <script> |
| 114 document.body.onkeypress = function (e) { |
| 115 switch (String.fromCharCode(e.charCode)) { |
| 116 case "f": enterFullscreen(); break; |
| 117 case "x": exitFullscreen(); break; |
| 118 case "1": lockMouse1(); break; |
| 119 case "2": lockMouse2(); break; |
| 120 case "d": delayedLockMouse1(); break; |
| 121 case "u": unlockMouse(); break; |
| 122 case "b": enterFullscreenAndLockMouse1(); break; |
| 123 case "B": lockMouse1AndEnterFullscreen(); break; |
| 124 } |
| 125 } |
| 126 </script> |
113 </html> | 127 </html> |
114 </html> | |
OLD | NEW |