-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfilesystem.tests.htm
More file actions
123 lines (84 loc) · 2.25 KB
/
filesystem.tests.htm
File metadata and controls
123 lines (84 loc) · 2.25 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
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
<html>
<head>
<script src="https://rawgithub.com/jashkenas/underscore/master/underscore-min.js" type="text/javascript"></script>
<script src="http://codeorigin.jquery.com/jquery-2.0.3.min.js" type="text/javascript"></script>
<script src="js/github.js" type="text/javascript"></script>
<script src="js/filesystem.js" type="text/javascript"></script>
<script src="js/filesystem.github.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
// create a dirEntry to be the root of our filesystem
var root = Object.construct(VFS.DirectoryEntry);
// mount
VFS.Mount.mount(
root,
'github',
{
personalToken: 'dca8a5ceabe3b3a67a355375c4d3fae1cdac25ec',
user:'Axford',
repo: 'axCAD',
branch: 'master',
rootPath: '/css',
defaultCommitMessage: 'VFS commit'
},
function(err) {
// read, recursively
root.read(true, function() {
});
console.log('Mount complete',err);
// get a directory node
var de = root.getDirectory('/ui-lightness/images');
// mount something else
VFS.Mount.mount(
de,
'github',
{
personalToken: 'dca8a5ceabe3b3a67a355375c4d3fae1cdac25ec',
user:'Axford',
repo: 'axCAD',
branch: 'master',
rootPath: '/js/noty',
defaultCommitMessage: 'VFS commit'
},
function(err) {
// read, recursively
de.read(true, function() {});
// update what we've got
ls();
}
);
// list what we've got
//console.log(root);
ls();
});
function lsDir(node,de) {
var ul = $('<ul/>');
node.append(ul);
// list directories first
for (var i =0;i<de.directories.length;i++) {
var li = $('<li/>');
var c = de.directories[i];
li.html(c.name + ', '+ (c.isDirectory?'dir':'')+', '+(c.isMountPoint?'mountPoint':''));
ul.append(li);
lsDir(li, c);
}
// then files
for (var i =0;i<de.files.length;i++) {
var li = $('<li/>');
var c = de.files[i];
li.html(c.name);
ul.append(li);
}
}
function ls() {
var node = $('#log');
node.html('');
lsDir(node,root);
}
});
</script>
</head>
<body>
<div id="log"/>
</body>
</html>