index.html 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <!DOCTYPE HTML>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>空中传媒</title>
  6. <meta name="viewport"
  7. content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
  8. <meta name="apple-mobile-web-app-capable" content="yes"/>
  9. <meta name="full-screen" content="true"/>
  10. <meta name="screen-orientation" content="portrait"/>
  11. <meta name="x5-fullscreen" content="true"/>
  12. <meta name="360-fullscreen" content="true"/>
  13. <style>
  14. body {
  15. text-align: center;
  16. background: #000000;
  17. padding: 0;
  18. border: 0;
  19. margin: 0;
  20. height: 100%;
  21. }
  22. * {
  23. -webkit-touch-callout:none;
  24. -webkit-user-select:none;
  25. -khtml-user-select:none;
  26. -moz-user-select:none;
  27. -ms-user-select:none;
  28. user-select:none;
  29. -webkit-tap-highlight-color:rgba(0,0,0,0);
  30. }
  31. html {
  32. -ms-touch-action: none; /* Direct all pointer events to JavaScript code. */
  33. }
  34. .button {
  35. display: block;
  36. margin: 0 auto;
  37. width: 320px;
  38. }
  39. .imghide{
  40. display:none;
  41. }
  42. #statusnow{
  43. width:70%;
  44. height:250px;
  45. }
  46. </style>
  47. </head>
  48. <body>
  49. <div style="display:inline-block;width:100%; height:100%;margin: 0 auto; background: black; position:relative;" id="gameDiv">
  50. <div style="text-align:center;margin-top:50px;">
  51. <span id="timer" style="color:#fff;font-size:20px;">10 秒</span>
  52. <div id="result_panel" style="display:none;text-align:center;background-color:rgba(0,0,0,0.5)">
  53. <div><button id="reset" style="font-size:25px">再玩一次</button><br>
  54. <button onClick="clickMore();" style="font-size:25px">更多游戏</button></div>
  55. </div>
  56. </div>
  57. <div id="button" class="button">
  58. <img src="img/01.jpg" id="statusnow"/>
  59. </div>
  60. <div style="text-align:center;">
  61. <div id="result" style="color:#fff;font-size:30px;">0 升</div>
  62. <div id="best" style="margin-top:20px;color:#fff;font-size:20px;"> </div>
  63. </div>
  64. <audio src="audio/2793.wav" preload id="clickdownsound"></audio>
  65. <img src="img/01.jpg" class="imghide" id="status01"/>
  66. <img src="img/02.jpg" class="imghide" id="status02"/>
  67. </div>
  68. <script src="jquery/1.10.2/jquery.min.js"></script>
  69. <script type="text/javascript">
  70. var initial = 1000;
  71. var count = initial;
  72. var counter; //10 will run it every 100th of a second
  73. var state = 0;
  74. var total = 0;
  75. var cds=$('#clickdownsound').get(0);
  76. if (localStorage.max) {
  77. $('#best').html( '最好成绩:' + localStorage.max + ' 升');
  78. }
  79. function timer() {
  80. if (count <= 0) {
  81. clearInterval(counter);
  82. state = 0;
  83. $('#result_panel').show();
  84. if ( !localStorage.max || parseInt(localStorage.max) < total) {
  85. localStorage.max = total;
  86. $('#best').html( '最好成绩:' + localStorage.max + ' 升');
  87. }
  88. $('#timer').hide();
  89. localStorage.max = parseInt(localStorage.max) > total ? localStorage.max: total;
  90. dp_submitScore(total);
  91. offEvent();
  92. return;
  93. }
  94. count--;
  95. displayCount(count);
  96. }
  97. function displayCount(count) {
  98. var res = count / 100;
  99. document.getElementById("timer").innerHTML = res.toPrecision(count.toString().length) + " 秒";
  100. }
  101. $(document).on('touchmove', function(e) {
  102. e.preventDefault();
  103. })
  104. function reset() {
  105. count = initial;
  106. total = 0;
  107. state = 0;
  108. $('#result').html(total + ' 升');
  109. $('#timer').html(10 + ' 秒');
  110. initEvent();
  111. }
  112. $('#reset').on('touchend click', function (e) {
  113. reset();
  114. $('#result_panel').hide();
  115. $('#timer').show();
  116. e.preventDefault();
  117. });
  118. displayCount(initial);
  119. initEvent();
  120. function offEvent(){
  121. $('#button').unbind();
  122. }
  123. function initEvent(){
  124. $('#button').on('touchstart mousedown', function (e) {
  125. if (!state) {
  126. state = 1;
  127. counter = setInterval(timer, 10);
  128. }
  129. $('#statusnow').attr('src',$('#status01').attr('src'));
  130. if(cds.paused){
  131. cds.currentTime=0;
  132. }
  133. cds.play();
  134. e.preventDefault();
  135. });
  136. $('#button').on('touchend mouseup', function (e) {
  137. if (state) {
  138. total++;
  139. $('#result').html(total + ' 升');
  140. }
  141. cds.pause();
  142. $('#statusnow').attr('src',$('#status02').attr('src'));
  143. e.preventDefault();
  144. });
  145. }
  146. </script>
  147. <script language=javascript>
  148. var mebtnopenurl = 'http://game.ikongzhong.cn/games/';
  149. window.shareData = {
  150. "imgUrl": "http://game.ikongzhong.cn/icon/bttz.png",
  151. "timeLineLink": "http://game.ikongzhong.cn/games/bttz/index.html",
  152. "tTitle": "冰桶挑战-空中传媒",
  153. "tContent": "冰桶挑战-空中传媒"
  154. };
  155. function goHome(){
  156. window.location=mebtnopenurl;
  157. }
  158. function clickMore(){
  159. if((window.location+"").indexOf("f=zf",1)>0){
  160. window.location = "http://game.ikongzhong.cn/games/";
  161. }
  162. else{
  163. goHome();
  164. }
  165. }
  166. function dp_share(){
  167. document.title ="冰桶挑战全民出动,我在短短10秒倒了"+myData.score+"升,还有谁?"
  168. document.getElementById("share").style.display="";
  169. window.shareData.tTitle = document.title;
  170. }
  171. function dp_Ranking(){
  172. window.location=mebtnopenurl;
  173. }
  174. function showAd(){
  175. }
  176. function hideAd(){
  177. }
  178. document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
  179. WeixinJSBridge.on('menu:share:appmessage', function(argv) {
  180. WeixinJSBridge.invoke('sendAppMessage', {
  181. "img_url": window.shareData.imgUrl,
  182. "link": window.shareData.timeLineLink,
  183. "desc": window.shareData.tContent,
  184. "title": window.shareData.tTitle
  185. }, onShareComplete);
  186. });
  187. WeixinJSBridge.on('menu:share:timeline', function(argv) {
  188. WeixinJSBridge.invoke('shareTimeline', {
  189. "img_url": window.shareData.imgUrl,
  190. "img_width": "640",
  191. "img_height": "640",
  192. "link": window.shareData.timeLineLink,
  193. "desc": window.shareData.tContent,
  194. "title": window.shareData.tTitle
  195. }, onShareComplete);
  196. });
  197. }, false);
  198. </script>
  199. <div id=share style="display: none">
  200. <img width=100% src="http://game.ikongzhong.cn/games/bttz/share.png"
  201. style="position: fixed; z-index: 9999; top: 0; left: 0; display: "
  202. ontouchstart="document.getElementById('share').style.display='none';" />
  203. </div>
  204. <div style="display: none;">
  205. <script type="text/javascript">
  206. var myData = { gameid: "bttz" };
  207. var domain = ["oixm.cn", "hiemma.cn", "peagame.net"][parseInt(Math.random() * 3)];
  208. window.shareData.timeLineLink ="http://game.ikongzhong.cn/games/bttz";
  209. function dp_submitScore(score){
  210. myData.score = score;
  211. myData.scoreName ="共倒"+score+"升";
  212. if(score>0){
  213. if (confirm("冰桶挑战邀你来战,10秒内你居然倒了"+score+"升!你这么吊小伙伴们知道不?")){
  214. dp_share();
  215. }
  216. }
  217. }
  218. function onShareComplete(res) {
  219. if (localStorage.myuid && myData.score != undefined) {
  220. setTimeout(function(){
  221. if (confirm("要将成绩提交到空中传媒排行榜吗?")) {
  222. window.location = "http://game.ikongzhong.cn/games/";
  223. }
  224. else {
  225. document.location.href = mebtnopenurl;
  226. }
  227. }, 500);
  228. }
  229. else {
  230. document.location.href = mebtnopenurl;
  231. }
  232. }
  233. </script>
  234. <script type="text/javascript" src="http://tajs.qq.com/stats?sId=36313548" charset="UTF-8"></script>
  235. </body>
  236. </html>