Browse Source

fix bug && time support

pull/8/head
186526 1 year ago
parent
commit
cc49671f33
12 changed files with 155 additions and 30 deletions
  1. 8
      config.json
  2. 24
      src/js/loadvaline.js
  3. 2
      src/js/main-min.js
  4. 43
      src/js/main.js
  5. 2
      src/js/plugins/code-hightlight.js
  6. 1
      src/js/plugins/render-engine-marked-min.js
  7. 12
      src/js/plugins/render-engine-marked.js
  8. 2
      theme/classic/html/200.html
  9. 2
      theme/classic/src/intro-min.js
  10. 64
      theme/classic/src/intro.js
  11. 2
      theme/classic/src/main-min.css
  12. 23
      theme/classic/src/main.css

8
config.json

@ -12,7 +12,11 @@
"post": [
{
"url": "index",
"introduction": "Blogging is a simple and light-weight Blog Platform"
"introduction": "Blogging is a simple and light-weight Blog Platform",
"tags": [
"test","just a test"
],
"time": 1599319950426
}
],
"comment":{
@ -45,7 +49,7 @@
"depend": [
"https://cdn.jsdelivr.net/npm/[email protected]/marked.min.js"
],
"script": "https://cdn.jsdelivr.net/gh/186526/[email protected]/render-engine-marked.js",
"script": "src/js/plugins/render-engine-marked-min.js",
"loadtime": "init",
"defer": false
},

24
src/js/loadvaline.js

@ -1 +1,23 @@
blogging_info("Loading Valine..."); var GUEST = ["nick", "mail", "link"], guest = "nick,mail,link"; guest = guest.split(",").filter((function (e) { return GUEST.indexOf(e) > -1 })), load_comments = function () { new Valine({ el: "#comments", verify: comment.config.verify, notify: comment.config.notify, appId: comment.config.appId, appKey: comment.config.appKey, placeholder: comment.config.placeholder, avatar: "identicon", meta: guest, pageSize: "10", lang: comment.config.language || "en", path: window.location.search });blogging_info("Valine load finish")}, setTimeout("load_comments();", 1e3);
blogging_info("Loading Valine...");
var GUEST = ["nick", "mail", "link"],
guest = "nick,mail,link";
(guest = guest.split(",").filter(function (e) {
return GUEST.indexOf(e) > -1;
})),
(load_comments = function () {
new Valine({
el: "#comments",
verify: comment.config.verify,
notify: comment.config.notify,
appId: comment.config.appId,
appKey: comment.config.appKey,
placeholder: comment.config.placeholder,
avatar: "identicon",
meta: guest,
pageSize: "10",
lang: comment.config.language || "en",
path: window.location.search,
});
blogging_info("Valine load finish");
}),
whenAvailable("Valine",()=>{load_comments();});

2
src/js/main-min.js

