index.html 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
  6. <link rel="icon" type="image/GIF" href="res/favicon.ico"/>
  7. <meta http-equiv="cache-control" content="no-cache">
  8. <meta name="viewport" content="user-scalable=no" />
  9. <meta name="apple-mobile-web-app-capable" content="yes"/>
  10. <meta name="full-screen" content="yes"/>
  11. <meta name="screen-orientation" content="portrait"/>
  12. <meta name="x5-fullscreen" content="true"/>
  13. <meta name="360-fullscreen" content="true"/>
  14. <title>他是小三吗?</title>
  15. <script type="text/javascript" src="static/cocos2d-3.0rc1.canvas.v2.min.js"></script>
  16. <style type="text/css">
  17. #promot {
  18. height: 50px;
  19. text-align: center;
  20. width: 100%;
  21. position:absolute;
  22. bottom:0px;
  23. z-index: 10;
  24. opacity: 0;
  25. }
  26. </style>
  27. </head>
  28. <body>
  29. <canvas id="gameCanvas" width="480" height="800" style="background:#fff"></canvas>
  30. <script src="static/weixinapi.min.js?1"></script>
  31. <script type="text/javascript">
  32. window.onload = function(){
  33. cc.game.onStart = function(){
  34. cc.view.enableAutoFullScreen(false);
  35. cc.view.setDesignResolutionSize(720, 1280, cc.ResolutionPolicy.SHOW_ALL);
  36. cc.view.resizeWithBrowserSize(false);
  37. cc.director.setDisplayStats(cc.game.config.showFPS);
  38. //load resources
  39. cc._loaderImage = "";
  40. cc.LoaderScene.preload(['res/imgs.json', 'static/imgs.png'], function () {
  41. cc.spriteFrameCache.addSpriteFrames('res/imgs.json', 'static/imgs.png');
  42. cc.director.runScene(new HelloWorldScene());
  43. document.getElementById('promot').style.opacity = 1;
  44. }, this);
  45. };
  46. cc.game.run("gameCanvas");
  47. };
  48. window.shareData = {
  49. "imgUrl": "http://t2.qpic.cn/mblogpic/a6296814b8456a310c90/80",
  50. "timeLineLink": "http://game.ikongzhong.cn/games/xiaosan/",
  51. "tTitle": "斗小三,打流氓,看你能消灭几个小三,一起来打吧!",
  52. "tContent": "斗小三,打流氓,看你能消灭几个小三,一起来打吧!"
  53. };
  54. var mebtnopenurl = 'http://game.ikongzhong.cn';
  55. document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
  56. WeixinJSBridge.on('menu:share:appmessage', function(argv) {
  57. WeixinJSBridge.invoke('sendAppMessage', {
  58. "img_url": window.shareData.imgUrl,
  59. "link": window.shareData.timeLineLink,
  60. "desc": window.shareData.tContent,
  61. "title": window.shareData.tTitle
  62. }, function(res) {
  63. document.location.href = mebtnopenurl;
  64. })
  65. });
  66. WeixinJSBridge.on('menu:share:timeline', function(argv) {
  67. WeixinJSBridge.invoke('shareTimeline', {
  68. "img_url": window.shareData.imgUrl,
  69. "img_width": "640",
  70. "img_height": "640",
  71. "link": window.shareData.timeLineLink,
  72. "desc": window.shareData.tContent,
  73. "title": window.shareData.tTitle
  74. }, function(res) {
  75. document.location.href = mebtnopenurl;
  76. });
  77. });
  78. WeixinJSBridge.on('menu:share:weibo', function(argv) {
  79. WeixinJSBridge.invoke('shareWeibo', {
  80. "content": window.shareData.tContent,
  81. "url": window.shareData.timeLineLink
  82. }, function(res) {
  83. document.location.href = mebtnopenurl;
  84. });
  85. });
  86. }, false);
  87. </script>
  88. </body>
  89. </html>