HTML5小游戏代码大全
由于长度原因我将以资源方式上传,本文为例子.1.20482.暴打神经猫
·
由于长度原因我将以资源方式上传,本文为例子.
1.2048
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>分享2048到朋友圈,将免费参加南山郡8.17号啤酒狂欢节!</title>
<link href="style/main.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="favicon.ico">
<link rel="apple-touch-icon" href="meta/apple-touch-icon.png">
<link rel="apple-touch-startup-image" href="meta/apple-touch-startup-image-640x1096.png" media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)"> <!-- iPhone 5+ -->
<link rel="apple-touch-startup-image" href="meta/apple-touch-startup-image-640x920.png" media="(device-width: 320px) and (device-height: 480px) and (-webkit-device-pixel-ratio: 2)"> <!-- iPhone, retina -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, target-densitydpi=160dpi, initial-scale=1.0, maximum-scale=1, user-scalable=no, minimal-ui">
</head>
<script>
lastScrollY=0;
function heartBeat(){
var diffY;
if (document.documentElement && document.documentElement.scrollTop)
diffY = document.documentElement.scrollTop;
else if (document.body)
diffY = document.body.scrollTop
else
{/*Netscape stuff*/}
percent=.1*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.getElementById("full").style.top=parseInt(document.getElementById("full").style.top)+percent+"px";
lastScrollY=lastScrollY+percent;
}
suspendcode="<div id=\"full\" style='right:15px;POSITION:absolute;TOP:150px;z-index:100'><a href='tel:18857911858'><img src=top.jpg border=0 alt='返回顶部'></a><br></div>"<!--此处修改右侧联系电话-->
document.write(suspendcode);
window.setInterval("heartBeat()",1);
</script>
<body>
<div class="container">
<div class="heading">
<h1 class="title">2048</h1>
<div class="scores-container">
<div class="score-container">0</div>
<div class="best-container">0</div>
</div>
</div>
<div class="above-game">
<p class="game-intro"><a href="http://mp.weixin.qq.com/s?__biz=MjM5ODMzMjk5Nw==&mid=200442232&idx=1&sn=bb981cf0ec10bc9bf28f24179744f511&from=singlemessage&isappinstalled=0#rd" target="_blank"><img src="140x50.png" width="140" height="50" longdesc="http://game2.id87.com/"></a></p><!--此处可改成你们自己的链接-->
<a class="restart-button">点我开始</a>
</div>
<div class="game-container">
<div class="game-message">
<p></p>
<div class="lower">
<a class="keep-playing-button">Keep going</a>
<a class="retry-button">再玩一次</a>
</div>
</div>
<div class="grid-container">
<div class="grid-row">
<div class="grid-cell"></div>
<div class="grid-cell"></div>
<div class="grid-cell"></div>
<div class="grid-cell"></div>
</div>
<div class="grid-row">
<div class="grid-cell"></div>
<div class="grid-cell"></div>
<div class="grid-cell"></div>
<div class="grid-cell"></div>
</div>
<div class="grid-row">
<div class="grid-cell"></div>
<div class="grid-cell"></div>
<div class="grid-cell"></div>
<div class="grid-cell"></div>
</div>
<div class="grid-row">
<div class="grid-cell"></div>
<div class="grid-cell"></div>
<div class="grid-cell"></div>
<div class="grid-cell"></div>
</div>
</div>
<div class="tile-container">
</div>
</div>
<hr>
<p><strong><a href="整人网站.html" target="_blank">H.K.工作室提供支持</a></strong></p><!--此处可改成你们自己的链接-->
<p><strong>玄元南山郡首期8月17日盛大开盘,关注xynsj0579免费参加安地楼盘现场的啤酒节!</strong></p>
</div>
<script><!--此处可分值和等级名称-->
var my_list = {2:'九头虫',4:'白龙马',8:'沙僧',16:'猪八戒',32:'孙悟空',64:'唐僧',128:'观音',256:'弥勒佛',512:'上老君',1024:'如来佛',2048:'神笔记',4096:'http://iduanzi.qiniudn.com/tuoguang/4096.jpg',8192:'http://iduanzi.qiniudn.com/tuoguang/8192.jpg',16384:'http://iduanzi.qiniudn.com/tuoguang/16384.jpg',32768:'32768',65536:'65536',131072:'131072',262144:'262144',524288:'524288',1048576:'1048576',2097152:'2097152',4194304:'4194304',8388608:'8388608',16777216:'16777216',33554432:'33554432',67108864:'67108864',134217728:'134217728',268435456:'268435456',536870912:'536870912',1073741824:'1073741824',2147483648:'2147483648'}
var my_mark = {2:'快来变身吧!',4:'小白马就挂了!',8:'沙和尚,是你吗',16:'对小猪就是你!',32:'悟空,等等我!',64:'打雷啦,收衣服啦',128:'普渡众生!',256:'阿弥托福!',512:'你这泼猴,不像话!',1024:'五指山压死你',2048:'恭喜!终于见到本尊了! ',4096:'强者!太伟大了!',8192:'你有这么厉害呀!',16384:'你已跳出三界之外了!',32768:'Game Over, HiScore: 32768',65536:'Game Over, HiScore: 65536',131072:'Game Over, HiScore: 131072',262144:'Game Over, HiScore: 262144',524288:'Game Over, HiScore: 524288',1048576:'Game Over, HiScore: 1048576',2097152:'Game Over, HiScore: 2097152',4194304:'Game Over, HiScore: 4194304',8388608:'Game Over, HiScore: 8388608',16777216:'Game Over, HiScore: 16777216',33554432:'Game Over, HiScore: 33554432',67108864:'Game Over, HiScore: 67108864',134217728:'Game Over, HiScore: 134217728',268435456:'Game Over, HiScore: 268435456',536870912:'Game Over, HiScore: 536870912',1073741824:'Game Over, HiScore: 1073741824',2147483648:'Game Over, HiScore: 2147483648'}
var my_goal = 1024;
</script> <script src="js/bind_polyfill.js"></script>
<script src="js/classlist_polyfill.js"></script>
<script src="js/animframe_polyfill.js"></script>
<script src="js/keyboard_input_manager.js"></script>
<script src="js/html_actuator.js"></script>
<script src="js/grid.js"></script>
<script src="js/tile.js"></script>
<script src="js/local_storage_manager.js"></script>
<script src="js/game_manager.js"></script>
<script src="js/application.js"></script>
</body>
</html>
2.暴打神经猫
<!DOCTYPE html>
<html>
<head>
<title>暴打神经猫</title>
<meta charset="utf-8"/>
<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"/>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/createjs.js"></script>
<script type="text/javascript">
var i = new Date().getTime() % 5;
var isDesktop = navigator['userAgent'].match(/(ipad|iphone|ipod|android|windows phone)/i) ? false : true;
var fontunit = isDesktop ? 20 : ((window.innerWidth>window.innerHeight?window.innerHeight:window.innerWidth)/320)*10;
document.write('<style type="text/css">'+
'html,body {font-size:'+(fontunit<30?fontunit:'30')+'px;}'+
(isDesktop?'#welcome,#GameTimeLayer,#GameLayerBG,#GameScoreLayer.SHADE{position: absolute;}':
'#welcome,#GameTimeLayer,#GameLayerBG,#GameScoreLayer.SHADE{position:fixed;}@media screen and (orientation:landscape) {#landscape {display: box; display: -webkit-box; display: -moz-box; display: -ms-flexbox;}}')+
'</style>');
</script>
<style type="text/css">
body {font-family: "Helvetica Neue", Helvetica, STHeiTi, sans-serif; margin: 0; padding: 0;}
.loading {background-image: url("images/loding.gif");
background-repeat: no-repeat;
background-position: center center;
background-size: auto 60%;
}
.SHADE {top: 0; left:0; width:100%; height: 100%; bottom:0; z-index: 11;}
.BOX-V {box-orient: vertical;-webkit-box-orient: vertical; -moz-box-orient: vertical;-ms-flex-direction:column;}
.BOX-D {box-align: end; box-pack: center -webkit-box-align: end; -webkit-box-pack: center; -ms-flex-align:end; -ms-flex-pack:center;}
.BOX-M {box-align: center;box-pack: center; -webkit-box-align: center; -webkit-box-pack: center; -ms-flex-align:center; -ms-flex-pack:center;}
.BOX-S {display:block; box-flex:1; -webkit-box-flex:1; -moz-box-flex:1;-ms-flex:1;}
.BOX ,.BOX-V,.BOX-D,.BOX-M, .FOOTER{display: box; display: -webkit-box; display: -moz-box; display: -ms-flexbox;}
.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;}
#welcome { background-color:rgba(0,0,0,.8); text-align: center; font-weight: bold;overflow: hidden;}
.welcome-bg {position:absolute;top:0;left:0;right:0;bottom:0; background: url(images/bing.jpg) center center no-repeat; background-size:100% 100%; opacity: .4;overflow: hidden;}
#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;}
#GameLayerBG {top:0;left:0;right:0;bottom:0;overflow:hidden;background:#fff;}
.GameLayer {position:absolute;bottom:0;left:0;}
.block {position:absolute;border-top:1px solid #333; background-repeat: no-repeat; background-position: center;}
.block{background-image:url(images/em.jpg);}
.t1,.t2,.t3,.t4,.t5 { background-size:auto 98%;background-image:url(images/tt0.jpg);}
.t3,.t4 {background-image:url(images/tt1.jpg);}
.t5 {background-image:url(images/tt2.jpg);}
.tt1,.tt2,.tt3,.tt4,.tt5 { background-size:auto 96%;background-image:url(images/jiao.jpg);}
.tt1,.tt2{background-image:url(images/j1.jpg);}
.tt3,.tt4{background-image:url(images/j2.jpg);}
.bt{display:block;padding:20px;background:#999;color:#000;text-decoration:none;margin:25px;}
a.bt{background:#FC0;}
.bl {border-left:1px solid #333;}
@-ms-keyframes flash {
0% { opacity: 1; }
50% { opacity: 0; }
100% { opacity: 1; }
}
@-webkit-keyframes flash {
0% { opacity: 1; }
50% { opacity: 0; }
100% { opacity: 1; }
}
.flash {-webkit-animation: flash .2s 3;animation: flash .2s 3;}
.bad {background-color:#000;background-size:90%;background-image:url(images/bad.jpg); -webkit-animation: flash .2s 3;animation: flash .2s 3;}
* {-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;}
#GameScoreLayer {background-position:center .5em; background-size: auto 4em; padding-top:3em; font-size:2em; font-weight: bold; color:#fff; text-align: center;overflow: hidden;}
.bgc1 { background-color: #23378B;}
.bgc2 { background-color: #009FE3;}
.bgc3 { background-color: #E42313;}
.bgc4 { background-color: #FCBD1B;}
.bgc5 { background-color: #34002A;}
.share-icon {width:1.7em; background-repeat:no-repeat; background-size: auto 100%;}
#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;}
.btn:active {opacity: 0.2;}
#landscape {display: none;}
#gameBody {position: relative; width: 640px; margin: 0 auto; height: 100%;}
#share-wx {
background: rgba(0,0,0,0.8);
position: absolute;
top: 0px;
left: 0px;
width: 100%;
height: 100%;
z-index: 10000;
display: none;
}
</style>
</head>
<body>
<script type="text/javascript">
window.shareData = {
"imgUrl": "http://app.46465.com/html5/bdsjm/images/dbsjm.jpg",
"timeLineLink": "http://app.46465.com/html5/bdsjm/",
"tTitle": "暴打神经猫",
"tContent": "朋友圈被神经猫刷屏?快来暴打神经猫!"
};
if (isDesktop)
document.write('<div id="gameBody">');
var body, blockSize, GameLayer = [], GameLayerBG, touchArea = [], GameTimeLayer;
var transform, transitionDuration;
function init (argument) {
showWelcomeLayer();
body = document.getElementById('gameBody') || document.body;
body.style.height = window.innerHeight+'px';
transform = typeof(body.style.webkitTransform) != 'undefined' ? 'webkitTransform' : (typeof(body.style.msTransform) != 'undefined'?'msTransform':'transform');
transitionDuration = transform.replace(/ransform/g, 'ransitionDuration');
GameTimeLayer = document.getElementById('GameTimeLayer');
GameLayer.push( document.getElementById('GameLayer1') );
GameLayer[0].children = GameLayer[0].querySelectorAll('div');
GameLayer.push( document.getElementById( 'GameLayer2' ) );
GameLayer[1].children = GameLayer[1].querySelectorAll('div');
GameLayerBG = document.getElementById( 'GameLayerBG' );
if( GameLayerBG.ontouchstart === null ){
GameLayerBG.ontouchstart = gameTapEvent;
}else{
GameLayerBG.onmousedown = gameTapEvent;
document.getElementById('landscape-text').innerHTML = '点我开始玩耍';
document.getElementById('landscape').onclick = winOpen;
}
gameInit();
window.addEventListener('resize', refreshSize, false);
setTimeout(function(){
var btn = document.getElementById('ready-btn');
btn.className = 'btn';
btn.innerHTML = ' 预备,上!'
btn.style.backgroundColor = '#F00';
btn.onclick = function(){
closeWelcomeLayer();
}
}, 500);
}
function winOpen() {
window.open(location.href+'?r='+Math.random(), 'nWin', 'height=500,width=320,toolbar=no,menubar=no,scrollbars=no');
var opened=window.open('about:blank','_self'); opened.opener=null; opened.close();
}
var refreshSizeTime;
function refreshSize(){
clearTimeout(refreshSizeTime);
refreshSizeTime = setTimeout(_refreshSize, 200);
}
function _refreshSize(){
countBlockSize();
for( var i=0; i<GameLayer.length; i++ ){
var box = GameLayer[i];
for( var j=0; j<box.children.length; j++){
var r = box.children[j],
rstyle = r.style;
rstyle.left = (j%4)*blockSize+'px';
rstyle.bottom = Math.floor(j/4)*blockSize+'px';
rstyle.width = blockSize+'px';
rstyle.height = blockSize+'px';
}
}
var f, a;
if( GameLayer[0].y > GameLayer[1].y ){
f = GameLayer[0];
a = GameLayer[1];
}else{
f = GameLayer[1];
a = GameLayer[0];
}
var y = ((_gameBBListIndex)%10)*blockSize;
f.y = y;
f.style[transform] = 'translate3D(0,'+f.y+'px,0)';
a.y = -blockSize*Math.floor(f.children.length/4)+y;
a.style[transform] = 'translate3D(0,'+a.y+'px,0)';
}
function countBlockSize(){
blockSize = body.offsetWidth/4;
body.style.height = window.innerHeight+'px';
GameLayerBG.style.height = window.innerHeight+'px';
touchArea[0] = window.innerHeight-blockSize*0;
touchArea[1] = window.innerHeight-blockSize*3;
}
var _gameBBList = [], _gameBBListIndex = 0, _gameOver = false, _gameStart = false, _gameTime, _gameTimeNum, _gameScore;
function gameInit(){
createjs.Sound.registerSound( {src:"audio/nima.mp3", id:"err"} );
createjs.Sound.registerSound( {src:"audio/end.mp3", id:"end"} );
createjs.Sound.registerSound( {src:"audio/type.mp3", id:"tap"} );
gameRestart();
}
function gameRestart(){
console.log('gameRestart');
_gameBBList = [];
_gameBBListIndex = 0;
_gameScore = 0;
_gameOver = false;
_gameStart = false;
_gameTimeNum = 3000;
GameTimeLayer.innerHTML = creatTimeText(_gameTimeNum);
countBlockSize();
refreshGameLayer(GameLayer[0]);
refreshGameLayer(GameLayer[1], 1);
}
function gameStart(){
_gameStart = true;
_gameTime = setInterval(gameTime,30);
}
function gameOver(){
_gameOver = true;
clearInterval(_gameTime);
setTimeout(function(){
GameLayerBG.className = '';
showGameScoreLayer();
}, 1500);
}
function gameTime(){
_gameTimeNum --;
if( _gameTimeNum <= 0){
GameTimeLayer.innerHTML = ' 时间到!';
gameOver();
GameLayerBG.className += ' flash';
createjs.Sound.play("end");
}else{
GameTimeLayer.innerHTML = creatTimeText(_gameTimeNum);
}
}
function creatTimeText( n ){
var text = (100000+n+'').substr(-4,4);
text = ' '+text.substr(0,2)+"'"+text.substr(2)+"''"
return text;
}
var _ttreg = / t{1,2}(\d+)/, _clearttClsReg = / t{1,2}\d+| bad/;
function refreshGameLayer( box, loop, offset ){
var i = Math.floor(Math.random()*1000)%4+(loop?0:4);
for( var j=0; j<box.children.length; j++){
var r = box.children[j],
rstyle = r.style;
rstyle.left = (j%4)*blockSize+'px';
rstyle.bottom = Math.floor(j/4)*blockSize+'px';
rstyle.width = blockSize+'px';
rstyle.height = blockSize+'px';
r.className = r.className.replace(_clearttClsReg, '');
if( i == j ){
_gameBBList.push( {cell:i%4, id:r.id} );
r.className += ' t'+(Math.floor(Math.random()*1000)%5+1);
r.notEmpty = true;
i = ( Math.floor(j/4)+1)*4+Math.floor(Math.random()*1000 )%4;
}else{
r.notEmpty = false;
}
}
if( loop ){
box.style.webkitTransitionDuration = '0ms';
box.style.display = 'none';
box.y = -blockSize*(Math.floor(box.children.length/4)+(offset||0))*loop;
setTimeout(function(){
box.style[transform] = 'translate3D(0,'+box.y+'px,0)';
setTimeout( function(){
box.style.display = 'block';
}, 100 );
}, 200 );
} else {
box.y = 0;
box.style[transform] = 'translate3D(0,'+box.y+'px,0)';
}
box.style[transitionDuration] = '150ms';
}
function gameLayerMoveNextRow(){
for(var i=0; i<GameLayer.length; i++){
var g = GameLayer[i];
g.y += blockSize;
if( g.y > blockSize*(Math.floor(g.children.length/4)) ){
refreshGameLayer(g, 1, -1);
}else{
g.style[transform] = 'translate3D(0,'+g.y+'px,0)';
}
}
}
function gameTapEvent(e){
if (_gameOver) {
return false;
}
var tar = e.target;
var y = e.clientY || e.targetTouches[0].clientY,
x = (e.clientX || e.targetTouches[0].clientX)-body.offsetLeft,
p = _gameBBList[_gameBBListIndex];
if ( y > touchArea[0] || y < touchArea[1] ) {
return false;
}
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) ){
if( !_gameStart ){
gameStart();
}
createjs.Sound.play("tap");
tar = document.getElementById(p.id);
tar.className = tar.className.replace(_ttreg, ' tt$1');
_gameBBListIndex++;
_gameScore ++;
gameLayerMoveNextRow();
}else if( _gameStart && !tar.notEmpty ){
createjs.Sound.play("err");
gameOver();
tar.className += ' bad';
}
return false;
}
function createGameLayer(){
var html = '<div id="GameLayerBG">';
for(var i=1; i<=2; i++){
var id = 'GameLayer'+i;
html += '<div id="'+id+'" class="GameLayer">';
for(var j=0; j<10; j++ ){
for(var k=0; k<4; k++){
html += '<div id="'+id+'-'+(k+j*4)+'" num="'+(k+j*4)+'" class="block'+(k?' bl':'')+'"></div>';
}
}
html += '</div>';
}
html += '</div>';
html += '<div id="GameTimeLayer"></div>';
return html;
}
function closeWelcomeLayer(){
var l = document.getElementById('welcome');
l.style.display = 'none';
}
function showWelcomeLayer(){
var l = document.getElementById('welcome');
l.style.display = 'block';
}
function showGameScoreLayer(){
var l = document.getElementById('GameScoreLayer');
var c = document.getElementById(_gameBBList[_gameBBListIndex-1].id).className.match(_ttreg)[1];
l.className = l.className.replace(/bgc\d/, 'bgc'+c);
document.getElementById('GameScoreLayer-text').innerHTML = shareText(_gameScore);
document.getElementById('GameScoreLayer-score').innerHTML = '得分 '+_gameScore;
var bast = cookie('bast-score');
if( !bast || _gameScore > bast ){
bast = _gameScore;
cookie('bast-score', bast, 100);
}
document.getElementById('GameScoreLayer-bast').innerHTML = '最佳 '+bast;
l.style.display = 'block';
window.shareData.tTitle = '我打爆'+_gameScore+'只神经猫,不服来挑战!!!';
var l = document.getElementById('adhtml').innerHTML;
document.getElementById('ad').innerHTML = l;
document.getElementById('ad1').innerHTML = l;
}
function showEnd(){
var l = document.getElementById('GameScoreLayer-share');
l.style.display = 'block';
document.getElementById('share-wx').style.display = 'none';
}
function hideGameScoreLayer(){
var l = document.getElementById('GameScoreLayer');
l.style.display = 'none';
}
function replayBtn(){
gameRestart();
hideGameScoreLayer();
}
function backBtn(){
gameRestart();
hideGameScoreLayer();
showWelcomeLayer();
}
var mebtnopenurl = 'http://game.apiwck.com/wxgame/';
function shareText( score ){
var num = parseInt(Math.random()*100) ;
var percent = parseInt(score/1.2);
if(percent > 100 ) percent = 99;
var txt1 = "排名第"+ num +"位,击败了"+ percent + "% 的人";
if( score <= 69 )
return '呵呵!打爆'+score+'只神经猫!<br/>'+txt1+ '<br/>亲,得加油哦。朋友圈神经猫已经泛滥了!';
if( score <= 269 )
return '酷!打爆'+score+'只神经猫!<br/>'+txt1+ '<br/>亲,你好棒哦。';
if( score <= 319 )
return '帅呆了!打爆'+score+'只神经猫!<br/>'+txt1+ '<br/>爱死你了,朋友圈终于清净了!';
if( score <= 400 )
return '太牛了!打爆'+score+'只神经猫!<br/>'+txt1+ '<br/>你是我见过最棒的,你击败了全国百分之99的蛇精病,奥巴马和金正恩都惊呆了!';
return '膜拜ing!打爆'+score+'只神经猫!<br/> 战胜了神经病院 99% 的人,全球排名第1 <br/>你是宇宙第一强人,再也没人能超越你了!';
}
function toStr(obj) {
if ( typeof obj == 'object' ) {
return JSON.stringify(obj);
} else {
return obj;
}
return '';
}
function cookie(name, value, time) {
if (name) {
if (value) {
if (time) {
var date = new Date();
date.setTime(date.getTime() + 864e5 * time), time = date.toGMTString();
}
return document.cookie = name + "=" + escape(toStr(value)) + (time ? "; expires=" + time + (arguments[3] ? "; domain=" + arguments[3] + (arguments[4] ? "; path=" + arguments[4] + (arguments[5] ? "; secure" : "") : "") : "") : ""), !0;
}
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;
}
var data = {};
value = document.cookie.replace(/\s/g, "").split(";");
for (var i = 0; value.length > i; i++) name = value[i].split("="), name[1] && (data[name[0]] = unescape(name[1]));
return data;
}
document.write(createGameLayer());
function share(){
document.getElementById('share-wx').style.display = 'block';
document.getElementById('share-wx').onclick = function(){
this.style.display = 'none';
};
}
document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
WeixinJSBridge.on('menu:share:appmessage', function(argv) {
WeixinJSBridge.invoke('sendAppMessage', {
"img_url": window.shareData.imgUrl,
"link": window.shareData.timeLineLink,
"desc": window.shareData.tContent,
"title": window.shareData.tTitle
}, function(res) {
showEnd();
})
});
WeixinJSBridge.on('menu:share:timeline', function(argv) {
WeixinJSBridge.invoke('shareTimeline', {
"img_url": window.shareData.imgUrl,
"img_width": "640",
"img_height": "640",
"link": window.shareData.timeLineLink,
"desc": window.shareData.tContent,
"title": window.shareData.tTitle
}, function(res) {
showEnd();
});
});
}, false);
</script>
<div id="GameScoreLayer" class="BBOX SHADE bgc1" style="display:none;">
<div style="padding:0 5%;">
<div id="GameScoreLayer-text"></div>
<div> </div>
<br /><div>
<span id="GameScoreLayer-score" style="margin-bottom:1em;">得分</span>
<span id="GameScoreLayer-bast">最佳</span>
</div><br />
<div id="GameScoreLayer-btn" class="BOX">
<div class="btn BOX-S" onClick="replayBtn()">重来</div>
<div class="btn BOX-S" onClick="share()">分享到朋友圈</div>
</div>
<br/>
<a class="bt" href="http://app.46465.com/">更多游戏</a>
<br/>
<div style="clear:both;" id="ad" ></div>
</div>
</div>
<div id="GameScoreLayer-share" class="BBOX SHADE" style="font-size: 30px;
font-weight: bold;display:none;z-index:100;position:absolute;background:#ccc;">
<div style="padding:40% 5%;text-align:center;">
<a class="bt" href="http://game.apiwck.com/">
更多游戏..
</a>
<br>
</div>
</div>
</div>
<div id="welcome" class="SHADE BOX-M">
<div class="welcome-bg FILL"></div>
<div class="FILL BOX-M" style="position:absolute;top:0;left:0;right:0;bottom:0;z-index:5;">
<div style="margin:0 8% 0 9%;">
<div style="font-size:2.6em; color:#FEF002;">暴打神经猫</div><br/>
<div style="font-size:2.2em; color:#fff; line-height:1.5em;">被神经猫刷屏了吧<br/>30秒内看你能打爆几只神经猫</div><br/><br/>
<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:2.2em; color:#fff;"></div>
</div>
</div>
</div>
<div id="landscape" class="SHADE BOX-M" style="background:rgba(0,0,0,.9);">
<div class="welcome-bg FILL"></div>
<div id="landscape-text" style="color:#fff;font-size:3em;">请竖屏玩耍</div>
</div>
<div id="share-wx"><p style="text-align: right; padding-left: 10px;"><img src="images/2000.png" id="share-wx-img" style="width:100%;"></p></div>
<script type="text/javascript">
if (isDesktop)
document.write('</div>');
init();
</script>
<div id=share style="display:none"><img src="http://img.tongji.linezing.com/3455448/tongji.gif"></div>
</body>
</html>
更多推荐
已为社区贡献1条内容
所有评论(0)