@ -1 +1 @@
function blogging_info(t){console.log("%c Blogging %c "+t+" %c", "background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color:#fff", "background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff" ,"background: transparent");}function markdownrender(t){return marked(t)}function getpar(t){for(var e=window.location.search.substring(1).split("&"),n=0;n<e.length;n++){var s=e[n].split("=");if(s[0]==t&&null==s[1])return!0;if(s[0]==t)return s[1]}return!1}if(getpar("p"))settings={par:"p"};else if(getpar("url"))var settings={par:"url"};else if(getpar("page"))var settings={par:"page"};else window.location.search="?page=home";let t="/";var comment,config,mdcontent;for(let e of window.location.pathname.split("/").slice(1,-1))t=t+e+"/";settings.domain=window.location.protocol+"//"+window.location.host+t,blogging_info("init Blogging ..."),fetch("config.json").then(t=>{if(t.status>=200&&t.status<300)return blogging_info("Load config"),t;document.all[0].innerHTML="<h1>Error fetch config.json<br>Status Code="+t.status+"</h1>"}).then(t=>t.json()).then((function(t){for(i in config=t,settings.themeUrl=settings.domain+config.file.theme+config.theme+"/",settings.post=settings.domain+config.file.post,config.comment.config)comment=config.comment.config[i]})).then((function(){blogging_info("Load Plugin who loadtime = init");for(let t in config.plugins)if("init"==config.plugins[t].loadtime){blogging_info("Load "+config.plugins[t].name+" with defer enabled "+config.plugins[t].defer);for(let e in config.plugins[t].depend){let n=document.createElement("script");n.src=config.plugins[t].depend[e],document.head.append(n)}let e=document.createElement("script");e.src=config.plugins[t].script,config.plugins[t].defer&&(e.defer=!0),document.head.append(e)}setTimeout(()=>{blogging_info("Plugins load finnsh")},1)})).then((function(){"url"===settings.par?(blogging_info("Load post"),settings.content={url:decodeURIComponent(getpar(settings.par))},fetch(settings.content.url).then(t=>{if(settings.content.status=t.status,settings.date=new Date,t.status>=200&&t.status<300)return t;fetch(settings.themeUrl+"html/404.html").then(t=>t.text()).then((function(t){settings.content.success=!1,settings.content.preview={response:null,mdcontent:null},document.write(t)}))}).then(t=>t.text()).then(t=>(settings.content.preview={response:t},settings.content.preview.mdcontent=marked(t),markdownrender(t))).then(t=>{fetch(settings.themeUrl+"html/200.html").then(t=>t.text()).then((function(t){settings.content.success=!0,document.write(t)}))}).catch((function(t){return settings.content.preview.mdcontent=t.message,document.write(t.message),t.message}))):"p"===settings.par?(blogging_info("Load post"),settings.content={url:decodeURIComponent(settings.post+getpar(settings.par)+".md")},fetch(settings.content.url).then(t=>{if(settings.content.status=t.status,settings.date=new Date,t.status>=200&&t.status<300)return t;fetch(settings.themeUrl+"html/404.html").then(t=>t.text()).then((function(t){settings.content.success=!1,settings.content.preview={response:null,mdcontent:null},document.write(t)}))}).then(t=>t.text()).then(t=>(settings.content.preview={response:t},settings.content.preview.mdcontent=marked(t),markdownrender(t))).then(t=>{fetch(settings.themeUrl+"html/200.html").then(t=>t.text()).then((function(t){settings.content.success=!0,document.write(t)}))}).catch((function(t){return settings.content.preview.mdcontent=t.message,document.write(t.message),t.message}))):"page"===settings.par&&(blogging_info("geting page"),settings.content={url:settings.themeUrl+"html/"+getpar(settings.par)+".html"},fetch(settings.content.url).then(t=>{if(settings.content.status=t.status,settings.date=new Date,t.status>=200&&t.status<300)return t;fetch(settings.themeUrl+"html/404.html").then(t=>t.text()).then((function(t){settings.content.success=!1,settings.content.preview={response:null,mdcontent:null},document.write(t)}))}).then(t=>t.text()).then(t=>{settings.content.success=!0,settings.content.preview={response:t},document.write(t)}))})).then((function(){blogging_info("rendering content")}));
function blogging_info(t){console.log("%c Blogging %c "+t+" %c", "background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color:#fff", "background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff" ,"background: transparent");}function whenAvailable(t,e){window.setTimeout((function(){window[t]?e(window[t]):window.setTimeout(arguments.callee,100)}),100)}function getpar(t){for(var e=window.location.search.substring(1).split("&"),n=0;n<e.length;n++){var s=e[n].split("=");if(s[0]==t&&null==s[1])return!0;if(s[0]==t)return s[1]}return!1}if(getpar("p"))settings={par:"p"};else if(getpar("url"))var settings={par:"url"};else if(getpar("page"))var settings={par:"page"};else window.location.search="?page=home";let t="/";var comment,config,mdcontent;for(let e of window.location.pathname.split("/").slice(1,-1))t=t+e+"/";settings.domain=window.location.protocol+"//"+window.location.host+t,blogging_info("init Blogging ..."),fetch("config.json").then(t=>{if(t.status>=200&&t.status<300)return blogging_info("Load config"),t;document.all[0].innerHTML="<h1>Error fetch config.json<br>Status Code="+t.status+"</h1>"}).then(t=>t.json()).then((function(t){for(i in config=t,settings.themeUrl=settings.domain+config.file.theme+config.theme+"/",settings.post=settings.domain+config.file.post,config.comment.config)comment=config.comment.config[i]})).then(t=>{a=document.createElement("link"),a.rel="prefetch","page"===settings.par?a.href=settings.themeUrl+"html/"+getpar(settings.par)+".html":"url"!==settings.par&&"p"!==settings.par||(a.href=settings.themeUrl+"html/200.html"),document.head.append(a)}).then((function(){blogging_info("Load Plugin who loadtime = init");for(let t in config.plugins)if("init"==config.plugins[t].loadtime){blogging_info("Load "+config.plugins[t].name+" with defer enabled "+config.plugins[t].defer);for(let e in config.plugins[t].depend){let n=document.createElement("script");n.src=config.plugins[t].depend[e],document.head.append(n)}let e=document.createElement("script");e.src=config.plugins[t].script,config.plugins[t].defer&&(e.defer=!0),document.head.append(e)}})).then(()=>{whenAvailable("markdownrender",()=>(blogging_info("Markdown Render Load finish"),114514))}).then((function(){"url"===settings.par?(blogging_info("Load post"),settings.content={url:decodeURIComponent(getpar(settings.par))},fetch(settings.content.url).then(t=>{if(settings.content.status=t.status,settings.date=new Date,t.status>=200&&t.status<300)return t;fetch(settings.themeUrl+"html/404.html").then(t=>t.text()).then((function(t){settings.content.success=!1,settings.content.preview={response:null,mdcontent:null},document.write(t)}))}).then(t=>t.text()).then(t=>(settings.content.preview={response:t},settings.content.preview.mdcontent=marked(t),markdownrender(t))).then(t=>{fetch(settings.themeUrl+"html/200.html").then(t=>t.text()).then((function(t){settings.content.success=!0,document.write(t)}))}).catch((function(t){return settings.content.preview.mdcontent=t.message,document.write(t.message),t.message}))):"p"===settings.par?(blogging_info("Load post"),settings.content={url:decodeURIComponent(settings.post+getpar(settings.par)+".md")},fetch(settings.content.url).then(t=>{if(settings.content.status=t.status,settings.date=new Date,t.status>=200&&t.status<300)return t;fetch(settings.themeUrl+"html/404.html").then(t=>t.text()).then((function(t){settings.content.success=!1,settings.content.preview={response:null,mdcontent:null},document.write(t)}))}).then(t=>t.text()).then(t=>(settings.content.preview={response:t},settings.content.preview.mdcontent=marked(t),markdownrender(t))).then(t=>{fetch(settings.themeUrl+"html/200.html").then(t=>t.text()).then((function(t){settings.content.success=!0,document.write(t)}))}).catch((function(t){return settings.content.preview.mdcontent=t.message,document.write(t.message),t.message}))):"page"===settings.par&&(blogging_info("geting page"),settings.content={url:settings.themeUrl+"html/"+getpar(settings.par)+".html"},fetch(settings.content.url).then(t=>{if(settings.content.status=t.status,settings.date=new Date,t.status>=200&&t.status<300)return t;fetch(settings.themeUrl+"html/404.html").then(t=>t.text()).then((function(t){settings.content.success=!1,settings.content.preview={response:null,mdcontent:null},document.write(t)}))}).then(t=>t.text()).then(t=>{settings.content.success=!0,settings.content.preview={response:t},document.write(t)}))})).then((function(){blogging_info("rendering content")}));

