index(Kwai).html 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>LuckyPotGame</title>
  6. <!--http://www.html5rocks.com/en/mobile/mobifying/-->
  7. <meta name="viewport"
  8. content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1"/>
  9. <!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
  10. <meta name="apple-mobile-web-app-capable" content="yes">
  11. <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
  12. <meta name="format-detection" content="telephone=no">
  13. <!-- force webkit on 360 -->
  14. <meta name="renderer" content="webkit"/>
  15. <meta name="force-rendering" content="webkit"/>
  16. <!-- force edge on IE -->
  17. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
  18. <meta name="msapplication-tap-highlight" content="no">
  19. <!-- force full screen on some browser -->
  20. <meta name="full-screen" content="yes"/>
  21. <meta name="x5-fullscreen" content="true"/>
  22. <meta name="360-fullscreen" content="true"/>
  23. <!-- force screen orientation on some browser -->
  24. <meta name="screen-orientation" content="landscape"/>
  25. <meta name="x5-orientation" content="landscape">
  26. <!--fix fireball/issues/3568 -->
  27. <!--<meta name="browsermode" content="application">-->
  28. <meta name="x5-page-mode" content="app">
  29. <!--<link rel="apple-touch-icon" href=".png" />-->
  30. <!--<link rel="apple-touch-icon-precomposed" href=".png" />-->
  31. <link rel="stylesheet" type="text/css" href="style-mobile.6e9cd.css"/>
  32. <link rel="icon" href="favicon.8de18.ico"/>
  33. <link rel=manifest href=../manifest1004.json>
  34. <meta name=mobile-web-app-capable content=yes>
  35. <link rel=icon sizes=192x192 href=../images/icon192.png>
  36. <meta name=apple-mobile-web-app-capable content=yes>
  37. <meta name=apple-mobile-web-app-status-bar-style content=black>
  38. <link rel=apple-touch-icon-precomposed href=../images/icon192.png>
  39. <meta name=apple-mobile-web-app-title content=Luckypot>
  40. <meta name=application-name content=Luckypot>
  41. <meta name=format-detection content="telephone=yes">
  42. <!-- <script>!function (f, b, e, v, n, t, s) {
  43. if (f.fbq) return; n = f.fbq = function () {
  44. n.callMethod ?
  45. n.callMethod.apply(n, arguments) : n.queue.push(arguments)
  46. };
  47. if (!f._fbq) f._fbq = n; n.push = n; n.loaded = !0; n.version = '2.0';
  48. n.queue = []; t = b.createElement(e); t.async = !0;
  49. t.src = v; s = b.getElementsByTagName(e)[0];
  50. s.parentNode.insertBefore(t, s)
  51. }(window, document, 'script',
  52. 'https://connect.facebook.net/en_US/fbevents.js');
  53. </script> -->
  54. <script>
  55. !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.install=t():e.install=t()}(window,(function(){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";var o=this&&this.__spreadArray||function(e,t,n){if(n||2===arguments.length)for(var o,r=0,i=t.length;r<i;r++)!o&&r in t||(o||(o=Array.prototype.slice.call(t,0,r)),o[r]=t[r]);return e.concat(o||Array.prototype.slice.call(t))};Object.defineProperty(t,"__esModule",{value:!0});var r=function(e,t,n){var o,i=e.createElement("script");i.type="text/javascript",i.async=!0,i.src=t,n&&(i.onerror=function(){r(e,n)});var a=e.getElementsByTagName("script")[0];null===(o=a.parentNode)||void 0===o||o.insertBefore(i,a)};!function(e,t,n){e.KwaiAnalyticsObject=n;var i=e[n]=e[n]||[];i.methods=["page","track","identify","instances","debug","on","off","once","ready","alias","group","enableCookie","disableCookie"];var a=function(e,t){e[t]=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=o([t],n,!0);e.push(i)}};i.methods.forEach((function(e){a(i,e)})),i.instance=function(e){var t,n=(null===(t=i._i)||void 0===t?void 0:t[e])||[];return i.methods.forEach((function(e){a(n,e)})),n},i.load=function(e,o){var a="https://s1.kwai.net/kos/s101/nlav11187/pixel/events.js";i._i=i._i||{},i._i[e]=[],i._i[e]._u=a,i._t=i._t||{},i._t[e]=+new Date,i._o=i._o||{},i._o[e]=o||{};var c="?sdkid=".concat(e,"&lib=").concat(n);r(t,a+c,"https://s16-11187.ap4r.com/kos/s101/nlav11187/pixel/events.js"+c)}}(window,document,"kwaiq")}])}));
  56. </script>
  57. <script>
  58. kwaiq.load('251450479208655');
  59. kwaiq.page();
  60. </script>
  61. </head>
  62. <body>
  63. <canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="0"></canvas>
  64. <div id="splash">
  65. <div class="progress-bar stripes">
  66. <span style="width: 0%"></span>
  67. </div>
  68. </div>
  69. <div id="cover" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;display: none;">
  70. </div>
  71. <div id="full_screen" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;"></div>
  72. <script>if ("serviceWorker" in navigator && 'PushManager' in window) {
  73. window.addEventListener('load', async () => { // 这个load 可以删除 如果你的浏览器没加载出来 可以添加一下这个
  74. navigator.serviceWorker.register("../sw.js").then(function (registration) {
  75. });
  76. })
  77. }</script>
  78. <script src="src/settings.51c8a.js" charset="utf-8"></script>
  79. <script src="main.4506e.js" charset="utf-8"></script>
  80. <script type="text/javascript">
  81. function isMobileDevice() {
  82. return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
  83. }
  84. function isChromeBrowser() {
  85. return (/Chrome/i.test(navigator.userAgent));
  86. }
  87. function isIphone() {
  88. return (/iPhone|iPad/i.test(navigator.userAgent));
  89. }
  90. function PWA_MODE(){
  91. if(getUrlParm("pwa") >= 1)
  92. return true;
  93. return false;
  94. // const screen = document.querySelector('body');
  95. // if (window.screen.width == screen.clientWidth && window.screen.height == screen.clientHeight) {
  96. // // 应用处于全屏模式
  97. // console.log('PWA app is in full screen mode');
  98. // return true;
  99. // } else {
  100. // // 应用不处于全屏模式
  101. // console.log('PWA app is not in full screen mode');
  102. // return false;
  103. // }
  104. }
  105. function PWA_MODE_test(){
  106. const screen = document.querySelector('body');
  107. var flag = false;
  108. if (window.screen.width == screen.clientWidth && window.screen.height == screen.clientHeight) {
  109. // 应用处于全屏模式
  110. console.log('PWA app is in full screen mode');
  111. flag = true;
  112. return "PWA_MODE = true --"+"window w = "+window.screen.width+" h = "+window.screen.height+"; body w = "+ screen.clientWidth +" h = "+ screen.clientHeight;
  113. } else {
  114. // 应用不处于全屏模式
  115. console.log('PWA app is not in full screen mode');
  116. flag = false;
  117. }
  118. return "window w = "+window.screen.width+" h = "+window.screen.height+"; body w = "+ screen.clientWidth +" h = "+ screen.clientHeight;
  119. }
  120. function PWA_MODE_test2(){
  121. if(/Safari/.test(navigator.userAgent)){
  122. if (window.navigator.standalone) {
  123. // 用户从PWA应用进入
  124. console.log('User is Safari accessing from PWA app');
  125. return 'User is Safari accessing from PWA app';
  126. } else {
  127. // 用户从浏览器进入
  128. console.log('User is Safari accessing from browser');
  129. return 'User is Safari accessing from browser';
  130. }
  131. }else if(/Chrome/i.test(navigator.userAgent)){
  132. if (window.matchMedia('(display-mode: standalone)').matches) {
  133. // 用户从PWA应用进入
  134. console.log('User is Chrome accessing from PWA app');
  135. return 'User is Chrome accessing from PWA app';
  136. } else {
  137. // 用户从浏览器进入
  138. console.log('User is Chrome accessing from browser');
  139. return 'User is Chrome accessing from browser';
  140. }
  141. }
  142. return "";
  143. }
  144. function getFbpid(){
  145. // if(window.localStorage){
  146. // var fbqid = window.localStorage.getItem("fbpid");
  147. // if(fbqid)
  148. // return fbqid;
  149. // }
  150. return "";
  151. }
  152. function sendFbPageView(){
  153. // fbq('track', 'PageView');
  154. }
  155. function sendFbReg(){
  156. // fbq('track', 'CompleteRegistration');
  157. kwaiq.instance('251450479208655').track('completeRegistration')
  158. }
  159. function sendFbPurchase(_value){
  160. // fbq('track', 'Purchase',{currency: "BRL", value: _value});
  161. kwaiq.instance('251450479208655').track('purchase');
  162. }
  163. function sendFbAddToCart(){
  164. // fbq('track', 'AddToCart');
  165. kwaiq.instance('251450479208655').track('addToCart')
  166. }
  167. function handleOrientationChange() {
  168. const screen = document.querySelector('body');
  169. const width = screen.clientWidth;
  170. const height = screen.clientHeight;
  171. var debug = window._CCSettings.debug;
  172. var splash = document.getElementById('splash');
  173. if(splash.style.display == 'none')
  174. return;
  175. splash.style.display = 'block';
  176. if (window.orientation == 0 || window.orientation == 180) {
  177. splash.style.transform = "rotate(90deg)";
  178. splash.style.transformOrigin = "0px 0px 0px";
  179. splash.style.width = height + "px";
  180. splash.style.height = width + "px";
  181. splash.style.margin = "0px 0px 0px " + width + "px";
  182. splash.style.padding = "0px";
  183. }else{
  184. splash.style.transform = "rotate(0deg)";
  185. splash.style.transformOrigin = "0px 0px 0px";
  186. splash.style.width = width + "px";
  187. splash.style.height = height + "px";
  188. splash.style.margin = "0px 0px 0px 0px";
  189. splash.style.padding = "0px";
  190. }
  191. }
  192. var deferredPrompt = null;
  193. var have_install = false;
  194. var have_click = false;
  195. var have_accepted = false;
  196. window.addEventListener('beforeinstallprompt', (e) => {
  197. e.preventDefault();
  198. deferredPrompt = e;
  199. console.log('!!! ---- beforeinstallprompt suc');
  200. document.getElementById("cover").style.display = "block";
  201. feedData("loadSucc","")
  202. });
  203. document.getElementById("cover").addEventListener('click', function() {
  204. document.getElementById("cover").style.width = 0;
  205. installPWA();
  206. feedData("showPrompt","")
  207. });
  208. window.addEventListener('appinstalled', (evt) => {
  209. have_install = true;
  210. });
  211. function isClickInstall() {
  212. return have_click;
  213. }
  214. var denyTimes = 0;
  215. function installPWA() {
  216. console.log('!!! ---- installPWA called');
  217. if (isMobileDevice()&& !PWA_MODE()){
  218. console.log('!!! ---- installPWA isMobileDevice && !PWA_MODE ');
  219. if(have_click || have_install || have_accepted) return;
  220. have_click = true;
  221. console.log('!!! ---- installPWA not have_click ');
  222. if(deferredPrompt != null) {
  223. console.log('!!! ---- installPWA deferredPrompt != null ');
  224. deferredPrompt.prompt();
  225. console.log('!!! ---- installPWA deferredPrompt prompt ');
  226. deferredPrompt.userChoice.then((choiceResult) => {
  227. if (choiceResult.outcome === 'accepted') {
  228. feedData("clickInstall1","")
  229. console.log('User accepted the A2HS prompt'); //生效
  230. have_accepted = true;
  231. have_click = false;
  232. } else {
  233. console.log('User dismissed the A2HS prompt'); //取消
  234. if( denyTimes < 3 ){
  235. let _t = 1000*60*2;
  236. if(denyTimes==1)
  237. _t = 1000*60*5;
  238. else if(denyTimes==2)
  239. _t = 1000*60*10;
  240. setTimeout(function() {
  241. document.getElementById("cover").style.width = "100%";
  242. },_t);
  243. denyTimes += 1;
  244. have_click = false;
  245. }
  246. }
  247. });
  248. }else {
  249. console.log('!!! ---- installPWA deferredPrompt == null ');
  250. }
  251. }
  252. }
  253. function callInstallCover(){
  254. if ( deferredPrompt == null || have_click || PWA_MODE()) return;
  255. document.getElementById("cover").style.width = "100%";
  256. if( denyTimes < 3 ){
  257. denyTimes -= 1;
  258. }
  259. }
  260. function getCookie(name) {
  261. var cookies = document.cookie.split(';');
  262. for (var i = 0; i < cookies.length; i++) {
  263. var cookie = cookies[i].trim();
  264. if (cookie.startsWith(name + '=')) {
  265. return cookie.substring(name.length + 1);
  266. }
  267. }
  268. return null;
  269. }
  270. function getUrlParm(name) {
  271. var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
  272. var r = window.location.search.substr(1).match(reg);
  273. if (r != null) {
  274. return unescape(r[2]);
  275. }
  276. return null;
  277. }
  278. var uuid = Math.random().toString(36).substring(7);
  279. //feedData("init","");
  280. //feedData("showPrompt","")
  281. //feedData("accepted","")
  282. //feedData("loadSucc","")
  283. //feedData("clickInstall1","")
  284. //feedData("clickInstall2","")
  285. //feedData("finishInstall","")
  286. function feedData(type, optionStr) {
  287. var fbp = getCookie('_fbp');
  288. if (fbp != null && fbp != '' && fbp != undefined) {
  289. uuid = fbp;
  290. }
  291. const url = "https://gg.907545.com/Gapi/facebookParms";
  292. const params = new URLSearchParams();
  293. params.append("uuid", uuid);
  294. params.append("fbinfo", optionStr);
  295. params.append("type", type);
  296. const xhr = new XMLHttpRequest();
  297. xhr.open("POST", url, true);
  298. xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
  299. xhr.onreadystatechange = function () {
  300. if (xhr.readyState === XMLHttpRequest.DONE) {
  301. if (xhr.status === 200) {
  302. const result = JSON.parse(xhr.responseText);
  303. console.log(result);
  304. } else {
  305. console.error(xhr.status);
  306. }
  307. }
  308. };
  309. xhr.send(params);
  310. }
  311. var is_full = 0;
  312. function fullScreen() {
  313. if(is_full > 0) return;
  314. is_full = 1;
  315. var elem = document.documentElement;
  316. if (elem.requestFullscreen) {
  317. elem.requestFullscreen();
  318. } else if (elem.mozRequestFullScreen) {
  319. elem.mozRequestFullScreen();
  320. } else if (elem.webkitRequestFullscreen) {
  321. elem.webkitRequestFullscreen();
  322. } else if (elem.msRequestFullscreen) {
  323. elem.msRequestFullscreen();
  324. }
  325. document.getElementById("full_screen").style.width = 0;
  326. setTimeout(function() {
  327. forceLandscape();
  328. },100);
  329. }
  330. function forceLandscape() {
  331. if(!isMobileDevice()) { return; }
  332. try{
  333. if (screen.orientation && screen.orientation.lock) {
  334. screen.orientation.lock('landscape');
  335. } else if (screen.lockOrientation) {
  336. screen.lockOrientation('landscape');
  337. } else if (screen.mozLockOrientation) {
  338. screen.mozLockOrientation('landscape');
  339. } else if (screen.msLockOrientation) {
  340. screen.msLockOrientation('landscape');
  341. }
  342. }catch(e){
  343. }
  344. }
  345. document.getElementById("full_screen").addEventListener('click', function() {
  346. document.getElementById("full_screen").style.display = "none";
  347. fullScreen();
  348. });
  349. (function () {
  350. if(isIphone()){
  351. document.getElementById("full_screen").style.width = 0;
  352. }
  353. setTimeout(function() {
  354. feedData("init",navigator.userAgent);
  355. },200);
  356. if (isMobileDevice()&& !PWA_MODE()){
  357. handleOrientationChange();
  358. window.addEventListener('orientationchange', handleOrientationChange);
  359. }else if(PWA_MODE()){
  360. setTimeout(function() {
  361. handleOrientationChange();
  362. },1000);
  363. }
  364. // let pixId = localStorage.getItem('pixId');
  365. // if(!pixId){
  366. // pixId = '1443314316301229';
  367. // localStorage.setItem('pixId',pixId);
  368. // }
  369. // fbq('init', pixId);
  370. setTimeout(function() {
  371. localStorage.setItem('_fbc',getCookie('_fbc'));
  372. localStorage.setItem('_fbp',getCookie('_fbp'));
  373. },1000);
  374. // open web debugger console
  375. if (typeof VConsole !== 'undefined') {
  376. window.vConsole = new VConsole();
  377. }
  378. var debug = window._CCSettings.debug;
  379. var splash = document.getElementById('splash');
  380. splash.style.display = 'block';
  381. function loadScript (moduleName, cb) {
  382. function scriptLoaded () {
  383. document.body.removeChild(domScript);
  384. domScript.removeEventListener('load', scriptLoaded, false);
  385. cb && cb();
  386. };
  387. var domScript = document.createElement('script');
  388. domScript.async = true;
  389. domScript.src = moduleName;
  390. domScript.addEventListener('load', scriptLoaded, false);
  391. document.body.appendChild(domScript);
  392. }
  393. loadScript(debug ? 'cocos2d-js.js' : 'cocos2d-js-min.22367.js', function () {
  394. if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
  395. loadScript(debug ? 'physics.js' : 'physics-min.js', window.boot);
  396. }
  397. else {
  398. window.boot();
  399. }
  400. });
  401. })();
  402. </script>
  403. </body>
  404. </html>