123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434 |
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>LuckyPotGame</title>
- <!--http://www.html5rocks.com/en/mobile/mobifying/-->
- <meta name="viewport"
- content="width=device-width,user-scalable=no,initial-scale=1, minimum-scale=1,maximum-scale=1"/>
- <!--https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html-->
- <meta name="apple-mobile-web-app-capable" content="yes">
- <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
- <meta name="format-detection" content="telephone=no">
- <!-- force webkit on 360 -->
- <meta name="renderer" content="webkit"/>
- <meta name="force-rendering" content="webkit"/>
- <!-- force edge on IE -->
- <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
- <meta name="msapplication-tap-highlight" content="no">
- <!-- force full screen on some browser -->
- <meta name="full-screen" content="yes"/>
- <meta name="x5-fullscreen" content="true"/>
- <meta name="360-fullscreen" content="true"/>
-
- <!-- force screen orientation on some browser -->
- <meta name="screen-orientation" content="landscape"/>
- <meta name="x5-orientation" content="landscape">
- <!--fix fireball/issues/3568 -->
- <!--<meta name="browsermode" content="application">-->
- <meta name="x5-page-mode" content="app">
- <!--<link rel="apple-touch-icon" href=".png" />-->
- <!--<link rel="apple-touch-icon-precomposed" href=".png" />-->
- <link rel="stylesheet" type="text/css" href="style-mobile.6e9cd.css"/>
- <link rel="icon" href="favicon.8de18.ico"/>
- <link rel=manifest href=../manifest1004.json>
- <meta name=mobile-web-app-capable content=yes>
- <link rel=icon sizes=192x192 href=../images/icon192.png>
- <meta name=apple-mobile-web-app-capable content=yes>
- <meta name=apple-mobile-web-app-status-bar-style content=black>
- <link rel=apple-touch-icon-precomposed href=../images/icon192.png>
- <meta name=apple-mobile-web-app-title content=Luckypot>
- <meta name=application-name content=Luckypot>
- <meta name=format-detection content="telephone=yes">
- <script>!function (f, b, e, v, n, t, s) {
- if (f.fbq) return; n = f.fbq = function () {
- n.callMethod ?
- n.callMethod.apply(n, arguments) : n.queue.push(arguments)
- };
- if (!f._fbq) f._fbq = n; n.push = n; n.loaded = !0; n.version = '2.0';
- n.queue = []; t = b.createElement(e); t.async = !0;
- t.src = v; s = b.getElementsByTagName(e)[0];
- s.parentNode.insertBefore(t, s)
- }(window, document, 'script',
- 'https://connect.facebook.net/en_US/fbevents.js');
- </script>
- </head>
- <body>
- <canvas id="GameCanvas" oncontextmenu="event.preventDefault()" tabindex="0"></canvas>
- <div id="splash">
- <div class="progress-bar stripes">
- <span style="width: 0%"></span>
- </div>
- </div>
- <div id="cover" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;display: none;">
- </div>
- <div id="full_screen" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;"></div>
- <script>if ("serviceWorker" in navigator && 'PushManager' in window) {
- window.addEventListener('load', async () => { // 这个load 可以删除 如果你的浏览器没加载出来 可以添加一下这个
- navigator.serviceWorker.register("../sw.js").then(function (registration) {
- });
- })
- }</script>
- <script src="src/settings.51c8a.js" charset="utf-8"></script>
- <script src="main.4506e.js" charset="utf-8"></script>
- <script type="text/javascript">
- function isMobileDevice() {
- return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
- }
- function isChromeBrowser() {
- return (/Chrome/i.test(navigator.userAgent));
- }
- function isIphone() {
- return (/iPhone|iPad/i.test(navigator.userAgent));
- }
- function PWA_MODE(){
- if(getUrlParm("pwa") >= 1)
- return true;
- return false;
- // const screen = document.querySelector('body');
- // if (window.screen.width == screen.clientWidth && window.screen.height == screen.clientHeight) {
- // // 应用处于全屏模式
- // console.log('PWA app is in full screen mode');
- // return true;
- // } else {
- // // 应用不处于全屏模式
- // console.log('PWA app is not in full screen mode');
- // return false;
- // }
- }
- function PWA_MODE_test(){
- const screen = document.querySelector('body');
- var flag = false;
- if (window.screen.width == screen.clientWidth && window.screen.height == screen.clientHeight) {
- // 应用处于全屏模式
- console.log('PWA app is in full screen mode');
- flag = true;
- return "PWA_MODE = true --"+"window w = "+window.screen.width+" h = "+window.screen.height+"; body w = "+ screen.clientWidth +" h = "+ screen.clientHeight;
- } else {
- // 应用不处于全屏模式
- console.log('PWA app is not in full screen mode');
- flag = false;
- }
- return "window w = "+window.screen.width+" h = "+window.screen.height+"; body w = "+ screen.clientWidth +" h = "+ screen.clientHeight;
- }
- function PWA_MODE_test2(){
- if(/Safari/.test(navigator.userAgent)){
- if (window.navigator.standalone) {
- // 用户从PWA应用进入
- console.log('User is Safari accessing from PWA app');
- return 'User is Safari accessing from PWA app';
- } else {
- // 用户从浏览器进入
- console.log('User is Safari accessing from browser');
- return 'User is Safari accessing from browser';
- }
- }else if(/Chrome/i.test(navigator.userAgent)){
- if (window.matchMedia('(display-mode: standalone)').matches) {
- // 用户从PWA应用进入
- console.log('User is Chrome accessing from PWA app');
- return 'User is Chrome accessing from PWA app';
- } else {
- // 用户从浏览器进入
- console.log('User is Chrome accessing from browser');
- return 'User is Chrome accessing from browser';
- }
- }
- return "";
- }
- function getFbpid(){
- if(window.localStorage){
- var fbqid = window.localStorage.getItem("fbpid");
- if(fbqid)
- return fbqid;
- }
- return "";
- }
- function sendFbPageView(){
- fbq('track', 'PageView');
- }
- function sendFbReg(){
- fbq('track', 'CompleteRegistration');
- }
- function sendFbPurchase(_value){
- // fbq('track', 'Purchase',{currency: "BRL", value: _value});
- }
- function sendFbAddToCart(){
- fbq('track', 'AddToCart');
- }
- function handleOrientationChange() {
- const screen = document.querySelector('body');
- const width = screen.clientWidth;
- const height = screen.clientHeight;
- var debug = window._CCSettings.debug;
- var splash = document.getElementById('splash');
- if(splash.style.display == 'none')
- return;
- splash.style.display = 'block';
- if (window.orientation == 0 || window.orientation == 180) {
- splash.style.transform = "rotate(90deg)";
- splash.style.transformOrigin = "0px 0px 0px";
- splash.style.width = height + "px";
- splash.style.height = width + "px";
- splash.style.margin = "0px 0px 0px " + width + "px";
- splash.style.padding = "0px";
- }else{
- splash.style.transform = "rotate(0deg)";
- splash.style.transformOrigin = "0px 0px 0px";
- splash.style.width = width + "px";
- splash.style.height = height + "px";
- splash.style.margin = "0px 0px 0px 0px";
- splash.style.padding = "0px";
- }
- }
- var deferredPrompt = null;
- var have_install = false;
- var have_click = false;
- var have_accepted = false;
- window.addEventListener('beforeinstallprompt', (e) => {
- e.preventDefault();
- deferredPrompt = e;
- console.log('!!! ---- beforeinstallprompt suc');
- document.getElementById("cover").style.display = "block";
- feedData("loadSucc","")
- });
- document.getElementById("cover").addEventListener('click', function() {
- document.getElementById("cover").style.width = 0;
- installPWA();
- feedData("showPrompt","")
- });
- window.addEventListener('appinstalled', (evt) => {
- have_install = true;
- });
- function isClickInstall() {
- return have_click;
- }
- var denyTimes = 0;
- function installPWA() {
- console.log('!!! ---- installPWA called');
- if (isMobileDevice()&& !PWA_MODE()){
- console.log('!!! ---- installPWA isMobileDevice && !PWA_MODE ');
- if(have_click || have_install || have_accepted) return;
- have_click = true;
- console.log('!!! ---- installPWA not have_click ');
- if(deferredPrompt != null) {
- console.log('!!! ---- installPWA deferredPrompt != null ');
- deferredPrompt.prompt();
- console.log('!!! ---- installPWA deferredPrompt prompt ');
- deferredPrompt.userChoice.then((choiceResult) => {
- if (choiceResult.outcome === 'accepted') {
- feedData("clickInstall1","")
- console.log('User accepted the A2HS prompt'); //生效
- have_accepted = true;
- have_click = false;
- } else {
- console.log('User dismissed the A2HS prompt'); //取消
- if( denyTimes < 3 ){
- let _t = 1000*60*2;
- if(denyTimes==1)
- _t = 1000*60*5;
- else if(denyTimes==2)
- _t = 1000*60*10;
- setTimeout(function() {
- document.getElementById("cover").style.width = "100%";
- },_t);
- denyTimes += 1;
- have_click = false;
- }
- }
- });
- }else {
- console.log('!!! ---- installPWA deferredPrompt == null ');
- }
- }
- }
- function callInstallCover(){
- if ( deferredPrompt == null || have_click || PWA_MODE()) return;
- document.getElementById("cover").style.width = "100%";
- if( denyTimes < 3 ){
- denyTimes -= 1;
- }
- }
- function getCookie(name) {
- var cookies = document.cookie.split(';');
- for (var i = 0; i < cookies.length; i++) {
- var cookie = cookies[i].trim();
- if (cookie.startsWith(name + '=')) {
- return cookie.substring(name.length + 1);
- }
- }
- return null;
- }
- function getUrlParm(name) {
- var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
- var r = window.location.search.substr(1).match(reg);
- if (r != null) {
- return unescape(r[2]);
- }
- return null;
- }
- var uuid = Math.random().toString(36).substring(7);
- //feedData("init","");
- //feedData("showPrompt","")
- //feedData("accepted","")
- //feedData("loadSucc","")
- //feedData("clickInstall1","")
- //feedData("clickInstall2","")
- //feedData("finishInstall","")
- function feedData(type, optionStr) {
- var fbp = getCookie('_fbp');
- if (fbp != null && fbp != '' && fbp != undefined) {
- uuid = fbp;
- }
- const url = "https://gg.907545.com/Gapi/facebookParms";
- const params = new URLSearchParams();
- params.append("uuid", uuid);
- params.append("fbinfo", optionStr);
- params.append("type", type);
- const xhr = new XMLHttpRequest();
- xhr.open("POST", url, true);
- xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
- xhr.onreadystatechange = function () {
- if (xhr.readyState === XMLHttpRequest.DONE) {
- if (xhr.status === 200) {
- const result = JSON.parse(xhr.responseText);
- console.log(result);
- } else {
- console.error(xhr.status);
- }
- }
- };
- xhr.send(params);
- }
- var is_full = 0;
- function fullScreen() {
- if(is_full > 0) return;
- is_full = 1;
- var elem = document.documentElement;
- if (elem.requestFullscreen) {
- elem.requestFullscreen();
- } else if (elem.mozRequestFullScreen) {
- elem.mozRequestFullScreen();
- } else if (elem.webkitRequestFullscreen) {
- elem.webkitRequestFullscreen();
- } else if (elem.msRequestFullscreen) {
- elem.msRequestFullscreen();
- }
- document.getElementById("full_screen").style.width = 0;
- setTimeout(function() {
- forceLandscape();
- },100);
- }
- function forceLandscape() {
- if(!isMobileDevice()) { return; }
- try{
- if (screen.orientation && screen.orientation.lock) {
- screen.orientation.lock('landscape');
- } else if (screen.lockOrientation) {
- screen.lockOrientation('landscape');
- } else if (screen.mozLockOrientation) {
- screen.mozLockOrientation('landscape');
- } else if (screen.msLockOrientation) {
- screen.msLockOrientation('landscape');
- }
- }catch(e){
- }
- }
- document.getElementById("full_screen").addEventListener('click', function() {
- document.getElementById("full_screen").style.display = "none";
- fullScreen();
- });
- (function () {
- if(isIphone()){
- document.getElementById("full_screen").style.width = 0;
- }
-
- setTimeout(function() {
- feedData("init",navigator.userAgent);
- },200);
- if (isMobileDevice()&& !PWA_MODE()){
- handleOrientationChange();
- window.addEventListener('orientationchange', handleOrientationChange);
- }else if(PWA_MODE()){
- setTimeout(function() {
- handleOrientationChange();
- },1000);
- }
- let pixId = localStorage.getItem('pixId');
- if(!pixId){
- pixId = '1001043758216463';
- localStorage.setItem('pixId',pixId);
- }
- fbq('init', pixId);
- setTimeout(function() {
- localStorage.setItem('_fbc',getCookie('_fbc'));
- localStorage.setItem('_fbp',getCookie('_fbp'));
- },1000);
- // open web debugger console
- if (typeof VConsole !== 'undefined') {
- window.vConsole = new VConsole();
- }
- var debug = window._CCSettings.debug;
- var splash = document.getElementById('splash');
- splash.style.display = 'block';
- function loadScript (moduleName, cb) {
- function scriptLoaded () {
- document.body.removeChild(domScript);
- domScript.removeEventListener('load', scriptLoaded, false);
- cb && cb();
- };
- var domScript = document.createElement('script');
- domScript.async = true;
- domScript.src = moduleName;
- domScript.addEventListener('load', scriptLoaded, false);
- document.body.appendChild(domScript);
- }
- loadScript(debug ? 'cocos2d-js.js' : 'cocos2d-js-min.22367.js', function () {
- if (CC_PHYSICS_BUILTIN || CC_PHYSICS_CANNON) {
- loadScript(debug ? 'physics.js' : 'physics-min.js', window.boot);
- }
- else {
- window.boot();
- }
- });
- })();
- </script>
- </body>
- </html>
|