From e919d274bf05eafb803847fc8f7665c0aa7b716c Mon Sep 17 00:00:00 2001 From: Max Lehmann Date: Thu, 16 Apr 2020 16:14:40 +0200 Subject: [PATCH] curl TOC --- index.html | 97 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 86 insertions(+), 11 deletions(-) diff --git a/index.html b/index.html index 71037dd..d09f636 100644 --- a/index.html +++ b/index.html @@ -65,12 +65,12 @@ https://pad.xpub.nl/p/HTML_Finale
-
coverThis publication has been created with paged.js
+
cover
This publication has been created with paged.js
-

SWARM 01

+

SWARM 01

WE HAVE A USB FULL OF DOCUMENTS


There is no political power without control over the archive, if not over memory.

You can’t detach an archive from politics and the long history that formed it.

All contemporary phenomena must be understood contextually and historically, in relation to the power structures - or institutions - that shaped them, and are still shaping our understandings of ourselves, and of our times. @@ -80,21 +80,24 @@ https://pad.xpub.nl/p/HTML_Finale Is it possible to archive responsibly?
What would that practice be? How do you sensibly collect, understand, and then *structure* memories?
+

+
+
-
+
Commencement
& Commandement - -
+
+
@@ -231,7 +234,7 @@ https://pad.xpub.nl/p/HTML_Finale
-

MediaWiki

+

MediaWiki

icon @@ -257,9 +260,8 @@ https://pad.xpub.nl/p/HTML_Finale -
-
+
What comes *first* and therefore is *chief* ? @@ -2486,7 +2488,7 @@ https://pad.xpub.nl/p/HTML_Finale Wikipedia edit wars:
Conflict of interest or non-neutrality. -
When wikipedia administrators/editors +
When Wikipedia administrators/editors
keep going back and fourth
with statements in Wikipedia
due to a lack of source. @@ -2923,7 +2925,7 @@ https://pad.xpub.nl/p/HTML_Finale 3.2 Providing 'tools' for activation
3.3 The influence of design
3.4 Content and personality
- 3.6 Digital influence on zines collaborative publising
+ 3.6 Digital influence on zines collaborative publishing
3.7 On open tools for collaborative publishing
3.8 Creating hard copies: customising content
3.9 Recources & links

@@ -3142,10 +3144,83 @@ popup_button.addEventListener("click", function (e) { document.getElementsByTagName("body")[0].classList.add("pagedjs"); - $.getScript("https://unpkg.com/pagedjs/dist/paged.polyfill.js", function(data, textStatus, jqxhr) {}) + $.getScript("https://unpkg.com/pagedjs/dist/paged.polyfill.js", function(data, textStatus, jqxhr) { + + + + + class handlers extends Paged.Handler { + constructor(chunker, polisher, caller) { + super(chunker, polisher, caller); + } + + beforeParsed(content){ + createToc({ + content: content, + tocElement: '#my-toc-content', + titleElements: [ '.mw-content-ltr h2', 'h3' ] + }); + } + + } + Paged.registerHandlers(handlers); + + + + }) //window.print(); }; + + + + + //TOC + function createToc(config){ + const content = config.content; + const tocElement = config.tocElement; + const titleElements = config.titleElements; + + let tocElementDiv = content.querySelector(tocElement); + let tocUl = document.createElement("ul"); + tocUl.id = "list-toc-generated"; + tocElementDiv.appendChild(tocUl); + + // add class to all title elements let tocElementNbr = 0; + for(var i= 0; i < titleElements.length; i++){ + + let titleHierarchy = i + 1; + let titleElement = content.querySelectorAll(titleElements[i]); + + + titleElement.forEach(function(element) { + + // add classes to the element element.classList.add("title-element"); + element.setAttribute("data-title-level", titleHierarchy); + + // add id if doesn't exist tocElementNbr++; + idElement = element.id; + if(idElement == ''){ + element.id = 'title-element-' + tocElementNbr; + } + let newIdElement = element.id; + + }); + + } + + // create toc list let tocElements = content.querySelectorAll(".title-element"); + + for(var i= 0; i < tocElements.length; i++){ + let tocElement = tocElements[i]; + let tocNewLi = document.createElement("li"); + tocNewLi.classList.add("toc-element"); + tocNewLi.classList.add("toc-element-level-" + tocElement.dataset.titleLevel); + tocNewLi.innerHTML = '' + tocElement.innerHTML + ''; + tocUl.appendChild(tocNewLi); + } + + }