/[genomes]/quickload/styling/autoindex_strapdown.js
ViewVC logotype

Contents of /quickload/styling/autoindex_strapdown.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 177 - (show annotations)
Mon Aug 14 14:16:52 2023 UTC (16 months, 1 week ago) by aloraine
File MIME type: application/javascript
File size: 1913 byte(s)
IGBF-3395 IGBF-3173 Get code from lorainelab CDN address
1 document.addEventListener('DOMContentLoaded', function() {
2 var b = document.body, xmp, strapdown;
3
4 // Hide the page while eviscerating it.
5 b.style.display = 'none';
6
7 // Set the title, if not empty.
8 if (conf.title) document.title += ' - ' + conf.title;
9
10 // Create a script element to fetch Strapdown.js.
11 strapdown = document.createElement('script');
12 // strapdown.setAttribute('src', conf.strapdown ? conf.strapdown : 'http://strapdownjs.com/v/0.2/strapdown.js');
13 //strapdown.setAttribute('src', conf.strapdown ? conf.strapdown : 'https://cdn.jsdelivr.net/gh/Naereen/StrapDown.js@master/strapdown.min.js');
14 // from: IGBF-3173 Karthik Raveendran edit, migrated
15 strapdown.setAttribute('src', conf.strapdown ? conf.strapdown : 'https://cdn.jsdelivr.net/gh/lorainelab/strapdown.js@main/strapdown.verbose.js');
16
17
18 // Create an XMP element for Strapdown.js to process.
19 xmp = document.createElement('xmp'),
20 xmp.setAttribute('theme', conf.theme);
21
22 // Loop through the body elements, accumulating text or HTML in the XMP.
23 // Mod_autoindex includes the HEADER/README as childless PRE-blocks, so they
24 // are accumulated as text. All other elements are accumulated as HTML.
25 //
26 // The reason to make the distinction between PRE-blocks with and without children
27 // is because mod_autoindex's FancyIndexing option generates the index inside a PRE.
28 // The FancyIndex PRE-blocks have many child elements, but HEADER/README PRE-blocks
29 // will have no child elements.
30 for (var c=b.children, i=0; i < c.length; i++) {
31 var e = c[i],
32 t = (e.nodeName == 'PRE' && e.children.length == 0) ? e.textContent : e.outerHTML;
33 xmp.innerHTML += t + '\n\n';
34 }
35
36 // Now that everything is copied into the XMP, clear the body.
37 while (b.lastChild) { b.removeChild(b.lastChild); }
38
39 // Insert the XMP and load Strapdown.js to render it.
40 b.appendChild(xmp);
41 b.appendChild(strapdown);
42 });

  ViewVC Help
Powered by ViewVC 1.1.26