diff options
Diffstat (limited to 'ppapi/examples/mouse_lock/mouse_lock.html')
-rw-r--r-- | ppapi/examples/mouse_lock/mouse_lock.html | 54 |
1 files changed, 17 insertions, 37 deletions
diff --git a/ppapi/examples/mouse_lock/mouse_lock.html b/ppapi/examples/mouse_lock/mouse_lock.html index 5f0e5aa..5ce2261 100644 --- a/ppapi/examples/mouse_lock/mouse_lock.html +++ b/ppapi/examples/mouse_lock/mouse_lock.html @@ -1,7 +1,7 @@ <!DOCTYPE html> <html> <!-- - Copyright (c) 2012 The Chromium Authors. All rights reserved. + Copyright (c) 2011 The Chromium Authors. All rights reserved. Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. --> @@ -13,6 +13,16 @@ height: 100%; } </style> + <script> + function ToggleFullscreen() { + if (document.webkitIsFullScreen) { + document.webkitCancelFullScreen(); + } else { + document.getElementById('container').webkitRequestFullScreen( + Element.ALLOW_KEYBOARD_INPUT); + } + } + </script> </head> <body title="This tooltip should not be shown if the mouse is locked."> <div id="container"> @@ -51,45 +61,15 @@ </li> </ul> <div> - <button onclick="ToggleFullscreen();"> + <button id="toggle_fullscreen" onclick="ToggleFullscreen();"> Toggle Tab Fullscreen </button> - <button onclick="AddAPlugin();"> - Add A Plugin - </button> - <button onclick="RemoveAPlugin();"> - Remove A Plugin (press 'x') - </button> - </div> - <div id="plugins_container"> </div> + <object id="plugin" type="application/x-ppapi-example-mouse-lock" + width="300" height="300" border="2px"></object> + <div></div> + <object id="plugin" type="application/x-ppapi-example-mouse-lock" + width="300" height="300" border="2px"></object> </div> </body> -<script> - plugins_container = document.getElementById("plugins_container"); - AddAPlugin(); - AddAPlugin(); - - function ToggleFullscreen() { - if (document.webkitIsFullScreen) { - document.webkitCancelFullScreen(); - } else { - document.getElementById('container').webkitRequestFullScreen( - Element.ALLOW_KEYBOARD_INPUT); - } - } - function AddAPlugin() { - plugins_container.insertAdjacentHTML("BeforeEnd", - '<object type="application/x-ppapi-example-mouse-lock" ' + - 'width="300" height="300" border="2px"></object>'); - } - function RemoveAPlugin() { - if (plugins_container.firstElementChild) - plugins_container.removeChild(plugins_container.firstElementChild); - } - document.body.onkeydown = function (e) { - if (String.fromCharCode(e.keyCode) == "X") - RemoveAPlugin(); - } -</script> </html> |