Chromium Code Reviews| Index: ppapi/examples/mouse_lock/mouse_lock.html |
| diff --git a/ppapi/examples/mouse_lock/mouse_lock.html b/ppapi/examples/mouse_lock/mouse_lock.html |
| index 5ce226109645c56506d1505abf326226f1a1411b..276c8b2433c43deab56422fdce9e68f1d9ec84b6 100644 |
| --- a/ppapi/examples/mouse_lock/mouse_lock.html |
| +++ b/ppapi/examples/mouse_lock/mouse_lock.html |
| @@ -13,16 +13,6 @@ |
| 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"> |
| @@ -61,15 +51,45 @@ |
| </li> |
| </ul> |
| <div> |
| - <button id="toggle_fullscreen" onclick="ToggleFullscreen();"> |
| + <button 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" ' + |
|
yzshen1
2012/01/24 18:56:08
4 space indent? (But I am not familiar with javasc
|
| + '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> |