123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331 |
- var d = !0,
- e = null,
- g = !1,
- h;
- function k(a) {
- var b, c = this;
- this.c = g;
- this.e = 0;
- this.a = e;
- this.p = this.r = this.q = 0;
- this.B = 10;
- this.D = a;
- if (!a || !a.nodeType) throw new TypeError("Layer must be a document node");
- this.h = function() {
- return k.prototype.h.apply(c, arguments)
- };
- this.d = function() {
- return k.prototype.d.apply(c, arguments)
- };
- this.k = function() {
- return k.prototype.k.apply(c, arguments)
- };
- this.j = function() {
- return k.prototype.j.apply(c, arguments)
- };
- this.i = function() {
- return k.prototype.i.apply(c, arguments)
- };
- l() || (this.f && (a.addEventListener("mouseover", this.d, d), a.addEventListener("mousedown", this.d, d), a.addEventListener("mouseup", this.d, d)), a.addEventListener("click", this.h, d), a.addEventListener("touchstart", this.k, g), a.addEventListener("touchend", this.j, g), a.addEventListener("touchcancel", this.i, g), Event.prototype.stopImmediatePropagation || (a.removeEventListener = function(b, c, q) {
- var r = Node.prototype.removeEventListener;
- "click" === b ? r.call(a, b, c.n || c, q) : r.call(a, b, c, q)
- },
- a.addEventListener = function(b, c, q) {
- var r = Node.prototype.addEventListener;
- "click" === b ? r.call(a, b, c.n || (c.n = function(a) {
- a.A || c(a)
- }), q) : r.call(a, b, c, q)
- }), "function" === typeof a.onclick && (b = a.onclick, a.addEventListener("click",
- function(a) {
- b(a)
- },
- g), a.onclick = e))
- }
- h = k.prototype;
- h.f = 0 < navigator.userAgent.indexOf("Android");
- h.b = /iP(ad|hone|od)/.test(navigator.userAgent);
- h.g = k.prototype.b && /OS 4_\d(_\d)?/.test(navigator.userAgent);
- h.u = k.prototype.b && /OS ([6-9]|\d{2})_\d/.test(navigator.userAgent);
- function m(a, b) {
- switch (b.nodeName.toLowerCase()) {
- case "button":
- case "select":
- case "textarea":
- if (b.disabled) return d;
- break;
- case "input":
- if (a.b && "file" === b.type || b.disabled) return d;
- break;
- case "label":
- case "video":
- return d
- }
- return /\bneedsclick\b/.test(b.className)
- }
- function n(a) {
- switch (a.nodeName.toLowerCase()) {
- case "textarea":
- case "select":
- return d;
- case "input":
- switch (a.type) {
- case "button":
- case "checkbox":
- case "file":
- case "image":
- case "radio":
- case "submit":
- return g
- }
- return ! a.disabled && !a.readOnly;
- default:
- return /\bneedsfocus\b/.test(a.className)
- }
- }
- h.focus = function(a) {
- var b;
- this.b && a.setSelectionRange ? (b = a.value.length, a.setSelectionRange(b, b)) : a.focus()
- };
- h.k = function(a) {
- var b, c, f;
- if (1 < a.targetTouches.length) return d;
- b = a.target.nodeType === Node.TEXT_NODE ? a.target.parentNode: a.target;
- c = a.targetTouches[0];
- if (this.b) {
- f = window.getSelection();
- if (f.rangeCount && !f.isCollapsed) return d;
- if (!this.g) {
- if (c.identifier === this.p) return a.preventDefault(),
- g;
- this.p = c.identifier;
- var p;
- f = b.m;
- if (!f || !f.contains(b)) {
- p = b;
- do {
- if (p.scrollHeight > p.offsetHeight) {
- f = p;
- b.m = p;
- break
- }
- p = p.parentElement
- } while ( p )
- }
- f && (f.v = f.scrollTop)
- }
- }
- this.c = d;
- this.e = a.timeStamp;
- this.a = b;
- this.q = c.pageX;
- this.r = c.pageY;
- 200 > a.timeStamp - this.o && a.preventDefault();
- return d
- };
- h.j = function(a) {
- var b, c, f;
- f = this.a;
- b = a.changedTouches[0];
- c = this.B;
- if (Math.abs(b.pageX - this.q) > c || Math.abs(b.pageY - this.r) > c || 300 < a.timeStamp - this.e) this.c = g,
- this.a = e;
- if (!this.c) return d;
- if (200 > a.timeStamp - this.o) return this.t = d;
- this.o = a.timeStamp;
- b = this.e;
- this.c = g;
- this.e = 0;
- this.u && (f = a.changedTouches[0], f = document.elementFromPoint(f.pageX - window.pageXOffset, f.pageY - window.pageYOffset));
- c = f.tagName.toLowerCase();
- if ("label" === c) {
- if (b = void 0 !== f.control ? f.control: f.htmlFor ? document.getElementById(f.htmlFor) : f.querySelector("button, input:not([type=hidden]), keygen, meter, output, progress, select, textarea")) {
- this.focus(f);
- if (this.f) return g;
- f = b
- }
- } else if (n(f)) {
- if (100 < a.timeStamp - b || this.b && window.top !== window && "input" === c) return this.a = e,
- g;
- this.focus(f);
- if (!this.g || "select" !== c) this.a = e,
- a.preventDefault();
- return g
- }
- if (this.b && !this.g && (b = f.m) && b.v !== b.scrollTop) return d;
- m(this, f) || (a.preventDefault(), document.activeElement && document.activeElement !== f && document.activeElement.blur(), b = a.changedTouches[0], a = document.createEvent("MouseEvents"), a.initMouseEvent("click", d, d, window, 1, b.screenX, b.screenY, b.clientX, b.clientY, g, g, g, g, 0, e), a.w = d, f.dispatchEvent(a));
- return g
- };
- h.i = function() {
- this.c = g;
- this.a = e
- };
- h.d = function(a) {
- return ! this.a || a.w || !a.cancelable ? d: !m(this, this.a) || this.t ? (a.stopImmediatePropagation ? a.stopImmediatePropagation() : a.A = d, a.stopPropagation(), a.preventDefault(), g) : d
- };
- h.h = function(a) {
- if (this.c) return this.a = e,
- this.c = g,
- d;
- if ("submit" === a.target.type && 0 === a.detail) return d;
- a = this.d(a);
- a || (this.a = e);
- return a
- };
- function l() {
- var a;
- if ("undefined" === typeof window.ontouchstart) return d;
- if (/Chrome\/[0-9]+/.test(navigator.userAgent)) if (k.prototype.f) {
- if ((a = document.querySelector("meta[name=viewport]")) && -1 !== a.content.indexOf("user-scalable=no")) return d
- } else return d;
- return g
- }
- var t = [];
- function u(a) {
- if ( - 1 != t.indexOf(a)) return g;
- t.push(a);
- return new k(a)
- }
- "undefined" !== typeof define && define.C ? define(function() {
- return k
- }) : "undefined" !== typeof module && module.l ? (module.l = u, module.l.s = k) : window.s = k;
- u(document);
- var v = document,
- w = window,
- x = 0,
- y = 0,
- z = 0,
- A = 0,
- B = 0,
- C = 0,
- D = 0,
- E = 0,
- F = g,
- G = 0,
- H = 0,
- I = d,
- J = g;
- function K(a) {
- a = a.accelerationIncludingGravity;
- var b = (new Date).getTime(),
- c = 0,
- c = 0;
- if (100 < b - D) {
- c = b - D;
- D = b;
- x = a.x;
- y = a.y;
- z = a.z;
- c = 1E4 * (Math.abs(x + y + z - A - B - C) / c);
- if (I && 500 < c) {
- if (E = D, F || (F = d, L()), G += c / 500 / 4, G = 100 <= G ? 100 : G, M(), J || (J = d, document.getElementById("shake").play()), 100 == G) {
- clearTimeout(N);
- I = g;
- v.querySelector(".main").className = "main open";
- v.getElementById("fizzing").play();
- a = 0;
- b = v.querySelector(".time").innerHTML;
- v.getElementById("t").innerHTML = b;
- 2E4 > O && (a = parseInt(100 * ((2E4 - O) / 2E4)));
- v.getElementById("b").innerHTML = a + "%";
- P = "我用" + b + "秒摇爆可乐,击败了" + a + "%燥热的人,快来全民摇可乐!";
- v.querySelector(".progress_num").style.display = "none";
- setTimeout(Q, 3E3);
- clearTimeout(R);
- document.querySelector(".ready").className = "ready";
- try {
- w._hmt.push(["_trackEvent", "CM_shake_cola", "devicemotion", "CM_shake_cola_shake_success", "1"])
- } catch(f) {}
- dp_submitScore(b,a);
- }
- } else I && 1E3 < b - E && (G--, G = 0 >= G ? 0 : G, M());
- A = x;
- B = y;
- C = z
- }
- }
- var R = e;
- function L() {
- v.querySelector(".ready").style.display = "none";
- v.querySelector(".progress_num").style.display = "block";
- H = (new Date).getTime();
- S();
- document.getElementById("shake").play();
- R = setTimeout(function() {
- document.querySelector(".ready").className = "ready ready_lost"
- },
- 5E3);
- try {
- w._hmt.push(["_trackEvent", "CM_shake_cola", "devicemotion", "CM_shake_cola_shake_start", "1"])
- } catch(a) {}
- }
- function M() {
- v.querySelector(".progress").style.height = G + "%";
- v.querySelector(".bf_2").innerHTML = parseInt(G) + "%";
- v.querySelector(".bf").innerHTML = parseInt(100 - G) + "%";
- 0 == G ? v.querySelector(".bf").style.fontSize = "16px": v.querySelector(".bf").style.fontSize = "20px"
- }
- var N = e,
- O = 0;
- function S() {
- var a = (new Date).getTime() - H,
- b = 0,
- c = a.toString().substr(a.toString().length - 3);
- str = "";
- 1E3 <= a ? (b = parseInt(a / 1E3), 10 > b && (b = b)) : b = "0";
- str = b + "." + c;
- v.querySelector(".time").innerHTML = str;
- O = a;
- clearTimeout(N);
- N = setTimeout(S, 50)
- }
- function Q() {
- v.querySelector(".main").className = "main";
- v.querySelector(".layer").style.display = "block";
- v.querySelector(".time").style.display = "none"
- }
- function T() {
- clearTimeout(N);
- clearTimeout(R);
- document.querySelector(".ready").className = "ready";
- R = setTimeout(function() {
- document.querySelector(".ready").className = "ready ready_lost"
- },
- 5E3);
- E = G = H = 0;
- F = g;
- v.querySelector(".ready").style.display = "block";
- v.querySelector(".time").innerHTML = "00:000";
- v.querySelector(".progress").style.height = "0";
- v.querySelector(".layer").style.display = "none";
- v.querySelector(".time").style.display = "block";
- I = d
- }
- var W = "",
- X = "",
- Y = "",
- P = "我正在玩全民摇可乐,你也过来试一试,看你有多快!";
- (function() {
- w.addEventListener("devicemotion", K, g);
- w.navigator.userAgent.toLowerCase().match(/MicroMessenger/i);
- R = setTimeout(function() {
- document.querySelector(".ready").className = "ready ready_lost"
- },
- 5E3);
- v.getElementById("shake").addEventListener("ended",
- function() {
- J = g
- },
- g);
- v.getElementById("tryagain").addEventListener("click",
- function() {
- try {
- w._hmt.push(["_trackEvent", "CM_shake_cola", "click", "CM_shake_cola_restart", "1"])
- } catch(a) {}
- T()
- },
- g);
- })();
|