From edd8aa6e058d12dd0f9b0b886e507bd73dce72cb Mon Sep 17 00:00:00 2001 From: Chris Xiong Date: Sun, 9 Dec 2018 10:52:50 +0800 Subject: Load images asynchronously. Fix line endings in templates. Apply theme color. --- generator/main.js | 1 + generator/postrenderer.js | 15 ++- templates/list_template | 198 ++++++++++++++++++++------------------- templates/post_template | 230 ++++++++++++++++++++++++---------------------- 4 files changed, 236 insertions(+), 208 deletions(-) mode change 100644 => 100755 generator/main.js diff --git a/generator/main.js b/generator/main.js old mode 100644 new mode 100755 index ccdc380..e25d5f2 --- a/generator/main.js +++ b/generator/main.js @@ -1,3 +1,4 @@ +#!/usr/bin/node //Copyright Chris Xiong 2018 //License: Expat (MIT) const content_dir='../content'; diff --git a/generator/postrenderer.js b/generator/postrenderer.js index 8797c22..e387691 100644 --- a/generator/postrenderer.js +++ b/generator/postrenderer.js @@ -133,18 +133,25 @@ async function _render(inf,outf,np,pp) await encrypt(trd); //TOC - const l=trd.getElementById('article').querySelectorAll('h2,h3,h4,h5,h6'); - const tocroot=trd.getElementById('tocroot'); tocid=0; headerlist=[]; - for(let i of l) - if(!i.classList.contains('notoc'))headerlist.push(i); + trd.getElementById('article').querySelectorAll('h2,h3,h4,h5,h6').forEach( + (i)=>{if(!i.classList.contains('notoc'))headerlist.push(i);} + ); + const tocroot=trd.getElementById('tocroot'); for(let i=0;i ?) + trd.getElementById('article').querySelectorAll('img').forEach( + (i)=>{if(!i.getAttribute('decoding'))i.setAttribute('decoding','async');} + ); + //Tag list const tgs=meta[2].split(','); for(let i=0;i - - - - -Chrisoft::Blog - - - - - - - - - - - - - - - -
- -
-
-
-
-

-
-
-
-
-
-
- -
- - + + + + + + +Chrisoft::Blog + + + + + + + + + + + + + + + +
+ +
+
+
+
+

+
+
+
+
+
+
+ +
+ + diff --git a/templates/post_template b/templates/post_template index 92c6cc4..10a93fa 100644 --- a/templates/post_template +++ b/templates/post_template @@ -1,110 +1,120 @@ - - - - - -Chrisoft::Blog - - - - - - - - - - - - - - - - - - - - -
- -
-
-

-
-


-
-
- -
-
-
-