-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
169 lines (144 loc) · 5.53 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
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, minimum-scale=1.0,
initial-scale=1.0, user-scalable=yes">
<meta charset="utf-8">
<title>Cache API Demo</title>
<link rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet"
href="https://code.getmdl.io/1.2.1/material.indigo-deep_orange.min.css">
<link rel="stylesheet" href="styles/main.css" />
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
</head>
<body id="body">
<!-- HTML skeleton -->
<h3 class="mdl-color--primary mdl-shadow--2dp header">Cache API Demo</h3>
<div class="container">
<div class="controls-container">
<form action="#">
<div class="mdl-textfield mdl-js-textfield mdl-textfield--floating-label">
<input class="mdl-textfield__input" type="text" id="cache-input">
<label class="mdl-textfield__label" for="cache-input">Cache name</label>
</div>
</form>
<button id="add-cache" class="mdl-button mdl-js-button
mdl-button--raised mdl-js-ripple-effect mdl-button--accent">
Create
</button>
<button id="delete-cache" class="mdl-button mdl-js-button
mdl-button--raised mdl-js-ripple-effect mdl-button--accent">
Delete
</button>
<ul class="mdl-list" id="files-list"></ul>
</div>
<div class="caches-container">
<div id="caches"></div>
</div>
<div class="mdl-card mdl-shadow--2dp" id="console">
<div class="mdl-card__supporting-text">
<pre><code id="code"></code></pre>
</div>
</div>
</div>
<!-- Templates -->
<script id="template-file" type="text/x-handlebars-template">
<li class="mdl-list__item file">
<span class="mdl-list__item-primary-content">
{{file}}
</span>
</li>
</script>
<script id="template-add" type="text/x-handlebars-template">
<button class="mdl-button mdl-js-button mdl-button--fab
mdl-button--mini-fab mdl-button--colored mdl-js-ripple-effect add">
<i class="material-icons">add</i>
</button>
</script>
<script id="template-cache" type="text/x-handlebars-template">
<div class="mdl-card mdl-shadow--8dp cache mdl-color--primary">
<div class="mdl-card__title">
<h2 class="mdl-card__title-text">{{cacheName}}</h2>
</div>
<ul class="mdl-list requests"></ul>
<div class="mdl-card__menu delete-location"></div>
</div>
</script>
<script id="template-request" type="text/x-handlebars-template">
<li class="mdl-list__item request mdl-shadow--4dp mdl-color--accent">
<span class="mdl-list__item-primary-content">
{{request}}
</span>
<span class="delete-location"></span>
</li>
</script>
<script id="template-delete" type="text/x-handlebars-template">
<button class="mdl-button mdl-button--icon mdl-js-button mdl-js-ripple-effect delete">
<i class="material-icons">cancel</i>
</button>
</script>
<script id="template-add-cache" type="text/x-handlebars-template">
<script>
window.caches.open('<strong>{{cacheName}}</strong>')
.then(function(cache) {
// Cache is open and accessible as 'cache'.
// If no '<strong>{{cacheName}}</strong>' cache existed, it was created.
})
.catch(function(error) {
console.log('Cache creation failed', error);
});
</script>
</script>
<script id="template-delete-cache" type="text/x-handlebars-template">
<script>
window.caches.delete('<strong>{{cacheName}}</strong>')
.then(function() {
// '<strong>{{cacheName}}</strong>' cache has been deleted
// If no '<strong>{{cacheName}}</strong>' cache existed, nothing happens
})
.catch(function(error) {
console.log('Cache deletion failed', error);
});
</script>
</script>
<script id="template-add-request" type="text/x-handlebars-template">
<script>
window.caches.open('<strong>{{cacheName}}</strong>')
.then(function(cache) {
// Cache is open and accessible as 'cache'.
cache.add('<strong>{{requestUrl}}</strong>')
.then(function() {
// '<strong>{{requestUrl}}</strong>' request
// has been added to '<strong>{{cacheName}}</strong>' cache
});
})
.catch(function(error) {
console.log('Request creation failed', error);
});
</script>
</script>
<script id="template-delete-request" type="text/x-handlebars-template">
<script>
window.caches.open('<strong>{{cacheName}}</strong>')
.then(function(cache) {
// Cache is open and accessible as 'cache'.
cache.delete('<strong>{{requestUrl}}</strong>')
.then(function() {
// '<strong>{{requestUrl}}</strong>' request
// has been deleted from '<strong>{{cacheName}}</strong>' cache
});
})
.catch(function(error) {
console.log('Could not delete request', error);
});
</script>
</script>
<!-- JavaScript -->
<script
src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.5/handlebars.min.js">
</script>
<script defer src="https://code.getmdl.io/1.2.1/material.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>