43
src/js/main.js

@ -5,8 +5,15 @@
* Build with Love & bug
*/
function blogging_info(t){console.log("%c Blogging %c "+t+" %c", "background:#35495e ; padding: 1px; border-radius: 3px 0 0 3px; color:#fff", "background:#41b883 ; padding: 1px; border-radius: 0 3px 3px 0; color: #fff" ,"background: transparent");}
function markdownrender(t) {
return marked(t);
function whenAvailable(name, callback) {
var interval = 100; // ms
window.setTimeout(function () {
if (window[name]) {
callback(window[name]);
} else {
window.setTimeout(arguments.callee, interval);
}
}, interval);
}
function getpar(r) {
for (
@ -62,11 +69,26 @@ fetch("config.json")
comment = config.comment.config[i];
}
})
.then((e) => {
a = document.createElement("link");
a.rel = "prefetch";
if (settings.par === "page") {
a.href = settings.themeUrl + "html/" + getpar(settings.par) + ".html";
} else if (settings.par === "url" || settings.par === "p") {
a.href = settings.themeUrl + "html/200.html";
}
document.head.append(a);
})
.then(function () {
blogging_info("Load Plugin who loadtime = init");
for (let i in config.plugins) {
if (config.plugins[i].loadtime == "init") {
blogging_info("Load "+config.plugins[i].name+ " with defer enabled "+config.plugins[i].defer);
blogging_info(
"Load " +
config.plugins[i].name +
" with defer enabled " +
config.plugins[i].defer
);
for (let b in config.plugins[i].depend) {
let a = document.createElement("script");
a.src = config.plugins[i].depend[b];
@ -74,15 +96,17 @@ fetch("config.json")
}
let a = document.createElement("script");
a.src = config.plugins[i].script;
if (config.plugins[i].defer){
if (config.plugins[i].defer) {
a.defer = true;
}
document.head.append(a);
}
}
setTimeout(() => {
blogging_info("Plugins load finnsh");
},1);
}).then(()=>{
whenAvailable("markdownrender", () => {
blogging_info("Markdown Render Load finish");
return 114514;
});
})
.then(function () {
if (settings.par === "url") {
@ -206,6 +230,7 @@ fetch("config.json")
document.write(content);
});
}
}).then(function(){
blogging_info("rendering content");
})
.then(function () {
blogging_info("rendering content");
});

2
src/js/plugins/code-hightlight.js

@ -1 +1 @@
!function(){let e=document.createElement("link");e.rel="stylesheet subresource",e.href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css",document.head.append(e);let t=document.createElement("link");t.rel="subresource",t.href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js",document.head.append(t),setTimeout(()=>{hljs.initHighlighting()},250)}();
!function(){let e=document.createElement("link");e.rel="stylesheet subresource",e.href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css",document.head.append(e);let t=document.createElement("link");t.rel="subresource",t.href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js",document.head.append(t),whenAvailable("hljs",()=>{hljs.initHighlighting()})}();

