forked from xiaohulu/modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
128 lines (107 loc) · 2.75 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
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>modules</title>
<style>
body {
padding: 1em 6em 2em;
font: 14px/16px 'Verdana', 'Tahoma';
}
#content {
width: 40em;
padding-left: 2em;
}
dl {
margin-top: 3em;
}
dt {
font-size: 18px;
}
.size {
font-style: italic;
color: #666;
}
.size a {
font-style: normal;
}
#footer {
margin-top: 5em;
padding-left: 2em;
display: none;
}
</style>
</head>
<body>
<h1>modules in the sea</h1>
<div id="content">loading...</div>
<div id="footer">
<p>
For more information, please go to
<a href="https://github.com/seajs/modules/">https://github.com/seajs/modules/</a>
</p>
</div>
<script id="module-tmpl" type="text/template">
<dl>
<dt>{{name}} v{{version}}</dt>
<dd>
<p>{{description}}</p>
<p class="size">
<a href="{{minpath}}">{{minfile}}</a>
({{gzipped}}, Minified and Gzipped)<br>
{{#src}}
<a href="{{srcpath}}">{{srcfile}}</a>
({{raw}}, Uncompressed Code)
{{/src}}
<br>
{{#extraFiles}}
<br>
<a href="{{url}}">{{filename}}</a>
{{/extraFiles}}
</p>
</dl>
</script>
<script src="seajs/1.1.0/sea.js"></script>
<script>
seajs.config({
alias: {
'es5-safe': 'es5-safe/0.9.2/es5-safe',
'mustache': 'mustache/0.4.0/mustache'
},
preload: [
Function.prototype.bind ? '' : 'es5-safe'
]
});
seajs.use(['./registry', 'mustache'], function(registry, mustache) {
var BASE = location.href.replace(/(.*)\/.*/, '$1');
var tmpl = document.getElementById('module-tmpl').text;
var html = '<div id="analytics">There are <strong>'+ Object.keys(registry).length +'</strong> modules in the sea.</div>';
for (var p in registry) {
if (registry.hasOwnProperty(p)) {
var meta = registry[p];
var filename = meta.filename;
var path = BASE + '/' + meta.dirpath + '/' + meta.version + '/';
meta.minfile = filename + '.js';
meta.srcfile = filename + '-debug.js';
meta.minpath = path + meta.minfile;
meta.srcpath = path + meta.srcfile;
// for seajs plugins
if (meta.extra) {
meta.extraFiles = meta.extra.map(function(filepath) {
var filename = filepath.replace(/^.*\/(.*)$/, '$1');
return {
filename: filename,
url: path + filename
};
});
}
html += mustache.to_html(tmpl, meta);
}
}
document.getElementById('content').innerHTML = html;
document.getElementById('footer').style.display = 'block';
});
</script>
</body>
</html>