index.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. 
  2. <!DOCTYPE html>
  3. <html>
  4. <head>
  5. <title>中秋佳节点花灯</title>
  6. <div id='wx_pic' style='margin:0 auto;display:none;'>
  7. <img src='photo.jpg' />
  8. </div>
  9. <meta charset="utf-8"/>
  10. <meta name="viewport" content="initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0, width=device-width,target-densitydpi=device-dpi"/>
  11. <script type="text/javascript">
  12. //var i = new Date().getTime() % 5;
  13. //if (i < 3) {
  14. // document.write('<script type="text/javascript" src="game1/tt/scripts/createjs.js"><\/script>');
  15. //}
  16. //else {
  17. // document.write('<script type="text/javascript" src="game1/tt/scripts/createjs.js"><\/script>');
  18. //}
  19. var isDesktop = navigator['userAgent'].match(/(ipad|iphone|ipod|android|windows phone)/i) ? false : true;
  20. var fontunit = isDesktop ? 20 : ((window.innerWidth > window.innerHeight ? window.innerHeight : window.innerWidth) / 320) * 10;
  21. document.write('<style type="text/css">' +
  22. 'html,body {font-size:' + (fontunit < 30 ? fontunit : '30') + 'px;}' +
  23. (isDesktop ? '#welcome,#GameTimeLayer,#GameLayerBG,#GameScoreLayer.SHADE{position: absolute;}' :
  24. '#welcome,#GameTimeLayer,#GameLayerBG,#GameScoreLayer.SHADE{position:fixed;}@media screen and (orientation:landscape) {#landscape {display: box; display: -webkit-box; display: -moz-box; display: -ms-flexbox;}}') +
  25. '</style>');
  26. </script>
  27. <script type="text/ecmascript" src="scripts/createjs.js"></script>
  28. <style type="text/css">
  29. body {font-family: "Helvetica Neue", Helvetica, STHeiTi, sans-serif; margin: 0; padding: 0;}
  30. .loading {background-image: url("data:image/gif;base64,R0lGODlhJQAlAJECAL3L2AYrTv///wAAACH/C05FVFNDQVBFMi4wAwEAAAAh+QQFCgACACwAAAAAJQAlAAACi5SPqcvtDyGYIFpF690i8xUw3qJBwUlSadmcLqYmGQu6KDIeM13beGzYWWy3DlB4IYaMk+Dso2RWkFCfLPcRvFbZxFLUDTt21BW56TyjRep1e20+i+eYMR145W2eefj+6VFmgTQi+ECVY8iGxcg35phGo/iDFwlTyXWphwlm1imGRdcnuqhHeop6UAAAIfkEBQoAAgAsEAACAAQACwAAAgWMj6nLXAAh+QQFCgACACwVAAUACgALAAACFZQvgRi92dyJcVJlLobUdi8x4bIhBQAh+QQFCgACACwXABEADAADAAACBYyPqcsFACH5BAUKAAIALBUAFQAKAAsAAAITlGKZwWoMHYxqtmplxlNT7ixGAQAh+QQFCgACACwQABgABAALAAACBYyPqctcACH5BAUKAAIALAUAFQAKAAsAAAIVlC+BGL3Z3IlxUmUuhtR2LzHhsiEFACH5BAUKAAIALAEAEQAMAAMAAAIFjI+pywUAIfkEBQoAAgAsBQAFAAoACwAAAhOUYJnAagwdjGq2amXGU1PuLEYBACH5BAUKAAIALBAAAgAEAAsAAAIFhI+py1wAIfkEBQoAAgAsFQAFAAoACwAAAhWUL4AIvdnciXFSZS6G1HYvMeGyIQUAIfkEBQoAAgAsFwARAAwAAwAAAgWEj6nLBQAh+QQFCgACACwVABUACgALAAACE5RgmcBqDB2MarZqZcZTU+4sRgEAIfkEBQoAAgAsEAAYAAQACwAAAgWEj6nLXAAh+QQFCgACACwFABUACgALAAACFZQvgAi92dyJcVJlLobUdi8x4bIhBQAh+QQFCgACACwBABEADAADAAACBYSPqcsFADs=");
  31. background-repeat: no-repeat;
  32. background-position: center center;
  33. background-size: auto 60%;
  34. }
  35. .SHADE {top: 0; left:0; width:100%; height: 100%; bottom:0; z-index: 11;}
  36. .BOX-V {box-orient: vertical;-webkit-box-orient: vertical; -moz-box-orient: vertical;-ms-flex-direction:column;}
  37. .BOX-D {box-align: end; box-pack: center -webkit-box-align: end; -webkit-box-pack: center; -ms-flex-align:end; -ms-flex-pack:center;}
  38. .BOX-M {box-align: center;box-pack: center; -webkit-box-align: center; -webkit-box-pack: center; -ms-flex-align:center; -ms-flex-pack:center;}
  39. .BOX-S {display:block; box-flex:1; -webkit-box-flex:1; -moz-box-flex:1;-ms-flex:1;}
  40. .BOX ,.BOX-V,.BOX-D,.BOX-M, .FOOTER{display: box; display: -webkit-box; display: -moz-box; display: -ms-flexbox;}
  41. .BBOX ,.BOX,.APP-STAGE,.INSET-STAGE,.STAGE,.PAGE-STAGE,.PAGE,.PAGE-BOX,.INSET-PAGE,.FOOTER{box-sizing:border-box; -webkit-box-sizing:border-box; -moz-box-sizing:border-box;}
  42. #welcome { background-color:rgba(0,0,0,.8); text-align: center; font-weight: bold;overflow: hidden;}
  43. .welcome-bg {position:absolute;top:0;left:0;right:0;bottom:0; background: url(01.jpg) center center no-repeat; background-size:100% 100%; opacity: .4;overflow: hidden;}
  44. #GameTimeLayer {top:1em; left: 0; width:100%; text-align: center; color:#f00; font-size: 4em; text-shadow:0 0 3px #fff,0 0 3px #fff,0 0 3px #fff;overflow: hidden;}
  45. #GameLayerBG {top:0;left:0;right:0;bottom:0;overflow:hidden;background:#fff;}
  46. .GameLayer {position:absolute;bottom:0;left:0;}
  47. .block {position:absolute;border-top:1px solid #1D70B6; background-repeat: no-repeat; background-position: center;}
  48. .t1,.t2,.t3,.t4,.t5 { background-size:auto 100%;background-image:url(02.jpg);}
  49. .tt1,.tt2,.tt3,.tt4,.tt5 { background-size:auto 86%;background-image:url(03.jpg);}
  50. .bl {border-left:1px solid #1D70B6;}
  51. @-ms-keyframes flash {
  52. 0% { opacity: 1; }
  53. 50% { opacity: 0; }
  54. 100% { opacity: 1; }
  55. }
  56. @-webkit-keyframes flash {
  57. 0% { opacity: 1; }
  58. 50% { opacity: 0; }
  59. 100% { opacity: 1; }
  60. }
  61. .flash {-webkit-animation: flash .2s 3;animation: flash .2s 3;}
  62. .bad {background-color: #f00; -webkit-animation: flash .2s 3;animation: flash .2s 3;}
  63. * {-webkit-tap-highlight-color: rgba(0,0,0,0);-ms-tap-highlight-color: rgba(0,0,0,0); tap-highlight-color: rgba(0,0,0,0); -ms-user-select: none;}
  64. #GameScoreLayer { padding-top:3em; font-size:2em; font-weight: bold; color:#fff; text-align: center;overflow: hidden;}
  65. .bgc1 { background-color: #23378B;}
  66. .bgc2 { background-color: #009FE3;}
  67. .bgc3 { background-color: #E42313;}
  68. .bgc4 { background-color: #FCBD1B;}
  69. .bgc5 { background-color: #34002A;}
  70. .share-icon {width:1.7em; background-repeat:no-repeat; background-size: auto 100%;}
  71. #GameScoreLayer-btn .btn,#GameScoreLayer-share .btn {text-align: center;font-size:1.1em; background-color: rgba(0,0,0,.3); height:2em; line-height:2em;}
  72. .btn:active {opacity: 0.2;}
  73. #landscape {display: none;}
  74. #gameBody {position: relative; width: 640px; margin: 0 auto; height: 100%;}
  75. #share-wx {
  76. background: rgba(0,0,0,0.8);
  77. position: absolute;
  78. top: 0px;
  79. left: 0px;
  80. width: 100%;
  81. height: 100%;
  82. z-index: 10000;
  83. display: none;
  84. }
  85. a:link {text-decoration: none; color:#FFF;}  
  86. </style>
  87. <!-- <script type="text/javascript" src="scripts/stats.js" charset="UTF-8"></script>-->
  88. </head>
  89. <body onLoad="init()">
  90. <script type="text/javascript">
  91. window.shareData = {
  92. "imgUrl": "http://www.0550weixin.com/02.jpg",
  93. "timeLineLink": "http://www.0550weixin.com/",
  94. "tTitle": "点燃",
  95. "tContent": "点燃"
  96. };
  97. if (isDesktop)
  98. document.write('<div id="gameBody">');
  99. var body, blockSize, GameLayer = [], GameLayerBG, touchArea = [], GameTimeLayer;
  100. var transform, transitionDuration;
  101. function init(argument) {
  102. showWelcomeLayer();
  103. body = document.getElementById('gameBody') || document.body;
  104. body.style.height = window.innerHeight + 'px';
  105. transform = typeof (body.style.webkitTransform) != 'undefined' ? 'webkitTransform' : (typeof (body.style.msTransform) != 'undefined' ? 'msTransform' : 'transform');
  106. transitionDuration = transform.replace(/ransform/g, 'ransitionDuration');
  107. GameTimeLayer = document.getElementById('GameTimeLayer');
  108. GameLayer.push(document.getElementById('GameLayer1'));
  109. GameLayer[0].children = GameLayer[0].querySelectorAll('div');
  110. GameLayer.push(document.getElementById('GameLayer2'));
  111. GameLayer[1].children = GameLayer[1].querySelectorAll('div');
  112. GameLayerBG = document.getElementById('GameLayerBG');
  113. if (GameLayerBG.ontouchstart === null) {
  114. GameLayerBG.ontouchstart = gameTapEvent;
  115. } else {
  116. GameLayerBG.onmousedown = gameTapEvent;
  117. document.getElementById('landscape-text').innerHTML = '点我开始点燃';
  118. document.getElementById('landscape').onclick = winOpen;
  119. }
  120. gameInit();
  121. window.addEventListener('resize', refreshSize, false);
  122. var rtnMsg = "true";
  123. setTimeout(function(){
  124. if(rtnMsg == 'false'){
  125. var btn = document.getElementById('ready-btn');
  126. btn.className = 'btn';
  127. btn.innerHTML = '我看好你哟!'
  128. }else{
  129. var btn = document.getElementById('ready-btn');
  130. btn.className = 'btn';
  131. btn.innerHTML = ' 预备,上!'
  132. btn.style.backgroundColor = '#F00';
  133. btn.onclick = function(){
  134. closeWelcomeLayer();
  135. }
  136. }
  137. }, 500);
  138. }
  139. function winOpen() {
  140. window.open(location.href + '?r=' + Math.random(), 'nWin', 'height=500,width=320,toolbar=no,menubar=no,scrollbars=no');
  141. var opened = window.open('about:blank', '_self'); opened.opener = null; opened.close();
  142. }
  143. var refreshSizeTime;
  144. function refreshSize() {
  145. clearTimeout(refreshSizeTime);
  146. refreshSizeTime = setTimeout(_refreshSize, 200);
  147. }
  148. function _refreshSize() {
  149. countBlockSize();
  150. for (var i = 0; i < GameLayer.length; i++) {
  151. var box = GameLayer[i];
  152. for (var j = 0; j < box.children.length; j++) {
  153. var r = box.children[j],
  154. rstyle = r.style;
  155. rstyle.left = (j % 4) * blockSize + 'px';
  156. rstyle.bottom = Math.floor(j / 4) * blockSize + 'px';
  157. rstyle.width = blockSize + 'px';
  158. rstyle.height = blockSize + 'px';
  159. }
  160. }
  161. var f, a;
  162. if (GameLayer[0].y > GameLayer[1].y) {
  163. f = GameLayer[0];
  164. a = GameLayer[1];
  165. } else {
  166. f = GameLayer[1];
  167. a = GameLayer[0];
  168. }
  169. var y = ((_gameBBListIndex) % 10) * blockSize;
  170. f.y = y;
  171. f.style[transform] = 'translate3D(0,' + f.y + 'px,0)';
  172. a.y = -blockSize * Math.floor(f.children.length / 4) + y;
  173. a.style[transform] = 'translate3D(0,' + a.y + 'px,0)';
  174. }
  175. function countBlockSize() {
  176. blockSize = body.offsetWidth / 4;
  177. body.style.height = window.innerHeight + 'px';
  178. GameLayerBG.style.height = window.innerHeight + 'px';
  179. touchArea[0] = window.innerHeight - blockSize * 0;
  180. touchArea[1] = window.innerHeight - blockSize * 3;
  181. }
  182. var _gameBBList = [], _gameBBListIndex = 0, _gameOver = false, _gameStart = false, _gameTime, _gameTimeNum, _gameScore;
  183. function gameInit() {
  184. createjs.Sound.registerSound({ src: "img/err.mp3", id: "err" });
  185. createjs.Sound.registerSound({ src: "img/end.mp3", id: "end" });
  186. createjs.Sound.registerSound({ src: "img/tap.mp3", id: "tap" });
  187. gameRestart();
  188. }
  189. function gameRestart() {
  190. console.log('gameRestart');
  191. _gameBBList = [];
  192. _gameBBListIndex = 0;
  193. _gameScore = 0;
  194. _gameOver = false;
  195. _gameStart = false;
  196. _gameTimeNum = 2000;
  197. GameTimeLayer.innerHTML = creatTimeText(_gameTimeNum);
  198. countBlockSize();
  199. refreshGameLayer(GameLayer[0]);
  200. refreshGameLayer(GameLayer[1], 1);
  201. }
  202. function gameStart() {
  203. _gameStart = true;
  204. _gameTime = setInterval(gameTime, 10);
  205. }
  206. function gameOver() {
  207. _gameOver = true;
  208. clearInterval(_gameTime);
  209. setTimeout(function () {
  210. GameLayerBG.className = '';
  211. showGameScoreLayer();
  212. }, 1500);
  213. }
  214. function gameTime() {
  215. _gameTimeNum--;
  216. if (_gameTimeNum <= 0) {
  217. GameTimeLayer.innerHTML = '&nbsp;&nbsp;&nbsp;&nbsp;时间到!';
  218. gameOver();
  219. GameLayerBG.className += ' flash';
  220. createjs.Sound.play("end");
  221. } else {
  222. GameTimeLayer.innerHTML = creatTimeText(_gameTimeNum);
  223. }
  224. }
  225. function creatTimeText(n) {
  226. var text = (100000 + n + '').substr(-4, 4);
  227. text = '&nbsp;&nbsp;' + text.substr(0, 2) + "'" + text.substr(2) + "''"
  228. return text;
  229. }
  230. var _ttreg = / t{1,2}(\d+)/, _clearttClsReg = / t{1,2}\d+| bad/;
  231. function refreshGameLayer(box, loop, offset) {
  232. var i = Math.floor(Math.random() * 1000) % 4 + (loop ? 0 : 4);
  233. for (var j = 0; j < box.children.length; j++) {
  234. var r = box.children[j],
  235. rstyle = r.style;
  236. rstyle.left = (j % 4) * blockSize + 'px';
  237. rstyle.bottom = Math.floor(j / 4) * blockSize + 'px';
  238. rstyle.width = blockSize + 'px';
  239. rstyle.height = blockSize + 'px';
  240. r.className = r.className.replace(_clearttClsReg, '');
  241. if (i == j) {
  242. _gameBBList.push({ cell: i % 4, id: r.id });
  243. r.className += ' t' + (Math.floor(Math.random() * 1000) % 5 + 1);
  244. r.notEmpty = true;
  245. i = (Math.floor(j / 4) + 1) * 4 + Math.floor(Math.random() * 1000) % 4;
  246. } else {
  247. r.notEmpty = false;
  248. }
  249. }
  250. if (loop) {
  251. box.style.webkitTransitionDuration = '0ms';
  252. box.style.display = 'none';
  253. box.y = -blockSize * (Math.floor(box.children.length / 4) + (offset || 0)) * loop;
  254. setTimeout(function () {
  255. box.style[transform] = 'translate3D(0,' + box.y + 'px,0)';
  256. setTimeout(function () {
  257. box.style.display = 'block';
  258. }, 100);
  259. }, 200);
  260. } else {
  261. box.y = 0;
  262. box.style[transform] = 'translate3D(0,' + box.y + 'px,0)';
  263. }
  264. box.style[transitionDuration] = '150ms';
  265. }
  266. function gameLayerMoveNextRow() {
  267. for (var i = 0; i < GameLayer.length; i++) {
  268. var g = GameLayer[i];
  269. g.y += blockSize;
  270. if (g.y > blockSize * (Math.floor(g.children.length / 4))) {
  271. refreshGameLayer(g, 1, -1);
  272. } else {
  273. g.style[transform] = 'translate3D(0,' + g.y + 'px,0)';
  274. }
  275. }
  276. }
  277. function gameTapEvent(e) {
  278. if (_gameOver) {
  279. return false;
  280. }
  281. var tar = e.target;
  282. var y = e.clientY || e.targetTouches[0].clientY,
  283. x = (e.clientX || e.targetTouches[0].clientX) - body.offsetLeft,
  284. p = _gameBBList[_gameBBListIndex];
  285. if (y > touchArea[0] || y < touchArea[1]) {
  286. return false;
  287. }
  288. if ((p.id == tar.id && tar.notEmpty) || (p.cell == 0 && x < blockSize) || (p.cell == 1 && x > blockSize && x < 2 * blockSize) || (p.cell == 2 && x > 2 * blockSize && x < 3 * blockSize) || (p.cell == 3 && x > 3 * blockSize)) {
  289. if (!_gameStart) {
  290. gameStart();
  291. }
  292. createjs.Sound.play("tap");
  293. tar = document.getElementById(p.id);
  294. tar.className = tar.className.replace(_ttreg, ' tt$1');
  295. _gameBBListIndex++;
  296. _gameScore++;
  297. gameLayerMoveNextRow();
  298. } else if (_gameStart && !tar.notEmpty) {
  299. createjs.Sound.play("err");
  300. gameOver();
  301. tar.className += ' bad';
  302. }
  303. return false;
  304. }
  305. function createGameLayer() {
  306. var html = '<div id="GameLayerBG">';
  307. for (var i = 1; i <= 2; i++) {
  308. var id = 'GameLayer' + i;
  309. html += '<div id="' + id + '" class="GameLayer">';
  310. for (var j = 0; j < 10; j++) {
  311. for (var k = 0; k < 4; k++) {
  312. html += '<div id="' + id + '-' + (k + j * 4) + '" num="' + (k + j * 4) + '" class="block' + (k ? ' bl' : '') + '"></div>';
  313. }
  314. }
  315. html += '</div>';
  316. }
  317. html += '</div>';
  318. html += '<div id="GameTimeLayer"></div>';
  319. return html;
  320. }
  321. function closeWelcomeLayer() {
  322. var l = document.getElementById('welcome');
  323. l.style.display = 'none';
  324. }
  325. function showWelcomeLayer() {
  326. var l = document.getElementById('welcome');
  327. l.style.display = 'block';
  328. }
  329. function showGameScoreLayer() {
  330. var l = document.getElementById('GameScoreLayer');
  331. var c = document.getElementById(_gameBBList[_gameBBListIndex - 1].id).className.match(_ttreg)[1];
  332. l.className = l.className.replace(/bgc\d/, 'bgc' + c);
  333. document.getElementById('GameScoreLayer-text').innerHTML = shareText(_gameScore);
  334. document.getElementById('GameScoreLayer-score').innerHTML = '得分&nbsp;&nbsp;' + _gameScore;
  335. var bast = cookie('bast-score');
  336. if (!bast || _gameScore > bast) {
  337. bast = _gameScore;
  338. cookie('bast-score', bast, 100);
  339. }
  340. document.getElementById('GameScoreLayer-bast').innerHTML = '最佳&nbsp;&nbsp;' + bast;
  341. l.style.display = 'block';
  342. window.shareData.tTitle =document.title= '中秋佳节,点花灯许心愿,我点燃了' + _gameScore + '盏灯,设定人生小目标!'
  343. }
  344. function hideGameScoreLayer() {
  345. var l = document.getElementById('GameScoreLayer');
  346. l.style.display = 'none';
  347. }
  348. function replayBtn() {
  349. gameRestart();
  350. hideGameScoreLayer();
  351. }
  352. function backBtn() {
  353. gameRestart();
  354. hideGameScoreLayer();
  355. showWelcomeLayer();
  356. }
  357. function shareText(score) {
  358. if (score <= 49)
  359. return '一共点燃了'+score+'盏花灯!<br/>亲爱的,好厉害!';
  360. if (score <= 99)
  361. return '酷!一共点燃了'+score+'盏花灯!<br/>好棒哦!';
  362. if (score <= 149)
  363. return '帅呆了!一共点燃了'+score+'盏花灯!!<br/>太正经了!';
  364. if (score <= 199)
  365. return '太牛了!一共点燃了'+score+'盏花灯<br/>不是一般人!';
  366. return '膜拜ing!一共点燃了'+score+'盏花灯!!<br/>亲,我想你不是地球人!再也没人能超越你了!';
  367. }
  368. function toStr(obj) {
  369. if (typeof obj == 'object') {
  370. return JSON.stringify(obj);
  371. } else {
  372. return obj;
  373. }
  374. return '';
  375. }
  376. function cookie(name, value, time) {
  377. if (name) {
  378. if (value) {
  379. if (time) {
  380. var date = new Date();
  381. date.setTime(date.getTime() + 864e5 * time), time = date.toGMTString();
  382. }
  383. return document.cookie = name + "=" + escape(toStr(value)) + (time ? "; expires=" + time + (arguments[3] ? "; domain=" + arguments[3] + (arguments[4] ? "; path=" + arguments[4] + (arguments[5] ? "; secure" : "") : "") : "") : ""), !0;
  384. }
  385. return value = document.cookie.match("(?:^|;)\\s*" + name.replace(/([-.*+?^${}()|[\]\/\\])/g, "\\$1") + "=([^;]*)"), value = value && "string" == typeof value[1] ? unescape(value[1]) : !1, (/^(\{|\[).+\}|\]$/.test(value) || /^[0-9]+$/g.test(value)) && eval("value=" + value), value;
  386. }
  387. var data = {};
  388. value = document.cookie.replace(/\s/g, "").split(";");
  389. for (var i = 0; value.length > i; i++) name = value[i].split("="), name[1] && (data[name[0]] = unescape(name[1]));
  390. return data;
  391. }
  392. document.write(createGameLayer());
  393. function share() {
  394. document.getElementById('share-wx').style.display = 'block';
  395. document.getElementById('share-wx').onclick = function () {
  396. this.style.display = 'none';
  397. };
  398. }
  399. document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
  400. WeixinJSBridge.on('menu:share:appmessage', function (argv) {
  401. WeixinJSBridge.invoke('sendAppMessage', {
  402. "img_url": window.shareData.imgUrl,
  403. "link": window.shareData.timeLineLink,
  404. "desc": window.shareData.tContent,
  405. "title": window.shareData.tTitle
  406. }, function (res) {
  407. document.location.href = mebtnopenurl;
  408. })
  409. });
  410. WeixinJSBridge.on('menu:share:timeline', function (argv) {
  411. WeixinJSBridge.invoke('shareTimeline', {
  412. "img_url": window.shareData.imgUrl,
  413. "img_width": "640",
  414. "img_height": "640",
  415. "link": window.shareData.timeLineLink,
  416. "desc": window.shareData.tContent,
  417. "title": window.shareData.tTitle
  418. }, function (res) {
  419. document.location.href = mebtnopenurl;
  420. });
  421. });
  422. }, false);
  423. </script>
  424. <div style="display: none">
  425. <img width="100%" height="100%" src="share.png"
  426. style="position: fixed; z-index: 9999; top: 0; left: 0;" />
  427. </div>
  428. <div id="GameScoreLayer" class="BBOX SHADE bgc1" style="display:none;background:url(img/bg_01.png); ">
  429. <div style="padding:0 5%;">
  430. <div id="GameScoreLayer-text"></div>
  431. <br/>
  432. <div id="GameScoreLayer-score" style="margin-bottom:1em;">得分</div>
  433. <div id="GameScoreLayer-bast">最佳</div>
  434. <br/>
  435. <div id="GameScoreLayer-btn" class="BOX">
  436. <div class="btn BOX-S" onClick="replayBtn()">重来</div>&nbsp;
  437. <div class="btn BOX-S" onClick="share()">分享到朋友圈</div>&nbsp;
  438. </div>
  439. <br/>
  440. <div id="GameScoreLayer-share" class="BOX">
  441. <div id="mebtn" class="btn BOX-S" ><a href="http://mp.weixin.qq.com/s?__biz=MzI4MjA2MjE0MQ==&mid=246005295&idx=1&sn=490f8141976d607ba079d48f52a3fcd7#rd">点我关注</a></div>
  442. </div>
  443. <br>
  444. <div id="GameScoreLayer-share" class="BOX">
  445. </div>
  446. </div>
  447. </div>
  448. <div id="welcome" class="SHADE BOX-M">
  449. <div class="welcome-bg FILL"></div>
  450. <div class="FILL BOX-M" style="position:absolute;top:0;left:0;right:0;bottom:0;z-index:5;">
  451. <div style="margin:0 8% 0 9%;">
  452. <div style="font-size:2.0em; color:#FEF002;">佳节到,点花灯</div><br/>
  453. <div style="font-size:1.8em; color:#fff; line-height:1.5em;">从离你最近的花灯开始,<br/>20秒内看你能点燃多少个花灯!<br/><br/></div><br/><br/>
  454. <div id="ready-btn" class="btn loading" style="display:inline-block; margin:0 auto; width:8em; height:1.7em; line-height:1.7em; font-size:1.9em; color:#fff;"></div>
  455. <div><img src="img/mei.png" width="60%"></div>
  456. <br/><br/>
  457. </div>
  458. </div>
  459. </div>
  460. <div id="landscape" class="SHADE BOX-M" style="background:rgba(0,0,0,.9);">
  461. <div class="welcome-bg FILL"></div>
  462. <div id="landscape-text" style="color:#fff;font-size:3em;">请竖屏玩耍</div>
  463. </div>
  464. <div id="share-wx"><p style="text-align: right; padding-left: 10px;"><img src="img/2000.png" id="share-wx-img" style="max-width: 280px; padding-right: 25px;"></p></div>
  465. <script type="text/javascript">
  466. if (isDesktop)
  467. document.write('</div>');
  468. </script>
  469. <script src="res/js/init.js"></script>
  470. <script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
  471. <script type="text/javascript">
  472. /*
  473. * 开发参考文档见:
  474. * http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html
  475. */
  476. // 分享地址
  477. var shareurl = 'http://www.0550weixin.com';
  478. // 分享图标
  479. var imgUrl = 'http://www.0550weixin.com/02.jpg';
  480. // 分享标题
  481. var stitle = "(●—●)装扮地球";
  482. // 分享内容
  483. var scontent = "分数越高,即有机会获得西瓜汁以及周边奖品哦";
  484. wx.config({
  485. debug: false,
  486. appId: 'wxe5c0e0e90e6cff12',
  487. timestamp: '1433229987',
  488. nonceStr: 'BH5zmFRv9AD0XheV',
  489. signature: '1a59fc95af172259af3ac9d613f02f3f28db1224',
  490. jsApiList: [
  491. // 所有要调用的 API 都要加到这个列表中
  492. 'checkJsApi',
  493. 'onMenuShareTimeline',
  494. 'onMenuShareAppMessage',
  495. ]
  496. });
  497. wx.ready(function () {
  498. setShare();
  499. });
  500. function setShare(){
  501. wx.onMenuShareTimeline({
  502. title: stitle, // 分享标题
  503. link: shareurl, // 分享链接
  504. imgUrl: imgUrl, // 分享图标
  505. success: function () {
  506. // 用户确认分享后执行的回调函数
  507. },
  508. cancel: function () {
  509. // 用户取消分享后执行的回调函数
  510. }
  511. });
  512. wx.onMenuShareAppMessage({
  513. title: stitle, // 分享标题
  514. desc: scontent, // 分享描述
  515. link:shareurl, // 分享链接
  516. imgUrl: imgUrl, // 分享图标
  517. type: 'link', // 分享类型,music、video或link,不填默认为link
  518. dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
  519. success: function () {
  520. // 用户确认分享后执行的回调函数
  521. },
  522. cancel: function () {
  523. // 用户取消分享后执行的回调函数
  524. }
  525. });
  526. }
  527. </script>
  528. <script type="text/javascript" src="http://tajs.qq.com/stats?sId=36313548" charset="UTF-8"></script></body>
  529. </html>