1
src/js/plugins/render-engine-marked-min.js

@ -0,0 +1 @@
let js=document.createElement("link");function markdownrender(e){return marked(e)}whenAvailable("marked",()=>(blogging_info("Marked Load finish"),114514)),js.rel="subresource",js.href="https://cdn.jsdelivr.net/npm/[email protected]/marked.min.js",document.head.append(js);

12
src/js/plugins/render-engine-marked.js

@ -1 +1,11 @@
let js=document.createElement("link");function markdownrender(e){return marked(e)}js.rel="subresource",js.href="https://cdn.jsdelivr.net/npm/[email protected]/marked.min.js",document.head.append(js);
let js = document.createElement("link");
whenAvailable("marked", () => {
blogging_info("Marked Load finish");
return 114514;
});
function markdownrender(e) {
return marked(e);
}
(js.rel = "subresource"),
(js.href = "https://cdn.jsdelivr.net/npm/[email protected]/marked.min.js"),
document.head.append(js);

2
theme/classic/html/200.html

@ -20,7 +20,7 @@
</span>
</span>
<p><a href="?page=home" style="vertical-align: middle;"><i class="material-icons arrow_back"
style="vertical-align: middle;"></i>Back</a></p>
style="vertical-align: middle;"></i>Back</a><div id="func"></div></p>
<div id="content">
</div>
<div id="comments" style="margin-top:10%">

2
theme/classic/src/intro-min.js

