HTML5消消乐DEMO演示

这是一个使用HTML5技术实现的消消乐DEMO,包含game.min.js、index.html和index2.html等文件,以及log.png的游戏截图。玩家可以点击开始游戏,在限定时间内完成特定任务。
摘要由CSDN通过智能技术生成

HTML5消消乐DEMO演示

在这里插入图片描述

demo
game.min.js

SpilGamesBrand = function() {
	var d = window.document;
	documentElement = d.documentElement || {};
	element = d.createElement("div");
	container = d.getElementById("spilgames-root");
	emptyFn = function() {};
	globalSettings = {};
	api = {};
	updateBodyCheck = function(d) {
		var a, b = d,
			c = !1;
		return function(d, f) {
			b = d || b;
			c = f || c;
			clearTimeout(a);
			c && (a = setTimeout(function() {
				updateBodyCheck = function(a) {
					b = a || b;
					b()
				};
				b()
			}, 100))
		}
	}(emptyFn);
	updateSize = function() {
		var h = d.body || d.getElementsByTagName("body")[0];
		updateSize = function(a) {
			a = h.getElementsByTagName("*");
			for (var b = a.length, c = 0, k = element.style.zIndex, f = 0; f < b; f++) c++, a[f] !== element && a[f].style.zIndex > c && (c = a[f].style.zIndex), c > k && (k = c, updateBodyCheck());
			element.style.zIndex = k;
			element.style.width = (window.innerWidth || documentElement.clientWidth || d.getElementsByTagName("body")[0].clientWidth) + "px";
			element.style.height = (window.innerHeight || documentElement.clientHeight || d.getElementsByTagName("body")[0].clientHeight) + "px";
			waitId = setTimeout(updateSize, updateSpeed)
		};
		updateSize()
	};
	und = function(d) {
		return void 0 === d
	};
	fadeOut = function(d) {
		var a = d.style,
			b = function() {
				_SPTimer.end("splashscreen");
				clearTimeout(waitId);
				globalSettings.container.removeChild(d)
			};
		return und(a.webkitTransition) && und(a.MozTransition) && und(a.transition) ? (a.opacity = 1, function() {
			console.info("opacity")
		}) : function() {
			a.opacity = 0;
			a.webkitTransition = a.MozTransition = a.transition = "opacity 500ms ease 0ms";
			d.addEventListener("webkitTransitionEnd", b);
			d.addEventListener("mozTransitionEnd", b);
			d.addEventListener("transitionend", b)
		}
	}(element);
	waitId = null;
	updateSpeed = 100;
	endTriggered = !1;
	element.id = "splashscreen";
	api.show = function(d) {
		d = d || {};
		globalSettings = {
			time: d.time || 2500,
			onEnd: d.onEnd || emptyFn,
			onStart: d.onStart || emptyFn,
			container: d.container || container,
			css: d.css || ""
		};
		0 > globalSettings.time && (globalSettings.time = 0);
		setTimeout(function() {
			updateSpeed = 300
		}, 3E4);
		updateSize();
		globalSettings.container.appendChild(element);
		element.style.cssText = globalSettings.css;
		_SPTimer.start("splashscreen");
		globalSettings.onStart()
	};
	api.end = function() {
		var d = !1,
			a;
		end = function() {
			a = d ? 0 : globalSettings.time;
			updateBodyCheck(emptyFn);
			0 > a ? fadeOut() : setTimeout(fadeOut, a)
		};
		return function(b) {
			endTriggered || (d = b || !1, endTriggered = !0, b ? end() : updateBodyCheck(end, !0))
		}
	}();
	return api
}(window);
SpilGamesBrand.show({
	css: "top: 0px; left: 0px; z-index: 9999; position: absolute; background: #d0e8fd url('logo.png') no-repeat center; -webkit-background-size: 320px 320px !important;"
});
window.FZ = {};
(function() {
	window.Gamehub && (window.SpilGames = {
		_: function(d) {
			var h = arguments,
				a = 0;
			return d.replace(/%s/g, function(b) {
				a++;
				return void 0 !== h[a] ? h[a] : b
			})
		},
		Highscores: {
			insert: function(d) {
				Gamehub.Score.submit(d.score)
			},
			showScoreboard: function(d) {
				Gamehub.ShowScoreboard();
				d && setTimeout(d, 100)
			}
		},
		Settings: {
			get: function(d) {
				switch (d) {
				case "currentGameInfo":
					return {
						splashScreen: Gamehub.Settings.splashScreen,
						rotationLockSreen: {
							portrait: Gamehub.Settings.rotationLockScreen.portrait,
							landscape: Gamehub.Settings.rotationLockScreen.landscape
						}
					};
				default:
					return {}
				}
			}
		}
	});
	FZ.SpilAPI = {
		SubmitScore: function(d) {
			FZ.SpilAPI.checkSpilAPI();
			SpilGames.Highscores.insert({
				score: d
			})
		},
		ShowHighscore: function() {
			FZ.SpilAPI.checkSpilAPI();
			!FZ.SpilAPI.___noSpilGamesAPI && FZ.GameBase && FZ.GameBase.pauseGame();
			SpilGames.Highscores.showScoreboard(function() {
				FZ.GameBase && FZ.GameBase.resumeGame()
			})
		},
		GetSplashScreenURL: function() {
			FZ.SpilAPI.checkSpilAPI();
			return FZ.SpilAPI.___noSpilGamesAPI ? "" : SpilGames.Settings.get("currentGameInfo").splashScreen
		},
		GetPortraitLockURL: function() {
			FZ.SpilAPI.checkSpilAPI();
			return FZ.SpilAPI.___noSpilGamesAPI ? "" : SpilGames.Settings.get("currentGameInfo").rotationLockSreen.portrait
		},
		GetLandscapeLockURL: function() {
			FZ.SpilAPI.checkSpilAPI();
			return FZ.SpilAPI.___noSpilGamesAPI ? "" : SpilGames.Settings.get("currentGameInfo").rotationLockSreen.landscape
		},
		checkSpilAPI: function() {
			return !FZ.SpilAPI.___noSpilGamesAPI
		},
		init: function() {
			FZ.SpilAPI.___noSpilGamesAPI = !window.SpilGames;
			window.SpilGames || (window.SpilGames = {
				_: function(d) {
					var h = arguments,
						a = 0;
					return d.replace(/%s/g, function(b) {
						a++;
						return void 0 !== h[a] ? h[a] : b
					})
				},
				Highscores: {
					insert: function(d) {
						FZ.__localSubmitHighscore && FZ.__localSubmitHighscore(d.score)
					},
					showScoreboard: function(d) {
						FZ.__localShowHighscore ? FZ.__localShowHighscore(d) : setTimeout(d, 0)
					}
				}
			})
		}
	};
	FZ.SpilAPI.init()
})();
(function(d, h) {
	d.SpilGames || (d.SpilGames = {
		_: function(g) {
			var b = 1,
				a = arguments;
			return g.replace(/%s/g, function() {
				return a[b++]
			})
		}
	});
	var a = d.JSON,
		b = d.document,
		c = d.navigator.userAgent,
		k = d.navigator.language ? d.navigator.language : d.navigator.userLanguage;
	namespace = d.location.href.replace(/\/[^\/]*$/i, "");
	var f = /\?/ig,
		e = /([^a-z0-9]|^)-([^0-9])/ig,
		l = /^([\W\w]*)\.([^:.]*)(:[\W\w]*)$/i,
		m = "$1" + (/Webkit/i.test(c) ? "-webkit-" : /Gecko/i.test(c) ? "-moz-" : "") + "$2",
		n = {
			computer: !/(iPhone|iPad|iPod|Android)/i.test(c),
			mobile: /(iPhone|iPad|iPod|Android)/i.test(c),
			iOS: /(iPhone|iPad|iPod)/i.test(c),
			iPad: /iPad/i.test(c),
			iPhone: /iPhone/i.test(c),
			iPod: /iPod/i.test(c),
			android: /Android/i.test(c),
			version: parseFloat(/(iPhone|iPad|iPod|Android|Chrome|Safari|Firefox|MSIE)[^0-9]*([0-9._]*)/i.exec(c)[2].replace("_", "."))
		},
		p, q, r, s, y, A = {},
		t = {},
		u = {},
		z = {},
		O = Array.prototype.slice,
		H = function(g) {
			for (var b, a, d = arguments.length; 1 < d--;) for (b in a = arguments[d], a) g[b] = a[b];
			return g
		},
		w = function(g) {
			if (g.nodeType) return g;
			if (g.__mate__ && g.__mate__.nodeType) return g.__mate__
		},
		B = function(g) {
			for (; g && !g.__mate__;) g = g.parentNode;
			return g ? g.__mate__ : h
		},
		C = function() {
			d.setTimeout(function() {
				d.scrollTo(0, n.android ? 1 : 0)
			}, 500)
		},
		I = function() {
			var g = w(t.root).getBoundingClientRect();
			q = 0 > g.left ? 0 : g.left;
			r = 0 > g.top ? 0 : g.top
		},
		J = function(g) {
			var b, a, d, c = u[g];
			if (c) for (b in d = O.call(arguments, 1), c)(a = c[b])[g].apply(a, d)
		},
		v = function(g, b, c) {
			var e, f = 0,
				k = z;
			g = g.split(".");
			for (e = g.length - 1; f < e; f++) k = "object" === typeof k[g[f]] ? k[g[f]] : k[g[f]] = {};
			if (b === h) return k[g[f]];
			k[g[f]] = b;
			!0 === c && d.localStorage.setItem(namespace, a.stringify(z))
		},
		L = function(g) {
			var b = 0,
				a = arguments;
			return g.replace(f, function() {
				return a[++b]
			})
		},
		x = function(g, b) {
			if ((g = w(g)) !== h) if (-1 !== b.indexOf(":")) g.style.cssText += b.replace(e, m);
			else return g.style[b]
		},
		E = function(g) {
			g = w(g).getBoundingClientRect();
			return {
				top: g.top - r,
				left: g.left - q,
				right: g.right - q,
				bottom: g.bottom - r,
				width: g.width,
				height: g.height
			}
		},
		M = function(g) {
			var a, d, c, e, f = p.store.local && p.store.local[g];
			if (f !== h && arguments.callee.lang !== g) for (p.language = arguments.callee.lang = g, a = b.querySelectorAll("*[local]"), d = a.length; d--;) e = a[d].__mate__, c = a[d].getAttribute("local"), e !== h && (e.lang ? e.lang(f[c]) : e.text(f[c]))
		},
		N = function(g, b) {
			var a;
			a = A[g] = function() {};
			H(a.prototype, b, F.__make__);
			a.prototype.className = g
		},
		F = function(g, a, d, c, e) {
			var f;
			g = w(g);
			if (g !== h && g.__mate__) return f = g.__mate__.path + "." + a, d = t[f] = new A[d], d.name = a, d.path = f, d.__mate__ = g.appendChild(b.createElement(e || "DIV")), d.__mate__.appendChild(b.createElement("DIV")), d.__mate__.__mate__ = d, x(d, "position: absolute; " + (c || "")), d
		},
		G = function(g) {
			var b = arguments.callee,
				a = G.__make__[g],
				c = function() {
					!0 !== this.finish && (this.finish = !0, d.setTimeout(function() {
						J(++b.finish >= b.count ? "after" : "load", b.finish, b.count)
					}, 0))
				};
			g === h && 0 === b.count && c();
			b.finish === h && (b.count = 0, b.finish = 0);
			return a !== h ?
			function(g) {
				b.count++;
				return a.call(b, g, c)
			} : function(g) {
				return g
			}
		};
	tween = function(g, b, a, c, e) {
		for (var f = +new Date, k = tween.__make__, l = g.concat(), m = g.length; m--;) g[m].time = f;
		a = "number" === typeof a ? a : 20;
		c = !0 === c ? !0 : !1;
		return function() {
			var f, m = g.length;
			f = d.setTimeout(function() {
				for (var e, n, D = [], p = 0, K = [], q = +new Date; p < m; p++) e = g[p], e === h ? K[K.length] = !0 : (n = q - e.time, n < e[3] ? D[p] = k[e[0]](n, e[1], e[2], e[3]) : n >= e[3] && e[4] === h ? (D[p] = k[e[0]](e[3], e[1], e[2], e[3]), g[p] = h) : (D[p] = k[e[0]](e[3], e[1], e[2], e[3]), g[p] = e.slice(4), g[p].time = q));
				b(D);
				if (K.length < m) f = d.setTimeout(arguments.callee, a);
				else if (!0 === c) {
					g = l.concat();
					for (p = g.length; p--;) g[p].time = q;
					f = d.setTimeout(arguments.callee, a)
				}
			}, a);
			return function() {
				d.clearTimeout(f);
				e && e()
			}
		}()
	};
	canvas2D = function(g, a) {
		var d, c;
		g = w(g);
		d = E(g);
		c = g.appendChild(b.createElement("CANVAS"));
		c.width = d.width;
		c.height = d.height;
		x(c, "position: absolute; left: 0px; top: 0px;");
		a = c.getContext(a);
		a.dirtyRect = [];
		a.childNodes = [];
		return a
	};
	sprite = function(g, b) {
		g.childNodes.push(this);
		this.source = b;
		this.parent = g
	};
	parse = function(g) {
		for (var a, c = ["config", "class", "object", "store"], e = 0, f = c.length, k = parse.__make__; e < f; e++) a = c[e], k[a](g[a]);
		g = b.createEvent("HTMLEvents");
		g.initEvent("orientationchange", !0, !0, d, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null);
		d.dispatchEvent(g)
	};
	debug = function() {
		return t
	};
	assignEvent = function() {
		var g, a, b;
		return n.mobile ?
		function(g) {
			var d, c;
			d = g.type;
			var e = 3 === g.target.nodeType ? g.target.parentNode : g.target,
				f = g.touches[0];
			if (!(1 < g.touches.length) && (c = B(e), c !== h)) {
				f && (a = f.pageX - q, b = f.pageY - r);
				argument = {
					target: e,
					code: g.keyCode,
					button: 1,
					clientX: a,
					clientY: b
				};
				switch (d) {
				case "touchstart":
					c.mouseover && c.mouseover(argument);
					c.mousedown && c.mousedown(argument);
					break;
				case "touchmove":
					c.mousemove && c.mousemove(argument);
					break;
				case "touchend":
					c.mouseup && c.mouseup(argument), c.click && (d = E(e), a > d.left && a < d.right && b > d.top && b < d.bottom && c.click(argument)), c.mouseout && c.mouseout(argument)
				}
				g.stopPropagation();
				"DIV" === e.nodeName && g.preventDefault()
			}
		} : function(a) {
			var b, d, c = a.type,
				e = 3 === a.target.nodeType ? a.target.parentNode : a.target,
				e = "mousedown" === c ? g = e : g || e;
			"mouseup" === c && (g = h);
			b = B(e);
			b !== h && "function" === typeof b[c] && (d = {
				target: e,
				code: a.keyCode,
				button: g === h ? 0 : 1,
				clientX: a.pageX - q,
				clientY: a.pageY - r
			}, b[c](d), a.stopPropagation(), "DIV" === e.nodeName && a.preventDefault())
		}
	}();
	parse.__make__ = {
		config: function(g) {
			var c;
			g.target = g.target === h ? b.body : b.getElementById(g.target) || b.body;
			g.angle = 90 === g.angle ? 90 : 0;
			g.width = g.width || 320;
			g.height = g.height || 416;
			g.offset = g.offset === h ? ["auto", "auto"] : g.offset.split(" ");
			1 === g.offset.length && g.offset.push(g.offset[0]);
			g.offsetLeft = "auto" === g.offset[1] ? -g.width / 2 + "px" : g.offset[1];
			g.offsetTop = "auto" === g.offset[0] ? -g.height / 2 + "px" : g.offset[0];
			N(":Unknown", {});
			c = t.root = g.target.appendChild(b.createElement("DIV"));
			c.__mate__ = {
				name: "root",
				path: "root",
				className: ":Unknown"
			};
			x(c, L("position: absolute; left: ?; top: ?; width: ?px; height: ?px; margin: ? 0px 0px ?; -user-select: none; overflow: hidden; background: ?;", "auto" === g.offset[1] ? "50%" : "0px", "auto" === g.offset[0] ? "50%" : "0px", g.width, g.height, g.offsetTop, g.offsetLeft, g.background !== h ? "url(" + g.background + ") no-repeat center" || "#FFF" : ""));
			H(CanvasRenderingContext2D.prototype, canvas2D.__make__);
			s = !0 === g.dirty ? b.body.appendChild(b.createElement("CANVAS")) : b.createElement("CANVAS");
			s.width = 600;
			s.height = 600;
			y = s.getContext("2d");
			c = b.getElementsByTagName("head")[0].appendChild(b.createElement("STYLE"));
			c.type = "text/css";
			c.textContent = " * { padding: 0px; margin: 0px; cursor: default; } body { font: 12px/20px Palatino; }";
			I();
			z = a.parse(d.localStorage.getItem(namespace) || "{}");
			p.config = g
		},
		"class": function(g) {
			for (var a in g) N(a, g[a])
		},
		object: function(g) {
			var a, b;
			for (a in g) b = l.exec(a), F(t[b[1]], b[2], b[3], g[a]);
			for (a in t)(b = t[a]).construct && b.construct()
		},
		store: function(a) {
			var b, c, d, e;
			J("before");
			for (b in a) switch (d = a[b], c = G(b), typeof d) {
			case "string":
				a[b] = c(a[b]);
				break;
			case "object":
				if (!(d instanceof Array)) {
					for (e in d) d[e] = c(d[e]);
					break
				}
			case "array":
				for (e = d.length; e--;) d[e] = c(d[e])
			}
			p.store = a || {};
			G()
		}
	};
	F.__make__ = {
		parent: function() {
		
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值