From 80961773cb855124a9d2038d773d3dc1a81a6e11 Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Tue, 1 Jan 2019 21:10:21 +0100 Subject: [PATCH] icon+wrappercode --- icon/icon.svg | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++ js/main.js | 14 ++++++++--- manifest.json | 3 ++- 3 files changed, 81 insertions(+), 5 deletions(-) create mode 100644 icon/icon.svg diff --git a/icon/icon.svg b/icon/icon.svg new file mode 100644 index 0000000..f5debb6 --- /dev/null +++ b/icon/icon.svg @@ -0,0 +1,69 @@ + + + + + + + image/svg+xml + + + + + + + ( ) + + + + + + + + diff --git a/js/main.js b/js/main.js index ddc8af7..6417680 100644 --- a/js/main.js +++ b/js/main.js @@ -49,14 +49,20 @@ function wrapInner(parent, wrapper, attribute, attributevalue) { } } +function wrapInner(parent, wrapper, className) { + if (typeof wrapper === "string") + wrapper = document.createElement(wrapper); + wrapper.classList.add(className); + var div = parent.appendChild(wrapper); + + while(parent.firstChild !== wrapper) + wrapper.appendChild(parent.firstChild); +} -// Wrap the insides of the
 tags in  tags for highlight.js
 function wrapPre() {
     for(let el of document.querySelectorAll('pre')) {
-	let orig = el.innerHTML;
-
-	el.innerHTML = '' + orig + "";
+	wrapInner(el, 'code', 'lisp');
     }
 }
 
diff --git a/manifest.json b/manifest.json
index 7740d9a..12741e3 100644
--- a/manifest.json
+++ b/manifest.json
@@ -6,7 +6,8 @@
     "description": "Adds a simple table of contents and syntax highlighting to the web version of Practical Common Lisp by Peter Seibel.",
 
     "icons": {
-	"48": "icons/border-48.png"
+	"48": "./icon/icon.svg",
+	"96": "./icon/icon.svg"
     },
 
     "background": {