forked from webduinoio/webduino-blockly
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlauncher.html
More file actions
executable file
·47 lines (38 loc) · 1.36 KB
/
launcher.html
File metadata and controls
executable file
·47 lines (38 loc) · 1.36 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
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<script src="components/webcomponentsjs/webcomponents-lite.min.js"></script>
<script src="lib/jquery-2.2.1.min.js"></script>
<script src="launcher.js"></script>
<script>
function getUrlParam(name, defaultValue) {
var val = location.search.match(new RegExp('[?&]' + name + '=([^&]+)'));
return val ? decodeURIComponent(val[1].replace(/\+/g, '%20')) : defaultValue;
}
window.addEventListener('load', function() {
var url = window.location.href.split('#')[0],
dataStr = localStorage.getItem(url);
if (dataStr) {
var config = JSON.parse(dataStr),
tpl = getUrlParam('tpl', (config.tpl || 'default'));
launcher.loadTemplate('./templates/' + tpl + '.html', function (data) {
// Load translation
window.MSG = {};
$('head').append('<script src="msg/' + config.lang + '.js' + '"><\/script>');
if (config.page !== 'index') {
$('head').append('<script src="msg/' + config.page + '/' + config.lang + '.js' + '"><\/script>');
}
data.body = launcher.translate(data.body, window.MSG);
data.body = launcher.injectMedia(data.body);
data.head = launcher.injectDependencies(data.head);
$.extend(config.data, data);
launcher.jsbin(config);
});
}
});
</script>
</head>
<body>
</body>
</html>