-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprototype2.html
More file actions
108 lines (101 loc) · 2.54 KB
/
prototype2.html
File metadata and controls
108 lines (101 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<link rel="stylesheet" type="text/css" href="slick-1.5.0/slick/slick.css"/>
<style>
#mainMenu {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
}
#mainMenu div {
width: 90%;
height: 90%;
background-color: gray;
}
body {
overflow-x: none;
}
</style>
<script src="scripts/jquery-1.11.3.min.js"></script>
<script src="slick-1.5.0/slick/slick.min.js"></script>
<script>
"function"!=typeof Promise.prototype.done&&(Promise.prototype.done=function(t,n){var o=arguments.length?this.then.apply(this,arguments):this;o.then(null,function(t){setTimeout(function(){throw t},0)})});
//# sourceMappingURL=/polyfills/promise-done-7.0.1.min.js.map
var commands = {};
$(function onLoad() {
var escapeFunction = function() {
}
function toMainMenu() {
$("#gameFields").children().hide();
$("#mainMenu").show();
escapeFunction = function() {
}
}
function readMenuModules(filenames) {
return Promise.all(filenames.map(readMenu));
}
function readMenu(filename) {
return new Promise(function(fulfill, reject) {
$.ajax({
url: filename
}).done(function(data) {
var d = $(data);
var menu = d.find("menu");
var div = $("<div>");
div.html(menu.html());
div.attr("data-id", menu.attr("id"));
$("#mainMenu").append(div);
var gameField = $("<div>");
gameField.html(d.find("content").html())
gameField.attr("id", menu.attr("id"));
$("#gameFields").append(gameField);
gameField.hide();
$("body").append(d.find("script"));
fulfill();
});
});
}
function escaper(e) {
if(e.keyCode == 27) {
escapeFunction();
}
}
function chooseMenu(e) {
if(e.keyCode == 32) {
//For Some reason, this keeps cacheing
var currIndex = $("#mainMenu").slick("slickCurrentSlide");
var currSlide = $("#mainMenu").find("[data-slick-index=" + currIndex + "]");
var id = currSlide.attr("data-id");
commands[id]();
escapeFunction = toMainMenu;
}
}
readMenuModules(["modules/buttonMash.html","modules/comingSoon.html"]).done(function() {
$("#mainMenu,#gameFields").show();
$("#loading").hide();
$("#mainMenu").slick({
centerMode: true,
slidesToShow: 1,
arrows: false,
centerPadding: "160px",
focusOnSelect: true
});
$(document).bind("keyup", chooseMenu).bind("keyup", escaper);
$("#mainMenu .slick-list").focus();
});
});
</script>
</head>
<body>
<div id="loading">
Loading...
</div>
<div id="mainMenu" style="display:none">
</div>
<div id="gameFields" style="display:none">
</div>
</body>
</html>