Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

index2.html 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. -->
  17. <!DOCTYPE HTML>
  18. <html>
  19. <head>
  20. <head>
  21. <meta http-equiv="Content-type" content="text/html; charset=utf-8">
  22. <title>Lifecycle Page 2</title>
  23. <link rel="stylesheet" href="../master.css" type="text/css" media="screen" title="no title">
  24. <script type="text/javascript" charset="utf-8" src="../cordova.js"></script>
  25. <script type="text/javascript" charset="utf-8">
  26. function onLoad() {
  27. console.log("Page2: onload");
  28. log("Page2: onload @ " + new Date().toLocaleTimeString());
  29. document.addEventListener("deviceready", onDeviceReady, false);
  30. }
  31. function onUnLoaded() {
  32. console.log("Page2: onunload");
  33. log("Page2: onunload @ " + new Date().toLocaleTimeString());
  34. }
  35. function onDeviceReady() {
  36. // Register the event listener
  37. document.getElementById("deviceready").innerHTML = "fired";
  38. document.getElementById("cordova").innerHTML = cordova.version;
  39. document.addEventListener("pause", onPause, false);
  40. document.addEventListener("resume", onResume, false);
  41. window.setInterval(function() {
  42. log("Page2: Running");
  43. }, 2000);
  44. }
  45. function onPause() {
  46. console.log("Page2: onpause");
  47. log("Page2: onpause @ " + new Date().toLocaleTimeString());
  48. }
  49. function onResume() {
  50. console.log("Page2: onresume");
  51. log("Page2: onresume @ " + new Date().toLocaleTimeString());
  52. }
  53. function log(s) {
  54. var el = document.getElementById('status');
  55. var status = el.innerHTML + s + "<br>";
  56. el.innerHTML = status;
  57. localStorage.lifecyclestatus = status;
  58. }
  59. function clearStatus() {
  60. console.log("clear()");
  61. localStorage.lifecyclestatus = "";
  62. document.getElementById('status').innerHTML = "";
  63. }
  64. </script>
  65. </head>
  66. <body onload="onLoad()" onunload="onUnLoaded()" id="stage" class="theme">
  67. <h1>Events</h1>
  68. <div id="info">
  69. <h4>Cordova: <span id="cordova"> &nbsp;</span></h4>
  70. <h4>Platform: <span id="platform"> &nbsp;</span>, Version: <span id="version">&nbsp;</span></h4>
  71. <h4>UUID: <span id="uuid"> &nbsp;</span>, Name: <span id="name">&nbsp;</span></h4>
  72. <h4>Width: <span id="width"> &nbsp;</span>, Height: <span id="height">&nbsp;</span>, Color Depth: <span id="colorDepth"></span></h4>
  73. </div>
  74. <div id="info">
  75. You should see<br>
  76. <ul>
  77. <li>Page1: onunload</li>
  78. <li>Page2: onload</li>
  79. <li>Page2: Running</li>
  80. </ul>
  81. Press "backbutton" to return to Page 1.
  82. </div>
  83. <div id="info">
  84. <h4>Info for event testing:</h4>
  85. <div id="status"></div>
  86. </div>
  87. <a href="index.html" class="btn large" >Load new page</a>
  88. <a href="javascript:" class="btn large" onclick="clearStatus();">Clear status</a>
  89. <script>
  90. document.getElementById('status').innerHTML = localStorage.lifecyclestatus;
  91. </script>
  92. </body>
  93. </html>