-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
75 lines (61 loc) · 2.14 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
<!DOCTYPE html>
<html debug="true"> <head> <title> repo.js test </title>
<script type="text/javascript" src="https://raw.github.com/danlangford/repo.js/master/repo.js"></script>
<!--<script type="text/javascript" src="repo.js"></script>-->
<script type="text/javascript">
window.w={init:undefined,say:undefined,script:undefined,div:undefined};
w.init = function() {
w.div = document.createElement('div');
var _body = document.getElementsByTagName('body')[0];
_body.appendChild(w.div);
w.say('author', 'dan langford');
w.say('');
w.say("DEMO w/FirebugLite...")
//add
var _resp = repo.add({"catalog":[{"name":"FirebugLite", "url":"https://getfirebug.com/firebug-lite.js"}]});
w.say(_resp);
//list
_resp = repo.list();
w.say(_resp);
//load
_resp = repo.load('FirebugLite');
w.say(_resp);
w.say('');
w.say('i want to add libs to your repo catalog run a command like this:');
w.runMeLink("repo.script('https://raw.github.com/danlangford/repo.js/master/repo.jsonp')");
// w.runMeLink("repo.script('repo.jsonp')");
w.say('then in the Firebug Lite console down there type this command:');
w.runMeLink('repo.list()');
w.say('');
w.say('now load the functional goodness with this command:');
w.runMeLink("repo.load('FunctionalJS')");
w.say('and test it by running this command in the console:');
w.runMeLink("Functional.map('x*x', [1,2,3,4])");
}
w.say = function() {
var _text = '';
for (var i = 0; i < arguments.length; i++) {
_text += arguments[i] + ' ';
}
w.div.appendChild(document.createTextNode(_text));
w.div.appendChild(document.createElement('br'));
}
w.runMeLink = function(cmd) {
var _a;
_a = document.createElement('a');
var _fn = 'w.run("'+cmd+'")';
_a.onclick = new Function(_fn);
_a.href='#';
_a.appendChild(document.createTextNode(cmd));
w.div.appendChild(_a);
w.div.appendChild(document.createElement('br'));
}
w.run = function(cmd) {
repo.log(' >>> '+cmd);
// eval() is evil!!!
repo.log(eval(cmd));
}
window.onload = w.init;
</script>
</head> <body> repo.js test </body>
</html>