-
-
Save x3388638/ed503f4f2d116bce0e509fe9c20cbabc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var Main = Main || function (u, a) { | |
| function r() { | |
| a(".load", c).removeClass("load"); | |
| a("#hidden-pic", c).remove(); | |
| c.removeClass("hidden"); | |
| TweenLite.to(e, .5, { | |
| css: { | |
| autoAlpha: 0 | |
| }, | |
| delay: .3, | |
| onComplete: function () { | |
| e.addClass("hidden"); | |
| a("body").removeClass("ready"); | |
| f.animateSprite("stop"); | |
| k.text("Loading ..."); | |
| h.css("zIndex", 9999) | |
| } | |
| }); | |
| n.bind("click", function (d) { | |
| console.log(1) | |
| d.preventDefault(); | |
| d = a(this); | |
| d.hasClass("active") ? (d.removeClass("active"), | |
| p.fadeOut(600)) : (d.addClass("active"), | |
| p.fadeIn(600)) | |
| }); | |
| Main.log("----- Main.init -----"); | |
| if ("function" === typeof b.onComplete) | |
| b.onComplete() | |
| } | |
| var b = {}, t = { | |
| debug: 0, | |
| app: "./app", | |
| siteUrl: "https://www.gotoandplay.com.tw/bid-yahoo/", | |
| bidPage: "https://tw.bid.yahoo.com/campaign_landing" | |
| }, e, f, k, c, h, l, g, n, p, m = 0; | |
| return { | |
| init: function (d) { | |
| b = a.extend(t, d || {}); | |
| e = a("#preload"); | |
| f = a(".sprite", e); | |
| k = a(".process", e); | |
| c = a("#wrap"); | |
| h = a("#header", c); | |
| n = a(".hamburger", h); | |
| p = a(".menu", h); | |
| l = a("#main", c); | |
| g = a("#main > .overlay", c); | |
| m = a(".load", c).length + a("img", c).length; | |
| Main.log("load size: " + m); | |
| var q = 0; | |
| f.animateSprite({ | |
| fps: 24, | |
| autoplay: !0, | |
| loop: !0 | |
| }); | |
| c.imagesLoaded({ | |
| background: ".load" | |
| }, function () { }).progress(function (a, d) { | |
| q++; | |
| var b = Math.floor(q / m * 100); | |
| Main.log(b + "% -> " + d.img.src); | |
| k.text(b + "%"); | |
| 100 == b && r() | |
| }) | |
| }, | |
| savePV: function (d, q) { | |
| a.ajax({ | |
| url: b.app + "/pv.ashx", | |
| type: "post", | |
| dataType: "json", | |
| data: { | |
| p: d | |
| }, | |
| error: function (a) { | |
| console.log("\u4f3a\u670d\u5668\u5fd9\u788c\u4e2d\uff0c\u8acb\u7a0d\u5f8c\u518d\u8a66\uff01 (error: 1)") | |
| }, | |
| success: function (a) { | |
| var d = parseInt(a.success, 10); | |
| 555 === d ? u.location.href = b.bidPage : -500 === d && console.log("\u4f3a\u670d\u5668\u5fd9\u788c\u4e2d\uff0c\u8acb\u7a0d\u5f8c\u518d\u8a66\uff01 (error: 1)"); | |
| "function" == typeof q && q(a.k); | |
| Main.log("pv-status: " + d) | |
| } | |
| }) | |
| }, | |
| checkFull: function (d) { | |
| if ("function" === typeof d) { | |
| var q = !1; | |
| a.ajax({ | |
| url: 'https://gistcdn.githack.com/x3388638/4e6ee33b58f85fe1f737d0e87e944a65/raw/cdedb2856af12c88ec5c6ef184cd4e2a02507fbb/success.json', | |
| type: "get", | |
| dataType: "json", | |
| error: function (a) { | |
| console.log("\u4f3a\u670d\u5668\u5fd9\u788c\u4e2d\uff0c\u8acb\u7a0d\u5f8c\u518d\u8a66\uff01 (error: 2)") | |
| }, | |
| success: function (a) { | |
| var c = parseInt(a.success, 10); | |
| 555 === c ? u.location.href = b.bidPage : 500 === c ? console.log("\u4f3a\u670d\u5668\u5fd9\u788c\u4e2d\uff0c\u8acb\u7a0d\u5f8c\u518d\u8a66\uff01 (error: 2)") : (0 === c && (Main.log("game_check-status: " + c), | |
| q = !0, | |
| TweenLite.set(g, { | |
| css: { | |
| display: "block", | |
| autoAlpha: 0 | |
| } | |
| }), | |
| g.children(".full").removeClass("hidden"), | |
| TweenLite.to(g, .7, { | |
| css: { | |
| autoAlpha: 1 | |
| }, | |
| onComplete: function () { | |
| g.find(".back").bind("click", function (a) { | |
| console.log(2) | |
| a.preventDefault(); | |
| TweenLite.to(g, .7, { | |
| css: { | |
| autoAlpha: 0 | |
| }, | |
| onComplete: function () { | |
| TweenLite.set(g, { | |
| css: { | |
| display: "none", | |
| autoAlpha: 0 | |
| } | |
| }); | |
| g.children(".full").addClass("hidden") | |
| } | |
| }) | |
| }); | |
| var d = g.find(".tips"); | |
| FB.getLoginStatus(function (b) { | |
| "connected" == b.status ? d.attr("href", "https://www.facebook.com/dialog/share?app_id=922145544801485&display=touch&href=https://tw.campaign.bid.yahoo.com/activity?p=auc-1-0-190627-summerlove&hashtag=%23\u6200\u590f\u71b1\u543b\u51a0\u8ecd\u8cfd&redirect_uri=https://www.gotoandplay.com.tw/bid-yahoo/ShareDone.aspx?c=" + a.custom) : d.attr("href", "https://www.facebook.com/v3.3/dialog/oauth?client_id=922145544801485&redirect_uri=https://www.gotoandplay.com.tw/bid-yahoo/OAuth.aspx&state=" + a.custom) | |
| }) | |
| } | |
| })), | |
| d(q)) | |
| } | |
| }) | |
| } | |
| }, | |
| warning: function () { | |
| TweenLite.set(g, { | |
| css: { | |
| display: "block", | |
| autoAlpha: 0 | |
| } | |
| }); | |
| g.children(".warning").removeClass("hidden"); | |
| TweenLite.to(g, .7, { | |
| css: { | |
| autoAlpha: 1 | |
| }, | |
| onComplete: function () { | |
| g.find(".close").bind("click", function (a) { | |
| console.log(3) | |
| a.preventDefault(); | |
| TweenLite.to(g, .7, { | |
| css: { | |
| autoAlpha: 0 | |
| }, | |
| onComplete: function () { | |
| TweenLite.set(g, { | |
| css: { | |
| display: "none", | |
| autoAlpha: 0 | |
| } | |
| }); | |
| g.children(".warning").addClass("hidden") | |
| } | |
| }) | |
| }) | |
| } | |
| }) | |
| }, | |
| setCurrentPage: function (a) { }, | |
| chagnePage: function (a, b) { | |
| if ("function" === typeof a) { | |
| var d = new TimelineLite({ | |
| onComplete: function () { | |
| e.addClass("hidden"); | |
| f.animateSprite("stop"); | |
| "function" === typeof b && b() | |
| } | |
| }); | |
| d.set(e, { | |
| css: { | |
| autoAlpha: 0 | |
| } | |
| }); | |
| d.add(function () { | |
| e.removeClass("hidden"); | |
| f.animateSprite("play") | |
| }); | |
| d.add(TweenMax.to(e, .7, { | |
| css: { | |
| autoAlpha: 1 | |
| }, | |
| ease: Power0.easeNone | |
| })); | |
| d.add(a); | |
| d.add(TweenMax.to(e, .7, { | |
| css: { | |
| autoAlpha: 0 | |
| }, | |
| delay: 1, | |
| ease: Power0.easeNone | |
| })) | |
| } | |
| }, | |
| showLoading: function (a) { | |
| var d = new TimelineLite({ | |
| onComplete: function () { | |
| "function" === typeof a && a() | |
| } | |
| }); | |
| d.set(e, { | |
| css: { | |
| autoAlpha: 0 | |
| } | |
| }); | |
| d.add(function () { | |
| e.removeClass("hidden"); | |
| f.animateSprite("play") | |
| }); | |
| d.add(TweenMax.to(e, .7, { | |
| css: { | |
| autoAlpha: 1 | |
| }, | |
| ease: Power0.easeNone | |
| })) | |
| }, | |
| hideLoading: function (a) { | |
| (new TimelineLite({ | |
| onComplete: function () { | |
| e.addClass("hidden"); | |
| f.animateSprite("stop"); | |
| "function" === typeof a && a() | |
| } | |
| })).add(TweenMax.to(e, .7, { | |
| css: { | |
| autoAlpha: 0 | |
| }, | |
| delay: .5, | |
| ease: Power0.easeNone | |
| })) | |
| }, | |
| commonSettings: function () { | |
| return { | |
| app: b.app, | |
| siteUrl: b.siteUrl, | |
| bidPage: b.bidPage, | |
| debug: b.debug, | |
| wrap: c, | |
| header: h, | |
| main: l, | |
| preload: e | |
| } | |
| }, | |
| sendEvent: function (a, b, c) { | |
| try { | |
| gtag("event", b, { | |
| event_category: a, | |
| event_label: c | |
| }) | |
| } catch (v) { | |
| Main.log("event: " + a + ", " + b + ", " + c) | |
| } | |
| }, | |
| log: function (a) { | |
| b.debug && console.log(a) | |
| }, | |
| dir: function (a) { | |
| b.debug && console.dir(a) | |
| } | |
| } | |
| }(window, jQuery) | |
| , HomePage = HomePage || function (u, a) { | |
| function r() { | |
| k.animateSprite("restart"); | |
| c.animateSprite("restart"); | |
| h.bind("click", function (a) { | |
| console.log(4) | |
| a.preventDefault(); | |
| Main.checkFull(function (a) { | |
| a || (h.unbind("click"), | |
| Main.chagnePage(function () { | |
| f.addClass("hidden"); | |
| GamePage.init() | |
| }, function () { | |
| HomePage.destroy() | |
| })) | |
| }) | |
| }) | |
| } | |
| var b = {}, t = {}, e, f, k, c, h, l = 0; | |
| return { | |
| init: function (g) { | |
| b = a.extend(t, g || {}); | |
| b = a.extend(b, Main.commonSettings()); | |
| e = b.main; | |
| f = a(".home", e); | |
| k = a(".heart", f); | |
| c = a(".shine", f); | |
| h = a(".start", f); | |
| f.removeClass("hidden"); | |
| k.animateSprite({ | |
| fps: 24, | |
| autoplay: !1, | |
| loop: !0 | |
| }); | |
| c.animateSprite({ | |
| fps: 16, | |
| autoplay: !1, | |
| loop: !0 | |
| }); | |
| r(); | |
| setTimeout(function () { | |
| l || (l = 1, | |
| Main.savePV(0)) | |
| }, 500); | |
| Main.setCurrentPage("home"); | |
| Main.log("----- HomePage.init -----") | |
| }, | |
| destroy: function () { | |
| k.animateSprite("stop"); | |
| c.animateSprite("stop"); | |
| h = c = k = f = e = null | |
| } | |
| } | |
| }(window, jQuery) | |
| , GamePage = GamePage || function (u, a) { | |
| function r() { | |
| g.bind("click", function (a) { | |
| console.log(5) | |
| a.preventDefault(); | |
| g.unbind("click"); | |
| setTimeout(function () { | |
| Main.savePV(1, function (a) { | |
| p = a | |
| }) | |
| }, 500); | |
| TweenLite.to(l, .7, { | |
| css: { | |
| autoAlpha: 0 | |
| }, | |
| onComplete: function () { | |
| TweenLite.set(l, { | |
| css: { | |
| autoAlpha: 1 | |
| } | |
| }); | |
| l.addClass("hidden") | |
| } | |
| }); | |
| Game.init({ | |
| main: k, | |
| game: c | |
| }); | |
| n.attr("class", "countdown c" + m); | |
| n.removeClass("hidden"); | |
| b() | |
| }) | |
| } | |
| function b() { | |
| TweenLite.delayedCall(1, function () { | |
| --m; | |
| 0 == m ? TweenLite.to(h, .7, { | |
| css: { | |
| autoAlpha: 0 | |
| }, | |
| onComplete: function () { | |
| TweenLite.set(h, { | |
| css: { | |
| autoAlpha: 1 | |
| } | |
| }); | |
| m = 3; | |
| n.attr("class", "countdown c" + m); | |
| h.addClass("hidden"); | |
| Game.start() | |
| } | |
| }) : (n.attr("class", "countdown c" + m), | |
| b()) | |
| }) | |
| } | |
| function t(b) { | |
| console.log(b) | |
| console.log(typeof b) | |
| console.log(JSON.stringify(b)) | |
| a.ajax({ | |
| url: e.app + "/lottery.ashx", | |
| type: "post", | |
| dataType: "json", | |
| data: { | |
| k: p, | |
| s: 255 | |
| }, | |
| error: function (a) { | |
| console.log("\u4f3a\u670d\u5668\u5fd9\u788c\u4e2d\uff0c\u8acb\u7a0d\u5f8c\u518d\u8a66\uff01 (error: 1)") | |
| }, | |
| success: function (b) { | |
| var d = parseInt(b.success, 10); | |
| if (555 === d) | |
| u.location.href = e.bidPage; | |
| else if (500 === d || 0 === d) | |
| console.log("\u4f3a\u670d\u5668\u5fd9\u788c\u4e2d\uff0c\u8acb\u7a0d\u5f8c\u518d\u8a66\uff01 (error: 4)"); | |
| else if (978 === d) | |
| HomePage.init(), | |
| Main.hideLoading(), | |
| Main.warning(); | |
| else { | |
| b = b.result; | |
| var c = {}; | |
| 0 == b.award && (c.code = b.code, | |
| c.link = b.link); | |
| c.award = b.award; | |
| c.ckey = b.ckey; | |
| c.score = b.score; | |
| c.gkey = b.gkey; | |
| c.custom = b.custom; | |
| ResultPage.init(c); | |
| a("html, body").scrollTop(0); | |
| setTimeout(Main.hideLoading, 300) | |
| } | |
| Main.log("lottery-status: " + d) | |
| } | |
| }) | |
| } | |
| var e = {}, f = {}, k, c, h, l, g, n, p = 0, m = 3; | |
| return { | |
| init: function (b) { | |
| e = a.extend(f, b || {}); | |
| e = a.extend(e, Main.commonSettings()); | |
| k = e.main; | |
| c = a(".game", k); | |
| h = a(".overlay", c); | |
| l = a(".rule", c); | |
| g = a(".start", l); | |
| n = a(".countdown", c); | |
| c.removeClass("hidden"); | |
| r(); | |
| Main.setCurrentPage("game"); | |
| Main.log("----- GamePage.init -----") | |
| }, | |
| gameFinish: function (a) { | |
| Main.showLoading(function () { | |
| t(a); | |
| c.addClass("hidden"); | |
| Game.destroy(); | |
| GamePage.destroy() | |
| }) | |
| }, | |
| destroy: function () { | |
| h.removeClass("hidden"); | |
| l.removeClass("hidden"); | |
| n = g = l = h = c = k = null; | |
| m = 3; | |
| p = 0 | |
| } | |
| } | |
| }(window, jQuery) | |
| , ResultPage = ResultPage || function (u, a) { | |
| function r() { | |
| n.bind("click", function (a) { | |
| console.log(6) | |
| a.preventDefault(); | |
| Main.checkFull(function (a) { | |
| a || Main.chagnePage(function () { | |
| f.addClass("hidden"); | |
| GamePage.init() | |
| }, function () { | |
| ResultPage.destroy() | |
| }) | |
| }) | |
| }); | |
| FB.getLoginStatus(function (a) { | |
| "connected" == a.status ? p.attr("href", "https://www.facebook.com/dialog/share?app_id=922145544801485&display=touch&href=https://tw.campaign.bid.yahoo.com/activity?p=auc-1-0-190627-summerlove&hashtag=%23\u6200\u590f\u71b1\u543b\u51a0\u8ecd\u8cfd&redirect_uri=https://www.gotoandplay.com.tw/bid-yahoo/ShareDone.aspx?c=" + b.custom) : p.attr("href", "https://www.facebook.com/v3.3/dialog/oauth?client_id=922145544801485&redirect_uri=https://www.gotoandplay.com.tw/bid-yahoo/OAuth.aspx&state=" + b.custom) | |
| }) | |
| } | |
| var b = {}, t = {}, e, f, k, c, h, l, g, n, p, m = null; | |
| return { | |
| init: function (d) { | |
| b = a.extend(t, d || {}); | |
| b = a.extend(b, Main.commonSettings()); | |
| e = b.main; | |
| f = a(".game-result", e); | |
| k = a(".content", f); | |
| c = a(".speak", f); | |
| h = a(".ticket", f); | |
| l = a(".sn", f); | |
| g = a(".score", f); | |
| n = a(".re-play", f); | |
| p = a(".share", f); | |
| g.text(b.score); | |
| 0 == b.award ? (k.addClass("coupon"), | |
| h.children(".coupon").attr("class", "coupon c" + b.ckey), | |
| h.children(".buy").removeClass("hidden").attr("href", b.link), | |
| l.children(".buy").attr("href", b.link), | |
| l.children(".copy").attr("data-clipboard-text", b.code), | |
| l.children("p").text(b.code), | |
| m = new ClipboardJS(".copy"), | |
| m.on("success", function (a) { | |
| alert("\u60a8\u5df2\u7d93\u9806\u5229\u8907\u88fd\u5e8f\u865f!") | |
| })) : (k.removeClass("coupon"), | |
| h.children(".buy").addClass("hidden").attr("href", "#"), | |
| h.children(".point").attr("class", "point p" + b.award)); | |
| c.children().addClass("hidden"); | |
| c.children(":eq(" + (Math.floor(4 * Math.random()) + 0) + ")").removeClass("hidden"); | |
| f.removeClass("hidden"); | |
| r(); | |
| Main.setCurrentPage("result"); | |
| Main.log("----- ResultPage.init -----") | |
| }, | |
| go2Home: function () { | |
| Main.chagnePage(function () { | |
| f.addClass("hidden"); | |
| HomePage.init() | |
| }, function () { | |
| ResultPage.destroy() | |
| }) | |
| }, | |
| destroy: function () { | |
| p.unbind("click"); | |
| n.unbind("click"); | |
| p = n = g = l = h = c = k = f = e = null; | |
| null != m && (m.destroy(), | |
| m = null) | |
| } | |
| } | |
| }(window, jQuery); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment