-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
83 lines (76 loc) · 2.16 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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta content="initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no, width=device-width" name="viewport">
<style>
body {
margin: 0;
padding: 1em;
font-family: Roboto-Regular, HelveticaNeue, Arial, sans-serif
}
#repo-list {
line-height: 1.8;
list-style: none;
font-size: 110%;
}
</style>
<script>
(function () {
'use strict';
/**
* Add new repos here by hypenated directory name
*/
var repos = [
repoObj('horizontal-pager'),
repoObj('image-rect-finder'),
repoObj('scroll-collapse'),
repoObj('jump-scroll'),
repoObj('custom-sticky'),
repoObj('simple-scroll-intersection')
];
/**
* Create name, url object for directory in dist/
* @param {String} name - The hypenated directory name of the repo.
* @returns {Object} The repo object for populateRepoList.
*/
function repoObj (name) {
// hyphen to space
var repoName = name.replace(/(^.|\-.)/g,
function (m1, m2, offset, string) {
return offset > 0 ? ' '+m2.charAt(1).toUpperCase() : m2.toUpperCase();
});
return {
name: repoName,
url: 'dist/' + name
};
}
/**
* Build the repo list from `repos`.
*/
function populateRepoList () {
var repoList = document.querySelector('#repo-list');
repos.forEach(function (repo) {
var item = document.createElement('li');
var anchor = document.createElement('a');
var href = document.createAttribute('href');
anchor.innerText = repo.name;
href.value = repo.url;
anchor.attributes.setNamedItem(href);
item.appendChild(anchor);
repoList.appendChild(item);
});
}
document.addEventListener('DOMContentLoaded', populateRepoList, {
once: true
});
}());
</script>
</head>
<body>
<h1>LocalNerve UI Elements</h1>
<small>Demos of useful vanilla ui elements</small>
<ul id="repo-list">
</ul>
</body>
</html>