-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathresources.html
465 lines (415 loc) · 15.7 KB
/
resources.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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="A collection of Javascript tools resources
for the js-tools mailing list."/>
<title>Javascript development tools - resources</title>
<script type="application/javascript" src="resources.js"></script>
<script type="application/javascript" src="categories.js"></script>
<style>
a[name^="group:"]:hover { font-weight: bold }
.closed>a[name^="group:"]:hover::after { font-weight: normal;
font-style: italic;
content: " (click to open topic)"
}
.open>a[name^="group:"]:hover::after { font-weight: normal;
font-style: italic;
content: " (click to close topic)"
}
.closed + dd { height: 0pt; overflow: hidden; /* hide, but in DOM */
/* display : none */
}
.yes:after { content: ": Yes" }
.no:after { content: ": No" }
.extras * { border: thin solid; margin: 0.1em; background-color: lightgrey }
.uses *:first-child { margin: 0.1em; font-style: italic; font-weight: bold }
.uses *:not(:first-child) { margin: 0.1em; }
.license:before { content: "License: ";
margin: 0.1em; font-style: italic; font-weight: bold }
.license { margin: 0.1em; font-style: italic; }
.result { background-color: lightblue }
@media (max-width:50em) {
#toc { display: none }
}
@media (min-width:50em) {
#header { margin: 0em 0em 0em 14em; }
#toc { position: fixed; top: 0pt; left: 0pt;
max-height: 100%; overflow-y: auto;
margin: 0em 0em 0em 0em;
padding-left: 0.5em;
border: thin solid;
font-size: small;
background-color: lightgrey }
#toc .current { border: thin solid }
#list { margin: 0em 0em 0em 14em; overflow: auto }
}
</style>
<link href="https://github.com/clausreinke/js-tools/commits/gh-pages.atom" rel="alternate" title="Recent Commits to js-tools:gh-pages" type="application/atom+xml" />
</head>
<body>
<noscript>
Please enable Javascript, or view the <a href="resources.js">raw list of resources</a>.
</noscript>
<div id="header">
<em>A list of resources for the <a
href="http://groups.google.com/group/js-tools/about">js-tools mailing
list</a>
(<a href="http://clausreinke.github.com/js-tools/">more about the list</a>).
Descriptions are extracted from the resources we link
to.
<a href="https://github.com/clausreinke/js-tools/tree/gh-pages">The
resources list is in a github repo</a>, so you can easily follow updates via github or feed, and you can help to keep the list up to date - updates and corrections are welcome (just <a href="https://github.com/clausreinke/js-tools/issues/new" title="needs github login">open an issue</a>)!</em>
<hr>
<p id="buttons">
<em>Click individual topic headings to open or close, or</em>
<button type=button onclick="setAll('closed','open')">open all topics</button>
<button type=button onclick="setAll('open','closed')">close all topics</button>
</p>
<hr>
</div>
<dl id="toc" title="toc: click topic headings to open and scroll into view"></dl>
<dl id="list"></dl>
<script type="application/javascript">
if (typeof Array.prototype.forEach!=="function")
Array.prototype.forEach = function(cb){
for (var i=0; i<this.length; i++) cb(this[i])
};
function element(tag,attributes,children) {
var e = document.createElement(tag);
for (var a in attributes) e.setAttribute(a,attributes[a]);
for (var c in children) e.appendChild(children[c]);
return e;
}
function text(t) { return document.createTextNode(t) }
function extras(r) {
var info = [];
function extra(x) {
var sub;
if (r.extras.hasOwnProperty(x))
if (typeof r.extras[x]==="boolean")
info.push(element("span",{"class":r.extras[x] ? "yes" : "no"},[text(x)]))
else if (r.extras[x].match(/^http/))
info.push(element("a",{"href":r.extras[x]} ,[text(x)]))
else if (sub = r.extras[x].match(/^\[([^]*)\]\((.*)\)$/))
info.push(element("a",{"title":sub[1]
,"href":sub[2]} ,[text(x)]))
else if (r.extras[x].match(/^\(.*\)$/))
info.push(element("span",{"title":r.extras[x]},[text(x)]))
else
info.push(element("span",{},[text(x+': '+r.extras[x])]))
}
if (r.extras) {
["AST"
,"traversal"
,"source locations"
,"source maps"
,"comments preserved"
,"error tolerance"
,"active"
,"mailing list"
,"discussion"
,"blog"
,"github"
,"source repo"
,"documentation"
,"feed"
,"videos"
,"author on js-tools"
,"dependencies"
,"targets"
].forEach(extra);
return [element("div",{"class":"extras"},info)]
} else
return []
}
function uses(r) {
if (r.extras && r.extras.hasOwnProperty("uses")) {
return [element("div",{"class":"uses"}
,[element("span",{},[text("Uses: ")])]
.concat(r.extras.uses.map(function(u){
return element("a"
,{"href":'#entry:'+normalize(u)}
,[text(u)])
})))]
} else {
return []
}
}
function license(r) {
if (r.extras && r.extras.hasOwnProperty("license")) {
return [element("div",{"class":"license"
,"title":"please verify license on project site"}
,[text(r.extras.license)]
)]
} else {
return []
}
}
function entry(r) {
var classForType = r.type.replace(/\s/g,'-');
return [element("dt",{"class":classForType}
,[element("a",{"href":r.url
,"name":"entry:"+normalize(r.name)
}
, [text(r.name)])
,element("em",{},[text(" ("+r.type+")"
+(r.published ? ", "+r.published : "") )])])
,element("dd",{"class":classForType}
,extras(r).concat([text(r.description.join(""))])
.concat(uses(r))
.concat(license(r)))];
}
function normalize(name) {
return name.toLowerCase().replace(/\s/g,'-')
}
// almost standard now
ClassListAPI = { add: function(target,token) {
var classList = target.className===''
? []
: target.className.split(' ');
if (classList.indexOf(token)===-1) {
classList.push(token);
target.className = classList.join(' ');
}
},
contains : function(target,token) {
return (target.className.split(' ').indexOf(token)!==-1)
},
remove: function(target,token) {
target.className = target.className.split(' ')
.filter(function(t){
return t!==token
}).join(' ');
},
map: function(target,f) {
target.className = target.className.split(' ')
.map(f).join(' ');
}
};
function toggle(target) { // TODO: switch to ClassList-conform toggle
ClassListAPI.map(target,function(t){
switch(t) {
case "closed": return "open"; break;
case "open": return "closed"; break;
default: return t;
}
});
}
function scroll(tocTarget) {
var listName = tocTarget.children[0]
.name
.replace(/toc:/,'group:');
location.hash = '#'+listName;
}
function findGroupForElement(elem) {
while (elem && !(elem.name && elem.name.match(/^group:/))) {
if (elem.tagName==="DT"
&& elem.children
&& elem.children[0].name
&& elem.children[0].name.match(/^group:/)) {
elem = elem.children[0];
} else if (elem.tagName==="DD"
&& elem.previousSibling
&& elem.previousSibling.tagName==="DT") {
elem = elem.previousSibling;
} else {
elem = elem.parentNode;
}
}
return elem;
}
var resultSet = [];
function clearResultSet() {
resultSet.forEach(function(r){
ClassListAPI.remove(r,'result');
});
}
function show(targetName) {
var targets = document.getElementsByName(targetName);
var targetgroup,tocName,tocElem;
if (targetName.match(/^entry:/)) {
for(var i=0; i<targets.length; i++) {
ClassListAPI.add(targets[i],'result');
resultSet.push(targets[i]);
// find group target belongs to and highlight its toc
targetgroup = findGroupForElement(targets[i]);
if (targetgroup && targetgroup.name
&& targetgroup.name.match(/^group:/)) {
tocName = targetgroup.name.replace(/^group:/,'toc:');
tocElem = document.getElementsByName(tocName)[0];
ClassListAPI.add(tocElem,'result');
resultSet.push(tocElem);
}
}
}
for(var i=0; i<targets.length; i++) {
var target = targets[i];
while (target.id!=="list") {
if (ClassListAPI.contains(target,'closed')) {
toggle(target);
} else if (target.previousSibling
&& ClassListAPI.contains(target.previousSibling,'closed')) {
toggle(target.previousSibling);
}
target = target.parentNode;
}
}
targets[0] && targets[0].scrollIntoView();
}
function setAll(from,to) {
if (from===to) return;
var elements = document.getElementsByTagName("dt");
for (var i=0; i<elements.length; i++) {
if (ClassListAPI.contains(elements.item(i),from))
toggle(elements.item(i));
}
if (to==='closed') {
for (var g in groups) {
if (groups.hasOwnProperty(g) && groups[g]) {
toggle(document.getElementsByName('group:'+normalize(g))[0].parentNode);
}
}
}
}
var list = document.getElementById("list");
var toc = document.getElementById("toc");
var entries = {}, categories = [], list_groups = {}, toc_groups = {};
resources.map(function(r){
r.categories.map( function(cat){
cat in entries || ((entries[cat] = []) && categories.push(cat));
entries[cat].push(r)
})
});
function concatMap(f,arr) {
return [].concat.apply([],arr.map(f))
}
(function(){
for (var g in groups)
if (groups.hasOwnProperty(g)) {
var groupName = "group:"+normalize(g);
var tocGroupName = "toc:"+normalize(g);
var openclosed = groups[g] ? "open" : "closed";
toc.appendChild( element("dt",{"class": "toc"},[
element("a",{"name":tocGroupName
,"href":'#'+groupName
}
,[text(g)])
]) );
toc_groups[g] = element("dl",{},[ ]);
list.appendChild( element("dt",{"class": openclosed
,"onclick":"toggle(this)"},[
element("a",{"name":groupName},[text(g)])
]) );
list_groups[g] = element("dl",{},[ ]);
if (groups[g])
groups[g].map(function(cat){
var groupName = "group:"+normalize(cat);
var tocGroupName = "toc:"+normalize(cat);
toc_groups[g]
.appendChild( element("dt",{"class":"toc"}
,[ element("a",{"name":tocGroupName
,"href":'#'+groupName
}
,[text(cat)])
]) );
list_groups[g]
.appendChild( element("dt",{"class":"closed"
,"onclick":"toggle(this)"}
,[ element("a",{"name":groupName}
,[text(cat)])
]) );
list_groups[g]
.appendChild( element("dd",{},[
element("dl",{},concatMap(entry,entries[cat]))
]) );
});
else
list_groups[g] = element("dd",{},[
element("dl",{},concatMap(entry,entries[g]))
])
toc.appendChild( element("dd",{},[toc_groups[g]]) );
list.appendChild( element("dd",{},[list_groups[g]]) );
}
})();
categories.map(function(cat) {
var groupName = "group:"+normalize(cat);
if (!list_groups[ group[cat] || cat ]) {
list.appendChild( element("dt",{"class":"closed"
,"onclick":"toggle(this)"},[
element("a",{"name":groupName},[text(cat)])
]) );
list.appendChild( element("dd",{},[
element("dl",{},concatMap(entry,entries[cat]))
]) );
}
});
function showEntriesFromHash(){
clearResultSet();
if (location.hash.match(/^#entry:.*$/)
|| location.hash.match(/^#group:.*$/)) {
// direct link, open an entry or group
show(location.hash.slice(1).toLowerCase());
} else if (location.hash.match(/^#search:.*$/)) {
// search for and open matching entries
var pattern = location.hash.slice(8);
resources.filter(function(r){
return (r.type+r.name+r.description
+(r.extras?JSON.stringify(r.extras):''))
.match(new RegExp(pattern,'i'))
}).forEach(function(r){
show('entry:'+normalize(r.name))
});
}
}
function tocScroll(tocElem) {
var box = tocElem.getBoundingClientRect();
if (box.top<0) {
toc.scrollTop += box.top;
} else if (box.top>document.documentElement.clientHeight) {
toc.scrollTop = box.top;
}
}
var tocCurrent,groupCurrent,scrollCurrent;
function scrollHandler(event) {
event.stopPropagation();
var scroll = document.documentElement.scrollTop||document.body.scrollTop;
var x = window.screenX+document.documentElement.clientWidth/2;
var y = window.screenY;
var elem = document.elementFromPoint(x,y);
elem = findGroupForElement(elem);
if (elem && elem.name && elem.name.match(/^group:/)) {
var elemBox = elem.getBoundingClientRect();
var elemGroupBox = elem.parentNode.nextSibling.getBoundingClientRect();
var currentTop = groupCurrent && groupCurrent.getBoundingClientRect().top;
var currentGroupBox = groupCurrent && groupCurrent.parentNode
.nextSibling
.getBoundingClientRect();
if (!groupCurrent
||(scroll>scrollCurrent
&&Math.abs(currentGroupBox.bottom)>=Math.abs(elemBox.top))
||(scrollCurrent>scroll
&&Math.abs(currentTop)>=Math.abs(elemGroupBox.bottom))) { // don't flicker in gaps
// TODO: not quite right, tends to
// skip top groups when scrolling up
groupCurrent = elem;
scrollCurrent = scroll;
var tocName = elem.name.replace(/^group:/,'toc:');
var tocElem = document.getElementsByName(tocName)[0];
tocScroll(tocElem);
ClassListAPI.add(tocElem,'current');
if (tocCurrent && tocCurrent!==tocElem) {
ClassListAPI.remove(tocCurrent,'current');
}
tocCurrent = tocElem;
}
} else if ((document.documentElement.scrollTop||document.body.scrollTop)===0) {
toc.scrollTop = 0;
}
return false;
}
showEntriesFromHash();
window.onhashchange = showEntriesFromHash;
document.onscroll = scrollHandler;
</script>
</body>
</html>