-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
334 lines (294 loc) · 15.4 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
<!DOCTYPE html>
<html lang="en" class="h-100">
<head>
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-174921185-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-174921185-1');
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="A collection of teacher-curated videos & web simulations for teacher's demonstrations or class practicals.">
<meta name="author" content="Syed Khairi, Ahmed Khattab">
<title>🎞️ Science Videos Archive - Biology, Chemistry & Physics videos for UK national curriculum curated by teachers.</title>
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:site" content="@MrKhairi_" />
<meta name="twitter:creator" content="@AhmedKhattabUK" />
<meta name="twitter:title" content="🎞️ Science Videos Archive" />
<meta name="twitter:description" content="A collection of teacher-curated videos & web simulations for teacher's demonstrations or class practicals." />
<meta name="twitter:image" content="https://syedkhairi.github.io/science-videos/img/summary_large_image.png" />
<meta property="og:title" content="🎞️ Science Videos Archive" />
<meta property="og:description" content="A collection of teacher-curated videos & web simulations for teacher's demonstrations or class practicals." />
<meta property="og:locale" content="en_GB" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.sciencevideos.co.uk/" />
<meta property="og:image" content="https://syedkhairi.github.io/science-videos/img/summary_large_image.png" />
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/4.0.12/handlebars.min.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script>
<script src="https://pagination.js.org/dist/2.1.4/pagination.min.js"></script>
<link rel="stylesheet" href="https://pagination.js.org/dist/2.1.4/pagination.css"/>
<script src="https://cdn.jsdelivr.net/npm/fuse.js@6.4.1"></script>
<script type="text/javascript">
$(document).ready(function(){
Handlebars.registerHelper('ifCond', function (v1, operator, v2, options) {
switch (operator) {
case '==':
return (v1 == v2) ? options.fn(this) : options.inverse(this);
case '===':
return (v1 === v2) ? options.fn(this) : options.inverse(this);
case '!=':
return (v1 != v2) ? options.fn(this) : options.inverse(this);
case '!==':
return (v1 !== v2) ? options.fn(this) : options.inverse(this);
case '<':
return (v1 < v2) ? options.fn(this) : options.inverse(this);
case '<=':
return (v1 <= v2) ? options.fn(this) : options.inverse(this);
case '>':
return (v1 > v2) ? options.fn(this) : options.inverse(this);
case '>=':
return (v1 >= v2) ? options.fn(this) : options.inverse(this);
case '&&':
return (v1 && v2) ? options.fn(this) : options.inverse(this);
case '||':
return (v1 || v2) ? options.fn(this) : options.inverse(this);
default:
return options.inverse(this);
}
});
var subject
var name
$('#loader').css("visibility", "hidden")
$('#biology, #chemistry, #physics').on('change', function(e) {
$('#intro').hide()
$('#loader').css("visibility", "visible")
subject = $(this).val();
name = $(this).find('option:selected').attr("name");
$('#biology, #chemistry, #physics').prop('selectedIndex',0);
getData(subject, name , '')
})
$('#search').submit(function(e) {
var keywords = $('#keywords').val()
subject = "https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/" + $('#keystage').val() + $('#subject').val()
name = $('#keystage').val() + $('#subject').val()
$('#intro').hide()
$('#loader').css("visibility", "visible")
getData(subject, name, keywords)
event.preventDefault();
})
})
function getData(subject, name, keywords){
$.getJSON(subject, function(data) {
var r = data[name]
if (keywords !== '') {
r = showResults(r, keywords)
}
$('#pagination-container').pagination({
dataSource: r,
pageSize: 24,
className: 'paginationjs-big',
ulClassName: 'pagination',
callback: function(data, pagination) {
data.map(function(e){
if (getYouTubeId(e.link) === null && e.type === 'Simulation') {
e.img = "https://syedkhairi.github.io/science-videos/img/simulation.png";
} else if (getYouTubeId(e.link) === null && e.type === 'Demo') {
e.img = "https://syedkhairi.github.io/science-videos/img/demo.png";
} else if (getYouTubeId(e.link) === null && e.type === 'Practical') {
e.img = "https://syedkhairi.github.io/science-videos/img/practical.png";
} else if (getYouTubeId(e.link) === null && e.type === 'Other') {
e.img = "https://syedkhairi.github.io/science-videos/img/other.png";
} else {
var thumbnail = 'https://i3.ytimg.com/vi/' + getYouTubeId(e.link) + '/hqdefault.jpg';
e.img = thumbnail;
}
});
var resultstemplate = Handlebars.compile($('#results-template').html())
$('#results').html(resultstemplate(data))
$('#loader').hide()
$(function () {
$('[data-toggle="tooltip"]').tooltip()
})
}
});
})
}
function showResults(data, keywords) {
const options = {
includeScore: true,
keys: [
{
name: 'title',
weight: 0.5
},
{
name: 'description',
weight: 0.4
},
{
name: 'topic',
weight: 0.1
}
]
}
const fuse = new Fuse(data, options)
const result = fuse.search(keywords)
data = result.map(function(e) {
return e.item;
});
return data
}
function getYouTubeId(value) {
var regEx = "^(?:https?:)?//[^/]*(?:youtube(?:-nocookie)?\.com|youtu\.be).*[=/]([-\\w]{11})(?:\\?|=|&|$)";
var matches = value.match(regEx);
if (matches) {
var result = matches.slice(1)
return result;
} else return null;
}
</script>
<script id="results-template" type="text/x-handlebars-template">
<div class="row row-cols-1 row-cols-md-4">
{{#each this}}
<div class="col mb-3">
<div class="card h-100">
<div class="d-flex justify-content-center w-100">
<div class="img-gradient w-100">
<div class="embed-responsive embed-responsive-16by9">
<img src="{{img}}" class="card-img-top embed-responsive-item" style="object-fit: cover;">
</div>
</div>
</div>
<span class="badge badge-info mt-1 mr-1 position-absolute" style="right: 0">{{type}}</span>
{{#if warning}}
<div class="position-absolute mt-4" style="left: 50%;">
<h1 class="position-relative" style="left: -50%;" data-toggle="tooltip" data-placement="top" title="Caution: Content of this video has been flagged due to safety concerns. Please seek advice & proceed at own risk."><svg width="2em" height="2em" viewBox="0 0 16 16" class="bi bi-exclamation-triangle" fill="white" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M7.938 2.016a.146.146 0 0 0-.054.057L1.027 13.74a.176.176 0 0 0-.002.183c.016.03.037.05.054.06.015.01.034.017.066.017h13.713a.12.12 0 0 0 .066-.017.163.163 0 0 0 .055-.06.176.176 0 0 0-.003-.183L8.12 2.073a.146.146 0 0 0-.054-.057A.13.13 0 0 0 8.002 2a.13.13 0 0 0-.064.016zm1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566z"/>
<path d="M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0zM7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995z"/>
</svg></h1></div>
{{/if}}
<div class="card-body mb-n3">
<p class="card-text mt-n3 small"><span class="badge badge-primary text-wrap text-left">{{topic}}</span></p>
<h6 class="card-title mt-n2"><a href="{{link}}" target="_blank" class="text-decoration-none">{{title}}</a></h6>
<div class="d-inline-block overflow-hidden" style="max-width: 100%; max-height: 75px;">
<p class="small text-muted">{{description}}</p>
</div>
</div>
{{#ifCond attachment '||' cleapss}}
<div class="card-footer bg-white">
<div class="row pl-2">
{{#if attachment}}
<a href="{{attachmentLink}}" target="_blank" class="mt-auto btn btn-outline-success btn-sm btn-block {{#if cleapss}}col-9{{/if}}"><svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-paperclip" fill="currentColor" xmlns="https://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0V3z"/>
</svg> Worksheets</a>
{{/if}}
{{#if cleapss}}
<a href="{{cleapssLink}}" target="_blank" class="col-3 text-right" data-toggle="tooltip" data-placement="top" title="Click to view related CLEAPSS resources - log in required once redirected"><img src="img/cleapss.png" class="float-right img-fluid"></a>
{{/if}}
</div>
</div>
{{/ifCond}}
</div>
</div>
{{/each}}
</div>
</script>
</head>
<body class="d-flex flex-column h-100">
<div class="jumbotron jumbotron-fluid">
<div class="container">
<a href="index.html" class="text-decoration-none"><h1 class="display-5 text-body">Science Videos Archive</h1></a>
<p class="lead">A collection of teacher-curated videos & web simulations for teacher's demonstrations or class practicals.</p>
<form role="form" id="search">
<div class="form-row mb-3">
<div class="col-sm-6">
<input type="text" id="keywords" class="form-control form-control-lg mb-md-0 mb-2" placeholder="Search">
</div>
<div class="col-sm-2">
<select id="keystage" class="custom-select custom-select-lg mb-md-0 mb-2" required>
<option value ="" selected>Key Stage</option>
<option value="ks3">Key Stage 3</option>
<option value="ks4">Key Stage 4</option>
<option value="ks5">Key Stage 5</option>
</select>
</div>
<div class="col-sm-2 d-flex justify-content-center">
<select id="subject" class="custom-select custom-select-lg mb-md-0 mb-2" required>
<option value ="" selected>Subject</option>
<option value="Biology">Biology</option>
<option value="Chemistry">Chemistry</option>
<option value="Physics">Physics</option>
</select>
<button type="submit" class="btn btn-light btn-lg ml-2 mb-md-0 mb-2">
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-search" fill="currentColor" xmlns="https://www.w3.org/2000/svg">
<path fill-rule="evenodd" d="M10.442 10.442a1 1 0 0 1 1.415 0l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1 1 0 0 1 0-1.415z"/>
<path fill-rule="evenodd" d="M6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM13 6.5a6.5 6.5 0 1 1-13 0 6.5 6.5 0 0 1 13 0z"/>
</svg>
</button>
</div>
<div class="col-sm-2">
<button class="btn btn-outline-primary btn-lg btn-block" type="button" data-toggle="collapse" data-target="#collapseExample" aria-expanded="false" aria-controls="collapseExample">
Browse All
</button>
</div>
</div>
</form>
<div class="collapse" id="collapseExample">
<div class="row">
<div class="col-sm-4">
<div class="dropdown">
<select class="custom-select custom-select-lg mb-md-0 mb-2" id="biology">
<option>Biology</option>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks3Biology" name="ks3Biology">Key Stage 3</option>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks4Biology" name="ks4Biology">Key Stage 4</option>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks5Biology" name="ks5Biology">Key Stage 5</option>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="dropdown">
<select class="custom-select custom-select-lg mb-md-0 mb-2" id="chemistry">
<option>Chemistry</option>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks3Chemistry" name="ks3Chemistry">Key Stage 3</button>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks4Chemistry" name="ks4Chemistry">Key Stage 4</button>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks5Chemistry" name="ks5Chemistry">Key Stage 5</button>
</select>
</div>
</div>
<div class="col-sm-4">
<div class="dropdown">
<select class="custom-select custom-select-lg mb-md-0 mb-2" id="physics">
<option>Physics</option>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks3Physics" name="ks3Physics">Key Stage 3</button>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks4Physics" name="ks4Physics">Key Stage 4</button>
<option class="dropdown-item" type="button" value="https://v2-api.sheety.co/182a087c1d6ff0cf57c51546075e244b/demos/ks5Physics" name="ks5Physics">Key Stage 5</button>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="text-center">
<div id="loader" class="spinner-border" role="status">
<span class="sr-only">Loading...</span>
</div>
</div>
<div id="results" class="mb-3"><span class="text-muted" id="intro"><i>Search specific keywords or click 'Browse All' to view all content.</i></span></div>
<nav id="pagination-container" class="mb-5 d-flex justify-content-center"></nav>
</div>
<footer class="footer mt-auto py-3">
<div class="container">
<span class="text-muted small">The content of this archive is crowd-sourced by <a href="https://twitter.com/@AhmedKhattabUK" target="_blank">@AhmedKhattabUK</a> & this website is open-sourced on <a href="https://github.com/syedkhairi/sciencedemos" target="_blank">GitHub</a> written by <a href="https://twitter.com/@MrKhairi_" target="_blank">@MrKhairi_</a>.</span>
</div>
</footer>
</body>
</html>