index.html 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <style>
  6. @media screen and (orientation: portrait) {
  7. html {
  8. width: 100%;
  9. height: 100%;
  10. overflow: hidden;
  11. }
  12. body {
  13. width: 100%;
  14. height: 100%;
  15. overflow: hidden;
  16. }
  17. #splash {
  18. position: absolute;
  19. }
  20. }
  21. @media screen and (orientation: landscape) {
  22. html {
  23. width: 100%;
  24. height: 100%;
  25. }
  26. body {
  27. width: 100%;
  28. height: 100%;
  29. }
  30. #splash {
  31. position: absolute;
  32. top: 0;
  33. left: 0;
  34. width: 100%;
  35. height: 100%;
  36. }
  37. }
  38. </style>
  39. <title>与逻辑狗一起玩转思维</title>
  40. <!--http://www.html5rocks.com/en/mobile/mobifying/-->
  41. <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1" />
  42. <!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
  43. <meta name="apple-mobile-web-app-capable" content="yes">
  44. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  45. <meta name="format-detection" content="telephone=no">
  46. <!-- force webkit on 360 -->
  47. <meta name="renderer" content="webkit" />
  48. <meta name="force-rendering" content="webkit" />
  49. <!-- force edge on IE -->
  50. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
  51. <meta name="msapplication-tap-highlight" content="no">
  52. <!-- force full screen on some browser -->
  53. <meta name="full-screen" content="yes" />
  54. <meta name="x5-fullscreen" content="true" />
  55. <meta name="360-fullscreen" content="true" />
  56. <!-- force screen orientation on some browser -->
  57. <meta name="screen-orientation" content="landscape" />
  58. <meta name="x5-orientation" content="landscape">
  59. <!--fix fireball/issues/3568 -->
  60. <!--<meta name="browsermode" content="application">-->
  61. <meta name="x5-page-mode" content="app">
  62. <!--<link rel="apple-touch-icon" href=".png" />-->
  63. <!--<link rel="apple-touch-icon-precomposed" href=".png" />-->
  64. <link rel="stylesheet" type="text/css" href="style-mobile.css" />
  65. <link rel="icon" href="favicon.ico" />
  66. </head>
  67. <body>
  68. <canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="0"></canvas>
  69. <div id="splash">
  70. <div class="progress-bar stripes">
  71. <span style="width: 0%"></span>
  72. </div>
  73. </div>
  74. <script src="src/settings.js" charset="utf-8"></script>
  75. <script src="js/jquery.min.js" charset="utf-8"></script>
  76. <script>
  77. // 试试横屏
  78. let funcScreen = () => {
  79. let width = document.documentElement.clientWidth;
  80. let height = document.documentElement.clientHeight;
  81. splash = $('#splash');
  82. if (width < height) {
  83. splash.width(height);
  84. splash.height(width);
  85. splash.css('top', (height - width) / 2);
  86. splash.css('left', 0 - (height - width) / 2);
  87. splash.css('transform', 'rotate(90deg)');
  88. splash.css('transform-origin', '50% 50%');
  89. } else {
  90. splash.width(width);
  91. splash.height(height);
  92. splash.css('top', 0);
  93. splash.css('left', 0);
  94. splash.css('transform', 'none');
  95. splash.css('transform-origin', '50% 50%');
  96. }
  97. };
  98. funcScreen();
  99. var evt = "onorientationchange" in window ? "orientationchange" : "resize";
  100. window.addEventListener(evt, () => {
  101. setTimeout(() => {
  102. funcScreen();
  103. }, 100);
  104. })
  105. </script>
  106. <script src="main.js" charset="utf-8"></script>
  107. <script type="text/javascript">
  108. (function() {
  109. // open web debugger console
  110. if (typeof VConsole !== 'undefined') {
  111. window.vConsole = new VConsole();
  112. }
  113. var debug = window._CCSettings.debug;
  114. var splash = document.getElementById('splash');
  115. splash.style.display = 'block';
  116. function loadScript(moduleName, cb) {
  117. function scriptLoaded() {
  118. document.body.removeChild(domScript);
  119. domScript.removeEventListener('load', scriptLoaded, false);
  120. cb && cb();
  121. };
  122. var domScript = document.createElement('script');
  123. domScript.async = true;
  124. domScript.src = moduleName;
  125. domScript.addEventListener('load', scriptLoaded, false);
  126. document.body.appendChild(domScript);
  127. }
  128. loadScript(debug ? 'cocos2d-js.js' : 'cocos2d-js-min.js', function() {
  129. if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
  130. loadScript(debug ? 'physics.js' : 'physics-min.js', window.boot);
  131. } else {
  132. window.boot();
  133. }
  134. });
  135. })();
  136. </script>
  137. </body>
  138. </html>