forked from vaadin/expense-manager-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
174 lines (146 loc) · 4.33 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=no">
<title>Expense Manager</title>
<link rel="shortcut icon" sizes="32x32" href="images/app-icon-32.png">
<meta name="theme-color" content="#33383a">
<link rel="manifest" href="manifest.json">
<!-- iOS -->
<link rel="apple-touch-icon" href="images/app-icon-144.png" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="apple-mobile-web-app-title" content="Expenses">
<script type="text/javascript">
// HTTPS redirect is borrowed from
// https://github.com/PolymerElements/platinum-https-redirect/
// blob/master/platinum-https-redirect.html
// With license: http://polymer.github.io/LICENSE.txt
function _isLocalhost(hostname) {
// !! coerces the logical expression to evaluate to the values true or false.
return !!(hostname === 'localhost' ||
// [::1] is the IPv6 localhost address.
hostname === '[::1]' ||
// 127.0.0.1/8 is considered localhost for IPv4.
hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));
}
if (window.location.protocol === 'http:' && !_isLocalhost(window.location.hostname)) {
// Redirect to https: if we're currently using http: and we're not on localhost.
window.location.href = 'https:' + window.location.href.substring(window.location.protocol.length);
}
// setup Polymer options
window.Polymer = {
lazyRegister: true,
dom: 'shadow'
};
</script>
<link id="bundle" rel="import" href="src/expense-app.html" async>
<style>
html {
height: 100%;
}
body {
overflow: hidden;
display: flex;
flex-direction: column;
margin: 0;
height: 100%;
background: #33383a;
font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
-webkit-tap-highlight-color: transparent;
}
.loading {
width: 100vw;
height: 100vh;
overflow: hidden;
}
#loadingScreen {
width: 100%;
}
#loadingScreen {
position: absolute;
top: 36%;
left: 0;
color: rgba(255, 255, 255, 0.56);
text-align: center;
line-height: 10;
font-weight: 400;
font-family: arial, sans-serif;
}
#loadingScreen .spinner {
content: "";
position: absolute;
height: 2px;
background: #ff3a39;
top: 0;
left: 0;
width: 100%;
animation: 1.2s loading infinite;
transform-origin: 100% 0;
}
@keyframes loading {
50% {
transform: scalex(0);
}
51% {
transform: translatex(-100vw);
}
}
#loadingScreen.animation-stop .spinner {
animation-name: none;
}
.loading expense-app {
opacity: 0;
}
.ready expense-app {
animation: fade-in 0.25s;
}
@keyframes fade-in {
0% {
opacity: 0;
}
}
</style>
</head>
<body class="loading">
<div id="loadingScreen">
<div class="spinner"></div>
</div>
<expense-app></expense-app>
<script>
function registerServiceWorker() {
// load pre-caching service worker
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('service-worker.js');
}
}
function onImportLoaded() {
document.body.classList.remove('loading');
document.body.classList.add('ready');
registerServiceWorker();
}
function finishLazyLoading() {
var link = document.querySelector('#bundle');
if (link.import && link.import.readyState === 'complete') {
onImportLoaded();
} else {
link.addEventListener('load', onImportLoaded);
}
}
// load webcomponents polyfills
if ('registerElement' in document &&
'import' in document.createElement('link') &&
'content' in document.createElement('template')) {
// browser has web components
finishLazyLoading();
} else {
// polyfill web components
var e = document.createElement('script');
e.src = 'bower_components/webcomponentsjs/webcomponents-lite.min.js';
e.onload = finishLazyLoading;
document.head.appendChild(e);
}
</script>
</body>
</html>