@ -1 +1 @@
async function get_posts_content(e,n){let t={};return await fetch(e.url).then(e=>e.text()).then(e=>(t.preview={response:e},t.preview.mdcontent=markdownrender(e),markdownrender(e))).then(e=>{document.getElementsByClassName("none")[0].innerHTML=e,imgs=document.getElementsByClassName("none")[0].getElementsByTagName("img");for(let e=0;e<imgs.length;e++)imgs[e].src=""}).then((function(){t.preview.title=document.getElementsByClassName("none")[0].getElementsByTagName("h1")[0].innerText,t.preview.intro=config.post[n].introduction})).then((function(){return"?page=archive"===window.location.search?t.container='<div class="post-container"><h1>'+t.preview.title+'</h1><div class="post-info">'+t.preview.mdcontent+'</div><p><a href="?p='+config.post[n].url+'">Reading<i class="material-icons arrow_forward"></i></a></p></div>':t.container='<div class="post-container"><h1>'+t.preview.title+'</h1><p class="post-intro">'+t.preview.intro+'</p><p><a href="?p='+config.post[n].url+'">Reading<i class="material-icons arrow_forward"></i></a></p></div>',t.container})).then(e=>{document.getElementById("post").innerHTML+=e}).then((function(){document.getElementsByClassName("none")[0].innerHTML=""})),""}async function init_post_container(){var e="";for(let n=0;n<config.post.length;n++){const t={};t.url=settings.post+config.post[n].url+".md",e+=get_posts_content(t,n)}return e}async function init_plugins(){blogging_info("Load Plugin who loadtime = themerender");for(let e in config.plugins)if("themerender"===config.plugins[e].loadtime){blogging_info("Load "+config.plugins[e].name+" with defer enabled "+config.plugins[e].defer);for(let n in config.plugins[e].depend){let t=document.createElement("script");t.src=config.plugins[e].depend[n],await document.head.appendChild(t)}let n=document.createElement("script");n.src=config.plugins[e].script,config.plugins[e].deferS&&(n.defer=!0),document.head.append(n)}setTimeout(()=>{blogging_info("plugins load finnsh")},1)}function loadcomments(){if(config.comment.enable){blogging_info("Start load comment");for(let e in comment.depend.js)a=document.createElement("script"),a.src=comment.depend.js[e],document.getElementById("jscomments").append(a);a=document.createElement("script"),a.src=settings.domain+"src/js/"+comment.load,a.defer="defer",document.getElementById("jscomments").append(a)}}function config_page(){var e=document.getElementsByTagName("img");for(let n=0;n<e.length;n++)e[n].loading="lazy";let n=document.createElement("link");n.rel="shortcut icon",n.href=config.theme_config.avatar,document.head.append(n)}if(document.getElementById("avatar").src=config.theme_config.avatar,document.getElementById("intro-text-title").innerHTML=config.theme_config.author+"'s Blog",document.getElementById("intro-text-intro").innerHTML="—— "+config.theme_config.introduction,getpar("page"))init_plugins(),config_page(),init_post_container();else{let e=!0;e&&document.getElementById("comments").getBoundingClientRect().top<=1300&&(loadcomments(),e=!1,document.onscroll=function(){}),document.onscroll=function(){e&&document.getElementById("comments").getBoundingClientRect().top<=1300&&(loadcomments(),e=!1,document.onscroll=function(){})},init_plugins(),config_page()}document.getElementById("des").content=config.theme_config.introduction;
async function get_posts_content(e,t){let n={};return await fetch(e.url).then(e=>e.text()).then(e=>(n.preview={response:e},n.preview.mdcontent=markdownrender(e),markdownrender(e))).then(e=>{document.getElementsByClassName("none")[0].innerHTML=e,imgs=document.getElementsByClassName("none")[0].getElementsByTagName("img");for(let e=0;e<imgs.length;e++)imgs[e].src=""}).then((function(){n.preview.title=document.getElementsByClassName("none")[0].getElementsByTagName("h1")[0].innerText,n.preview.intro=config.post[t].introduction})).then((function(){return"?page=archive"===window.location.search?n.container='<div class="post-container"><h1>'+n.preview.title+'</h1><div class="post-info">'+n.preview.mdcontent+'</div><div class="post-time"><i class="material-icons date_range"></i>'+loadtime(config.post[t].url).posttime+'</div><p><a href="?p='+config.post[t].url+'">Reading<i class="material-icons arrow_forward"></i></a></p></div>':n.container='<div class="post-container"><h1>'+n.preview.title+'</h1><p class="post-intro">'+n.preview.intro+'</p><div class="post-time"><i class="material-icons date_range"></i>'+loadtime(config.post[t].url).posttime+'</div><p><a href="?p='+config.post[t].url+'">Reading<i class="material-icons arrow_forward"></i></a></p></div>',n.container})).then(e=>{document.getElementById("post").innerHTML+=e}).then((function(){document.getElementsByClassName("none")[0].innerHTML=""})),""}async function init_post_container(){var e="";for(let t=0;t<config.post.length;t++){const n={};n.url=settings.post+config.post[t].url+".md",e+=get_posts_content(n,t)}return e}async function init_plugins(){blogging_info("Load Plugin who loadtime = themerender");for(let e in config.plugins)if("themerender"===config.plugins[e].loadtime){blogging_info("Load "+config.plugins[e].name+" with defer enabled "+config.plugins[e].defer);for(let t in config.plugins[e].depend){let n=document.createElement("script");n.src=config.plugins[e].depend[t],await document.head.appendChild(n)}let t=document.createElement("script");t.src=config.plugins[e].script,config.plugins[e].deferS&&(t.defer=!0),document.head.append(t)}setTimeout(()=>{blogging_info("plugins load finish")},1)}function loadcomments(){if(config.comment.enable){blogging_info("Start load comment");for(let e in comment.depend.js)a=document.createElement("script"),a.src=comment.depend.js[e],document.getElementById("jscomments").append(a);a=document.createElement("script"),a.src=settings.domain+"src/js/"+comment.load,a.defer="defer",document.getElementById("jscomments").append(a)}}document.getElementById("avatar").src=config.theme_config.avatar,document.getElementById("intro-text-title").innerHTML=config.theme_config.author+"'s Blog",document.getElementById("intro-text-intro").innerHTML="—— "+config.theme_config.introduction;var loadtime=e=>{for(let t in config.post)if(e===config.post[t].url)return{postunixtimestamp:Math.round(config.post[t].time/1e3),posttime:new Date(Math.round(config.post[t].time)).toLocaleString(),nowtime:(new Date).toLocaleString()}},gettime=e=>{let t=document.createElement("div"),n=document.createElement("i");return n.classList="material-icons date_range",t.append(n),t.classList="posttime",t.innerHTML+=loadtime(e).posttime,t};function config_page(){var e=document.getElementsByTagName("img");for(let t=0;t<e.length;t++)e[t].loading="lazy";let t=document.createElement("link");t.rel="shortcut icon",t.href=config.theme_config.avatar,document.head.append(t)}async function init_post(){document.getElementById("func").append(gettime("index"))}if(getpar("page"))init_plugins(),config_page(),init_post_container();else{let e=!0;e&&document.getElementById("comments").getBoundingClientRect().top<=1300&&(loadcomments(),e=!1,document.onscroll=function(){}),document.onscroll=function(){e&&document.getElementById("comments").getBoundingClientRect().top<=1300&&(loadcomments(),e=!1,document.onscroll=function(){})},init_plugins(),config_page(),init_post()}document.getElementById("des").content=config.theme_config.introduction;

64
theme/classic/src/intro.js

