-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
127 lines (115 loc) · 3.76 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
<!DOCTYPE html>
<html lang="en">
<head>
<title>IndigoJS Components</title>
<meta charset="UTF-8">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta name="author" content="David Gofman">
<link rel="stylesheet" type="text/css" href="build/static/css/index.css">
<script type="text/javascript" src="build/static/js/ejs.min.js"></script>
<!-- juiSpinner Localization -->
<script type="text/javascript" src="https://jqueryui.com/resources/demos/external/globalize/globalize.js"></script>
<script type="text/javascript" src="https://jqueryui.com/resources/demos/external/globalize/globalize.culture.ja-JP.js"></script>
<!-- Source Code styling -->
<link rel="stylesheet" type="text/css" href="build/static/css/ejs/styles.css">
<script type="text/javascript">
var indigoJS = {
DEBUG: false,
INFO: false,
contextPath: './build', //application URI
staticPath: '/static', //virtual path prefix to static files (images, fonts, PDF, vendor files etc.)
componentPath: '/components', //virtual path prefix to the components source files
};
function printSource(id) {
var frame = document.createElement('iframe');
frame.domain = document.domain;
frame.style.position = 'absolute';
frame.style.top = '-10000px';
document.body.appendChild(frame);
frame.contentDocument.write(document.querySelector(id + '>div>div').innerHTML);
frame.focus();
frame.contentWindow.print();
frame.parentNode.removeChild(frame);
}
</script>
</head>
<body>
<section class="igo-content igo"></section>
<section class="igo-content jui"></section>
<section class="igo-content core"></section>
<script type="text/javascript" src="build/static/js/builder.min.js" id="builder"></script>
<script type="text/javascript">
var contents = document.querySelectorAll('.igo-content'),
urls = {
igo: 'build/ejs/indigo_components.html',
jui: 'build/ejs/jqueryui_components.html',
core: 'build/ejs/data_binding.html'
}
var loadPage = function() {
var cls = (location.search.substring(1) || 'igo'),
active = document.querySelector('.igo-content.' + cls),
url = urls[cls];
for (var i = 0; i < contents.length; i++) {
contents[i].style.display = 'none';
}
if (url) {//lazzy loading
delete urls[cls];
if (indigoJS.builder) {
indigoJS.package(cls === 'jui' ? cls : 'igo', function(pkg) {
indigoJS.builder(url, active);
});
} else {
active.setAttribute('indigo-builder', url);
document.querySelector('#builder').setAttribute('indigo-pkgs', 'igo,jui');
}
}
active.style.display = 'flex';
};
window.onhashchange = function() {
loadPage();
};
loadPage();
for (i = 0; i < contents.length; i++) {
(function(content) {
content.addEventListener('CONTENT_LOADED', function() {
var div = content.querySelector('.right');
if (!div) return;
var map = {}, as = [], active, start = 0,
h1s = content.querySelectorAll('h1[id]');
for (var j = 0; j < h1s.length; j++) {
var top, h1 = h1s[j], next = h1s[j + 1],
a = content.querySelector('.left a[href*="#' + h1.id + '"]');
if (a) {
if (next) {
top = next.getBoundingClientRect().top;
} else {
top = div.scrollHeight;
}
map[h1.id] = {start: start, end: top, a: a};
as.push(a);
start = top;
}
}
div.onscroll = function() {
var pos = Math.max(div.scrollTop - 100, 0);
for (var id in map) {
var o = map[id];
if (pos >= o.start && pos < o.end) {
if (active !== o.a) {
active = o.a;
as.forEach(function(a) {
a.className = null;
});
active.className = 'selected';
return;
}
}
}
};
div.onscroll();
});
})(contents[i]);
}
</script>
</body>
</html>