-
Notifications
You must be signed in to change notification settings - Fork 0
/
tootoo.html
337 lines (259 loc) · 6.6 KB
/
tootoo.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
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Open Index or Markdown with menu</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=contain">
<meta name="description"
content="File wrangler. Default index.html file. Opens HTML or Markdown files. Passes location.hash.">
<meta name="keywords" content="ShowDown,Markdown,AJAX,JavaScript,HTML,CSS,GitHub,FOSS">
<meta name="version" content="2023-02-02">
<style>
/* Copyright 2023 Theo Armour. MIT License */
:root {
font: 100% monospace;
--mnu-width: 20rem;
--margin: 0.5rem;
}
* {
box-sizing: border-box;
font-family: "Lato", sans-serif;
/* https://en.wikipedia.org/wiki/Lato_(typeface) */
scroll-behavior: smooth;
}
body {
margin: 0 auto;
max-width: 50rem;
}
a {
color: crimson;
text-decoration: none;
}
a:hover,
a:focus,
a:active {
text-decoration: underline;
}
aside {
border: 1px solid lightgray;
margin-top: 15px;
padding: 2px;
}
button,
input[type=button] {
background-color: #eee;
border: 2px #eee solid;
color: #888;
}
blockquote {
background-color: #ddd;
padding: 1rem;
}
code {
background-color: #eee;
}
pre {
background-color: #eee;
padding: 0.5rem;
}
summary {
cursor: pointer;
font-size: 1.5rem;
font-weight: bold;
outline: none;
}
::-webkit-scrollbar {
background: #333;
}
::-webkit-scrollbar-thumb {
background: crimson;
}
/* read me footer */
.aDingbat {
text-decoration: none;
font-size: 2rem;
}
.iframe-resize {
height: 400px;
max-width: 50rem;
overflow: hidden;
padding: 0.5rem;
resize: both;
width: 100%;
}
#main {
border: 0px solid red;
height: 100vh;
left: calc(var(--mnu-width) + 1.5rem);
position: absolute;
width: calc(100% - var(--mnu-width) - 2rem);
}
#divContent {
border: 0px solid red;
margin: 0 auto;
padding: 0 1rem;
max-width: 45rem;
}
#navMenu {
/* padding: 0 var( --margin); */
/* width */
background-color: #ddd;
);
border: 1px solid #8a8;
border-radius: var(--margin);
left: 0.25rem;
max-height: calc(100vh - 2rem);
padding: var(--margin);
position: fixed;
top: 1rem;
overflow: auto;
resize: both;
width: var(--mnu-width);
z-index: 1;
}
#sumNavMenu {
/* display: none; */
background-color: #eee;
border: 1px solid #8a8;
color: var(--color-3-text);
border-radius: var(--margin);
cursor: pointer;
left: var(--margin);
outline: none;
/* padding: var( --margin); */
padding: 0 0 0 0.2rem;
position: fixed;
top: var(--margin);
width: 20rem;
z-index: 2;
}
@media all and (max-width: 800px) {
#main {
left: 0;
padding: var(--margin);
width: 100%;
}
/* #navMenu {
display: block;
} */
#spnMenuHelp {
display: none;
}
#sumNavMenu {
font-size: 120%;
padding: var(--margin);
width: 3.5rem;
}
}
@media all and (max-height: 500px) {
#main {
left: 0;
padding: var(--margin);
width: 100%;
}
#spnMenuHelp {
display: none;
}
#sumNavMenu {
font-size: 120%;
padding: var(--margin);
width: 4rem;
}
}
</style>
</head>
<body>
<!-- https://github.com/showdownjs/showdown -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/showdown/2.1.0/showdown.min.js"></script>
<div id=divShowHide>
<details id=detNavMenu class="gmd-4">
<summary id=sumNavMenu class="summary-nav gmd-1" title="click to view or hide menu">
☰ <span id=spnMenuHelp>show↓ || hide↑ menu</span>
</summary>
<nav id="navMenu" class="gmd-4">
<div id=MNUdivHeader>
<header>
<h1>
<a id=aSource href="https://github.com/plain-javascript/awesome-list/" target="_top"
title="Click to go to the source code on GitHub">
<img src="https://pushme-pullyou.github.io/assets/svg/mark-github.svg">
</a>
<a href="" title="Click this title to reload this page">
<span id=MNUspnTitle>Plain JavaScript<br>Awesome List
</span><br>
<span id=MNUspnVersion>2023-02-02</span></a>
<span id="MNUinfoBox"></span>
</h1>
<div>
<a href="#./reference/README.md">Reference</a>
</div>
<div>
<a href="#resources/README.md">Resources</a>
</div>
<div>
<a href="#publications/README.md">Publications</a>
</div>
</header>
<footer>
<hr>
<center title="Hello! Click me to go up to the top"><a class=aDingbat
href=javascript:navMenu.scrollTo(0,0);> ❦ </a>
</center>
</footer>
</nav>
</details>
</div>
<main id="main">
<div id=divContent></div>
</main>
<script>
defaultFile = "./README.md";
//location.hash = ""; // test
//location.hash = "../style/style-sample-tags.html"
init();
function init () {
if ( window.innerWidth < 800 || window.innerHeight < 500 ) {
sumNavMenu.hidden = false;
detNavMenu.open = false;
} else {
const value = window.getComputedStyle( document.documentElement ).getPropertyValue( '--mnu-width' ); // #999999
//console.log( "value", value );
detNavMenu.style.width = value;
detNavMenu.style.maxWidth = "50%";
detNavMenu.open = true;
//navMenu.hidden = false;
sumNavMenu.hidden = true;
}
showdown.setFlavor( "github" );
if ( !location.hash ) { location.hash = defaultFile; }
location.hash.endsWith( ".md" ) ? onHashChange() : window.location.href = location.hash.slice( 1 );
window.addEventListener( "hashchange", onHashChange, false );
if ( location.protocol === "https:" ) {
window.history.pushState( "", "", "./" + location.hash );
}
}
function onHashChange () {
// if no file extension then probably an internal link
if ( !location.hash.includes( "." ) ) { return; }
const url = location.hash.slice( 1 );
const txt = url.split( "/" ).pop();
let title = txt
.split( "-" )
.filter( x => x.length > 0 )
.map( ( x ) => ( x.charAt( 0 ).toUpperCase() + x.slice( 1 ) ) )
.join( " " );
document.title = title;
const options = { openLinksInNewWindow: false, excludeTrailingPunctuationFromURLs: true, ghMention: true, simplifiedAutoLink: true, simpleLineBreaks: true, emoji: true };
const xhr = new XMLHttpRequest();
xhr.open( "get", url, true );
xhr.onload = () => {
let txt = xhr.responseText;
txt = txt.replace( /\<!--@@@/, "" ).replace( /\@@@--\>/, "" );
divContent.innerHTML = new showdown.Converter( options ).makeHtml( txt );
window.scrollTo( 0, 0 );
};
xhr.send( null );
}
</script>
</body>
</html>