Mercurial Hosting > arkian
comparison src/site.js @ 0:45a3989c3447
start public repo
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 11 Sep 2025 15:26:39 -0600 |
parents | |
children | 38e5ff291f96 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:45a3989c3447 |
---|---|
1 'use strict'; | |
2 | |
3 function head() { | |
4 document.write(`\ | |
5 <meta name="viewport" content="width=device-width, initial-scale=1"> | |
6 <style> | |
7 @import "/site.css"; | |
8 </style> | |
9 ` ); | |
10 } | |
11 | |
12 function header() { | |
13 document.write(`\ | |
14 <div header> | |
15 <span breadcrumbs> | |
16 <a href="/">Arkian</a> | |
17 </span> | |
18 <span>by <a href="https://linkmy.style/fschmidt">fschmidt</a></span> | |
19 </div> | |
20 ` ); | |
21 } | |
22 | |
23 function showToc(content) { | |
24 document.writeln('<ul>'); | |
25 for( let id in content ) { | |
26 let info = content[id]; | |
27 document.writeln(`<li><a id="c_${id}" href="#${id}">${info.title}</a>`); | |
28 let subs = info.subs; | |
29 if( subs ) { | |
30 showToc(subs); | |
31 } | |
32 document.writeln('</li>'); | |
33 } | |
34 document.writeln('</ul>'); | |
35 } | |
36 | |
37 function showContent(content,h) { | |
38 for( let id in content ) { | |
39 let info = content[id]; | |
40 document.write(`\ | |
41 <div heading> | |
42 <h${h}><a id="${id}" href="#${id}">${info.title}</a></h${h}> | |
43 <a href="#c_${id}">contents</a> | |
44 </div> | |
45 ` ); | |
46 if( info.content ) | |
47 document.write(info.content); | |
48 let subs = info.subs; | |
49 if( subs ) { | |
50 showContent(subs,h+1) | |
51 } | |
52 } | |
53 } |