@ -5,7 +5,8 @@ document.getElementById("intro-text-intro").innerHTML =
"—— " + config.theme_config.introduction;
async function get_posts_content(post_url, x) {
let post_container = "", post = {};
let post_container = "",
post = {};
await fetch(post_url.url)
.then((response) => response.text())
.then((content) => {
@ -37,6 +38,8 @@ async function get_posts_content(post_url, x) {
post.preview.title +
'</h1><div class="post-info">' +
post.preview.mdcontent +
'</div><div class="post-time"><i class="material-icons date_range"></i>' +
loadtime(config.post[x].url).posttime +
'</div><p><a href="?p=' +
config.post[x].url +
'">Reading<i class="material-icons arrow_forward"></i></a></p></div>';
@ -46,7 +49,9 @@ async function get_posts_content(post_url, x) {
post.preview.title +
'</h1><p class="post-intro">' +
post.preview.intro +
'</p><p><a href="?p=' +
'</p><div class="post-time"><i class="material-icons date_range"></i>' +
loadtime(config.post[x].url).posttime +
'</div><p><a href="?p=' +
config.post[x].url +
'">Reading<i class="material-icons arrow_forward"></i></a></p></div>';
}
@ -75,7 +80,12 @@ async function init_plugins() {
blogging_info("Load Plugin who loadtime = themerender");
for (let i in config.plugins) {
if (config.plugins[i].loadtime === "themerender") {
blogging_info("Load " + config.plugins[i].name + " with defer enabled " + config.plugins[i].defer);
blogging_info(
"Load " +
config.plugins[i].name +
" with defer enabled " +
config.plugins[i].defer
);
for (let b in config.plugins[i].depend) {
let a = document.createElement("script");
a.src = config.plugins[i].depend[b];
@ -90,7 +100,7 @@ async function init_plugins() {
}
}
setTimeout(() => {
blogging_info("plugins load finnsh");
blogging_info("plugins load finish");
}, 1);
}
@ -109,6 +119,28 @@ function loadcomments() {
}
}
var loadtime = (posturl) => {
for (let x in config.post) {
if (posturl === config.post[x].url) {
return {
postunixtimestamp: Math.round(config.post[x].time / 1000),
posttime: new Date(Math.round(config.post[x].time)).toLocaleString(),
nowtime: new Date().toLocaleString(),
};
}
}
};
var gettime = (e) => {
let a = document.createElement("div");
let icon = document.createElement("i");
icon.classList = "material-icons date_range";
a.append(icon);
a.classList = "posttime";
a.innerHTML += loadtime(e).posttime;
return a;
};
function config_page() {
var imgs = document.getElementsByTagName("img");
for (let i = 0; i < imgs.length; i++) {
@ -120,24 +152,36 @@ function config_page() {
document.head.append(a);
}
async function init_post() {
document.getElementById("func").append(gettime("index"));
}
if (getpar("page")) {
init_plugins(); config_page();
init_plugins();
config_page();
init_post_container();
} else {
let finished = true;
if(finished && document.getElementById("comments").getBoundingClientRect().top<=1300){
if (
finished &&
document.getElementById("comments").getBoundingClientRect().top <= 1300
) {
loadcomments();
finished = false;
document.onscroll = function(){};
document.onscroll = function () {};
}
document.onscroll = function(){
if(finished && document.getElementById("comments").getBoundingClientRect().top<=1300){
document.onscroll = function () {
if (
finished &&
document.getElementById("comments").getBoundingClientRect().top <= 1300
) {
loadcomments();
finished = false;
document.onscroll = function(){};
document.onscroll = function () {};
}
};
init_plugins();
config_page();
init_post();
}
document.getElementById("des").content = config.theme_config.introduction;

2
theme/classic/src/main-min.css

@ -1 +1 @@
@import url("https://fonts.geekzu.org/icon?family=Material+Icons");@import url('https://fonts.geekzu.org/css2?family=Fira+Code&family=Noto+Sans+SC&family=Roboto&display=swap');*{padding:0;margin:0;font-family:"PingFang SC","更纱黑体 UI SC","Sarasa UI SC","Roboto","Noto Sans SC",sans-serif;--dark-text:#efefef;--dark-background:#000;--dark-background-darker:#111;--dark-text-darker:#aaa;--highlight:#a81900;--white-text:#111111;--white-background:#fff;--white-background-darker:#efefef;--white-text-darker:#626262;line-height:150%;word-wrap:break-word}.hoverlink:hover{color:var(--highlight)}.hoverlink{color:var(--white-text-darker)}h1{padding-top:5%;padding-bottom:3%;font-size:49.5px}h2{padding-top:5%;padding-bottom:3%;font-size:38.5px}h3{padding-top:5%;padding-bottom:3%;font-size:32.5px}h4{padding-top:5%;padding-bottom:3%;font-size:30.5px}h5{padding-top:5%;padding-bottom:3%;font-size:25px}hr{height:1.5px;background-color:#767676;border-color:#767676;border-radius:200px;margin:16px}table,ol{padding-top:5%;padding-bottom:3%}.siteinfo{bottom:-100px;position:absolute;font-size:15.6444px;left:0;right:0;margin:1.5% 10%}a{color:var(--highlight);text-decoration:none}#aboutme{float:right}p,ul,li{font-size:22px}footer{color:var(--white-text-darker)}pre{overflow:auto;margin-top:5%;margin-bottom:3%;padding:20px;border-radius:20px;border:2px solid var(--white-background-darker);background-color:var(--white-background-darker)}code,code *{overflow-y:hidden;overflow-x:scroll;font-family:"JetBrains Mono",Fira Code,Sarasa Mono SC,Cascadia Code,Menlo,Consolas,monaco,monospace}.post-container{margin:5% 0%;border-radius:20px;border:2px solid var(--white-background-darker);background-color:var(--white-background-darker)}.post-container *{padding:0%;margin:0%}.post-container h1{padding:3% 5%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.post-container p{padding:3% 5%;color:var(--white-text-darker)}.post-container a{vertical-align:middle}.post-container i{vertical-align:middle;padding:0% 1%}i{vertical-align:middle;padding:0% 1%}.post-info *{color:var(--white-text-darker);font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:15px;padding:0% 5%}.post-info img{padding:0%}.post-info table,.post-info table *{padding:0%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.arrow_forward::before{content:"arrow_forward"}.arrow_back::before{content:"arrow_back"}#container{position:relative;height:auto;margin:5% 10%}.head *{display:inline;padding:5%}.head .h1{font-size:40px}.head .h3{font-size:30px;white-space:nowrap}.intro{display:inline-block;margin-bottom:4%}.intro *{vertical-align:middle;display:inline}.intro span{display:inline-block}.intro h1{margin-left:10px;font-size:40px;padding:0}#intro-text-intro{font-size:25px;color:var(--dark-text-darker)}.intro #avatar{padding:0%;border-radius:50px;height:96px;width:96px}img{max-width:100%;padding-top:5%;padding-bottom:3%;left:0;right:0;position:relative}table{padding-top:5%;padding-bottom:3%}.none{display:none}.v p{font-size:20px}blockquote{margin:1em 3em 1em 2em;padding-left:1em;border-left:4px solid rgba(0,0,0,.12)}blockquote:last-child{margin-bottom:0}blockquote p{font-size:20px}blockquote footer{margin-top:1%}@media (prefers-color-scheme:dark){body{color:var(--dark-text);background-color:var(--dark-background)}footer{color:var(--dark-text-darker)}pre{border:2px solid var(--dark-background-darker);background-color:var(--dark-background-darker)}.hljs{background:var(--dark-background-darker);color:var(--dark-text)}.post-container{border:2px solid var(--dark-background-darker);background-color:var(--dark-background-darker)}.hoverlink{color:var(--dark-text-darker)}.post-info *,.post-container p{color:var(--dark-text-darker)}blockquote{border-left-color:rgba(255,255,255,.12)}}@media screen and (max-width:1165px){#blogginginfo{display:none}.siteinfo{text-align:center}#aboutme{float:none;margin:0 auto}}@media screen and (max-width:790px){.head *{padding:4%}.intro{display:block;text-align:center}}@media screen and (max-width:700px){h1{font-size:40px}#aboutme{font-size:14px}.head .display_none{display:none}.intro h1{display:block}.post-container .post-intro{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.post-container h1{font-size:30px}p{font-size:20px}.v h1{font-size:25px}.v p{font-size:18px}blockquote{margin:1em}}@media screen and (max-width:480px){.head *{padding:1%}}
@import url("https://fonts.geekzu.org/icon?family=Material+Icons");@import url('https://fonts.geekzu.org/css2?family=Fira+Code&family=Noto+Sans+SC&family=Roboto&display=swap');*{padding:0;margin:0;font-family:"PingFang SC","更纱黑体 UI SC","Sarasa UI SC","Roboto","Noto Sans SC",sans-serif;--dark-text:#efefef;--dark-background:#000;--dark-background-darker:#111;--dark-text-darker:#aaa;--highlight:#a81900;--white-text:#111111;--white-background:#fff;--white-background-darker:#efefef;--white-text-darker:#626262;line-height:150%;word-wrap:break-word;}.hoverlink:hover{color:var(--highlight);}.hoverlink{color:var(--white-text-darker);}h1{padding-top:5%;padding-bottom:3%;font-size:49.5px;}h2{padding-top:5%;padding-bottom:3%;font-size:38.5px;}h3{padding-top:5%;padding-bottom:3%;font-size:32.5px;}h4{padding-top:5%;padding-bottom:3%;font-size:30.5px;}h5{padding-top:5%;padding-bottom:3%;font-size:25px;}hr{height:1.5px;background-color:#767676;border-color:#767676;border-radius:200px;margin:16px;}table,ol{padding-top:5%;padding-bottom:3%;}.siteinfo{bottom:-100px;position:absolute;font-size:15.6444px;left:0;right:0;margin:1.5% 10%;}a{color:var(--highlight);text-decoration:none;}#aboutme{float:right;}p,ul,li{font-size:22px;}footer{color:var(--white-text-darker);}pre{overflow:auto;margin-top:5%;margin-bottom:3%;padding:20px;border-radius:20px;border:2px solid var(--white-background-darker);background-color:var(--white-background-darker);}code,code *{overflow-y:hidden;overflow-x:scroll;font-family:"JetBrains Mono",Fira Code,Sarasa Mono SC,Cascadia Code,Menlo,Consolas,monaco,monospace;}.post-container{margin:5% 0%;border-radius:20px;border:2px solid var(--white-background-darker);background-color:var(--white-background-darker);}.post-container *{padding:0%;margin:0%;}.post-container h1{padding:3% 5%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;}.post-container p{padding:3% 5%;color:var(--white-text-darker);}.post-container a{vertical-align:middle;}.post-container i{vertical-align:middle;padding:0% 1%;}i{vertical-align:middle;padding:0% 1%;}.post-info *{color:var(--white-text-darker);font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:15px;padding:0% 5%;}.post-info img{padding:0%;}.post-info table,.post-info table *{padding:0%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}.arrow_forward::before{content:"arrow_forward";}.date_range::before{content:"date_range";}.arrow_back::before{content:"arrow_back";}#container{position:relative;height:auto;margin:5% 10%;}.head *{display:inline;padding:5%;}.head .h1{font-size:40px;}.head .h3{font-size:30px;white-space:nowrap;}.intro{display:inline-block;margin-bottom:4%;}.intro *{vertical-align:middle;display:inline;}.intro span{display:inline-block;}.intro h1{margin-left:10px;font-size:40px;padding:0;}#intro-text-intro{font-size:25px;color:var(--dark-text-darker);}.intro #avatar{padding:0%;border-radius:50px;height:96px;width:96px;}img{max-width:100%;padding-top:5%;padding-bottom:3%;left:0;right:0;position:relative;}table{padding-top:5%;padding-bottom:3%;}.none{display:none;}.v p{font-size:20px;}blockquote{margin:1em 3em 1em 2em;padding-left:1em;border-left:4px solid rgba(0,0,0,.12);}blockquote:last-child{margin-bottom:0;}blockquote p{font-size:20px;}blockquote footer{margin-top:1%;}.posttime{font-size:10px;color:var(--white-text-darker);}.post-time{font-size:10px;color:var(--white-text-darker);padding:0 4%;}#func{margin-top:1%;}@media (prefers-color-scheme:dark){body{color:var(--dark-text);background-color:var(--dark-background)}footer{color:var(--dark-text-darker)}pre{border:2px solid var(--dark-background-darker);background-color:var(--dark-background-darker)}.hljs{background:var(--dark-background-darker);color:var(--dark-text)}.post-container{border:2px solid var(--dark-background-darker);background-color:var(--dark-background-darker)}.hoverlink{color:var(--dark-text-darker)}.post-info *,.post-container p,.posttime,.post-time{color:var(--dark-text-darker)}blockquote{border-left-color:rgba(255,255,255,.12)}}@media screen and (max-width:1165px){#blogginginfo{display:none}.siteinfo{text-align:center}#aboutme{float:none;margin:0 auto}}@media screen and (max-width:790px){.head *{padding:4%}.intro{display:block;text-align:center}}@media screen and (max-width:700px){h1{font-size:40px}#aboutme{font-size:14px}.head .display_none{display:none}.intro h1{display:block}.post-container .post-intro .post-time{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.post-container h1{font-size:30px}p{font-size:20px}.v h1{font-size:25px}.v p{font-size:18px}blockquote{margin:1em}}@media screen and (max-width:480px){.head *{padding:1%}}

23
theme/classic/src/main.css

@ -180,6 +180,10 @@ i {
content: "arrow_forward";
}
.date_range::before {
content: "date_range";
}
.arrow_back::before {
content: "arrow_back";
}
@ -276,6 +280,21 @@ blockquote footer {
margin-top:1%;
}
.posttime {
font-size:10px;
color: var(--white-text-darker);
}
.post-time {
font-size:10px;
color: var(--white-text-darker);
padding: 0 4%;
}
#func {
margin-top: 1%;
}
@media (prefers-color-scheme: dark) {
body {
color: var(--dark-text);
@ -300,7 +319,7 @@ blockquote footer {
color: var(--dark-text-darker);
}
.post-info *,
.post-container p {
.post-container p ,.posttime,.post-time{
color: var(--dark-text-darker);
}
blockquote {
@ -345,7 +364,7 @@ blockquote footer {
.intro h1 {
display: block;
}
.post-container .post-intro {
.post-container .post-intro .post-time{
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
Loading…
Cancel
Save