-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlauncher.html
49 lines (41 loc) · 1.3 KB
/
launcher.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<title>Loader</title>
</head>
<body>
{{ example }}
<script>
/* Function to download the library from github */
function GET(url, callback) {
var peticion = new XMLHttpRequest();
peticion.open("GET", url , true);
peticion.send();
peticion.onreadystatechange = function() {
if (peticion.readyState == 4) {
if (peticion.status == 0 || peticion.status == 200) {
callback(peticion.responseText);
}
}
}
}
/* Url of the json stringified function returning the ff object. */
GET("https://raw.githubusercontent.com/StringManolo/ff/master/json/ff.json", function(resp, ff, ff2, fBody) {
/* resp is the json response. ff & ff2 & fBody are just void variables. */
/* Parse the downloaded json */
ff2 = JSON.parse(resp);
/* Find the function body from the parsed function as string. */
fBody = ff2.match(/function[^{]+\{([\s\S]*)\}$/)[1];
/* Create a new function */
ff = new Function([], fBody);
/* Call the function & asign the returned object to the ff variable */
ff = ff();
/* From here you can use the framework freely. */
ff.mustache.example = "Fetching the framework from github in JSON works.";
ff.getMustacheSintax();
});
</script>
</body>
</html>