-
Notifications
You must be signed in to change notification settings - Fork 8
/
index.html
213 lines (179 loc) · 5.35 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
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
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>jQuery.Checkboxrange</title>
<!-- jQuery/jQueryUI (hosted) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.js"></script>
<!-- Markdown parser -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/pagedown/1.0/Markdown.Converter.min.js"></script>
<!-- Prettyprint -->
<link href="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css" rel="stylesheet" type="text/css"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.js"></script>
<!-- Index -->
<style>
body {
font-family: "Segoe UI", Verdana, Helvetica, Arial, sans-serif;
font-size: 11px;
padding: 3em 8em 1em 4em;
}
#menu {
margin-bottom: 2em;
}
#preview {
border: solid thin silver;
padding: 2em;
margin: 0 20%;
text-align: center;
box-shadow: 0 0 2em silver;
}
.chapter {
-webkit-columns: 460px;
-moz-columns: 460px;
columns: 460px;
-webkit-column-gap: 4em;
-moz-column-gap: 4em;
column-gap: 4em;
-webkit-column-rule: thin solid silver;
-moz-column-rule: thin solid silver;
column-rule: thin solid silver;
text-align: justify;
}
h1,
h2 {
background: black;
color: white;
padding: .2em .4em;
}
h1 {
margin-top: 1em;
}
h2 {
background: gray;
}
hr {
border-top: double;
margin: 2em 25%;
}
#footer {
margin-top: 4em;
text-align: center;
color: silver;
border-top: thin solid silver;
padding-top: 1em;
}
.output {
font-family: monospace;
border: solid thin silver;
padding: .2em .4em;
background-color: #cf3;
}
.clickable {
cursor: pointer;
}
pre {
tab-size: 4;
overflow-x: auto;
background-color: #eee;
-webkit-column-break-inside: avoid;
}
</style>
<script>
$(function() {
function tabsToSpaces(line, tabsize) {
var out = '',
tabsize = tabsize || 4,
c;
for (c in line) {
var ch = line.charAt(c);
if (ch === '\t') {
do {
out += ' ';
} while (out.length % tabsize);
} else {
out += ch;
}
}
return out;
}
function visualizeElement(element, type) {
var code = $(element).html().split('\n'),
tabsize = 4,
minlength = 2E53,
l;
// Convert tabs to spaces
for (l in code) {
code[l] = tabsToSpaces(code[l], tabsize);
}
// determine minimum length
var minlength = 2E53;
var first = 2E53;
var last = 0;
for (l in code) {
if (/\S/.test(code[l])) {
minlength = Math.min(minlength, /^\s*/.exec(code[l])[0].length);
first = Math.min(first, l);
last = Math.max(last, l);
}
}
code = code.slice(first, last + 1);
// strip tabs at start
for (l in code) {
code[l] = code[l].slice(minlength);
}
// recombine
code = code.join('\n');
var fragment = $('<pre class="prettyprint"><code/></pre>').text(code).insertAfter(element);
$('<h3 class="clickable">'+type+'…</h3>').insertBefore(fragment).click(function() {
fragment.slideToggle();
});
}
$('.year').text((new Date).getFullYear());
// extract html fragments
$('div.prettyprint, span.prettyprint').each(function() {
visualizeElement(this, 'HTML');
});
// extract scripts
$('script.prettyprint').each(function() {
visualizeElement(this, 'Javascript');
});
// Include the readme
var markdown = new Markdown.Converter();
$.get('README.md', function(readme) {
$('#readme').html(markdown.makeHtml(readme));
$('#readme h1').each(function() {
$(this).nextUntil('h1').wrapAll('<div class="chapter"/>');
});
$('#readme pre').addClass('prettyprint');
prettyPrint();
// build menu
var menuitems = [];
$('h1').each(function() {
var text = $(this).text(),
id = $(this).attr('id') || 'chapter '+text;
$(this).attr('id', id);
menuitems.push('<a href="#'+id+'">'+text+'</a>');
});
$(menu).html(menuitems.join(' — '));
}, 'html');
});
</script>
<!-- Plugin -->
<script src="jquery.checkboxrange.js"></script>
</head>
<body>
<a href="https://github.com/vanderlee/PHP-stable-sort-functions"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<div id="menu"></div>
<div id="book">
<div id="readme"></div>
<h1>Unittest</h1>
<div id="unittest" class="chapter">
Unittests are run automatically for each new version on [Travis-CI](https://travis-ci.org/vanderlee/PHP-stable-sort-functions)
</div>
</div>
<div id="footer">
Copyright © <span class="year">2015</span> Martijn van der Lee. MIT Open Source license applies.
</div>
</body>
</html>