forked from parth-r-patel/outpost-polymer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
151 lines (143 loc) · 6.14 KB
/
index.html
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<!doctype html>
<html>
<head>
<title>Outpost</title>
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
<link rel="import" href="bower_components/font-roboto/roboto.html">
<link rel="import" href="bower_components/core-scaffold/core-scaffold.html">
<link rel="import" href="bower_components/core-header-panel/core-header-panel.html">
<link rel="import" href="bower_components/core-toolbar/core-toolbar.html">
<link rel="import" href="bower_components/core-menu/core-menu.html">
<link rel="import" href="bower_components/paper-item/paper-item.html">
<link rel="import" href="bower_components/core-pages/core-pages.html">
<link rel="import" href="bower_components/paper-dialog/paper-dialog.html">
<link rel="import" href="number-counter.html">
<link rel="import" href="outpost-engage.html">
<link rel="import" href="outpost-header.html">
<link rel="import" href="tele-op.html">
<link rel="import" href="misc-input-panel.html">
<link rel="import" href="auto-form.html">
<link rel="import" href="strategy-screen.html">
</head>
<style id="style">
html,body {
height: 100%;
margin: 0;
background-color: #ffffff;
font-family: 'RobotoDraft', sans-serif;
}
core-header-panel {
height: 100%;
overflow: auto;
-webkit-overflow-scrolling: touch;
}
core-scaffold /deep/ core-toolbar{
background-color: #E53935;
/* ff888b lighter red*/
}
core-toolbar {
color: white;
}
core-menu /deep/ core-icon
{
margin-right: 20px;
}
core-scaffold::shadow core-header-panel
{
background-color: white;
}
</style>
<body unresolved fullbleed>
<template id="external-binding" is="auto-binding">
<template if="{{!gate}}">
<outpost-engage></outpost-engage>
</template>
<template if="{{gate && scout}}">
<core-scaffold id="scaffold" responsiveWidth="700px" disableSwipe="true">
<core-header-panel navigation flex>
<core-toolbar>
<div>Menu</div>
</core-toolbar>
<core-menu>
<paper-item on-tap="{{disengage}}">
<core-icon id="decreaseButton" icon="exit-to-app"></core-icon>
Logout
</paper-item>
<paper-item on-tap="{{emend}}">
<core-icon id="replayButton" icon="reply"></core-icon>
Replay Match
</paper-item>
</core-menu>
</core-header-panel>
<outpost-header tool selected="{{mode}}"></outpost-header>
<core-pages selected="{{mode}}" main>
<div>
<auto-form></auto-form>
</div>
<div>
<tele-op></tele-op>
</div>
<div>
<misc-input-panel></misc-input-panel>
</div>
</core-pages>
</core-scaffold>
<paper-dialog style="height: 400px; width: 300px;"id="replayDialog" backdrop autoCloseDisabled heading="Select Match to Replay" closeSelector="#close">
<paper-input-decorator id="replayMatch-decorator" label="Match ###" floatingLabel>
<input id="replayMatch" type="tel">
</paper-input-decorator>
<paper-button raised on-click="{{prepReplay}}">Submit</paper-button>
<core-icon-button icon="close" style="position: absolute; top: 0px; right: 0px; border: 1px solid; color: red" id="close"></core-icon-button>
</paper-dialog>
</template>
<template if="{{gate && !scout}}">
<strategy-screen></strategy-screen>
</template>
</template>
<script>
var extBind = document.querySelector('#external-binding');
var style = document.querySelector('#style');
extBind.gate = false;
extBind.scout = false;
extBind.mode = 0;
extBind.disengage = function()
{
window.sessionStorage.removeItem('instanceId');
extBind.gate = false;
window.sessionStorage.clear();
};
extBind.emend = function()
{
document.getElementById('replayDialog').open();
};
extBind.prepReplay = function()
{
document.querySelector('core-overlay-layer /deep/ #replayDialog').close();
document.querySelector('html /deep/ core-scaffold').closeDrawer();
var ajax = document.querySelector('outpost-header /deep/ #attain');
var replayNumber = document.querySelector('core-overlay-layer /deep/ input');
ajax.url = "rest/match/" + replayNumber.value;
window.sessionStorage.setItem('replay', replayNumber.value);
extBind.mode = 0;
};
document.addEventListener("engage", function(evt)
{
extBind.gate = true;
if(evt.detail.user === "scout")
{
if(window.sessionStorage.getItem('instanceId').search(/blue/i) > -1)
{
style.sheet.cssRules[2].style.backgroundColor = "#039BE5"
}
extBind.mode = 0;
extBind.scout = true;
}
else
{
extBind.scout = false;
extBind.mode = 0;
}
});
</script>
</body>
</html>