Browse Source

Tags Function finish!!!!!

pull/8/head
186526 1 year ago
parent
commit
c121d37412
5 changed files with 146 additions and 42 deletions
  1. 64
      theme/classic/html/tags.html
  2. 2
      theme/classic/src/intro-min.js
  3. 64
      theme/classic/src/intro.js
  4. 2
      theme/classic/src/main-min.css
  5. 56
      theme/classic/src/main.css

64
theme/classic/html/tags.html

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<meta id="des" name="description">
<link rel="preconnect" href="https://cdn.jsdelivr.net">
<script id="intro_js"></script>
<div id="head">
<link rel='shortcut icon' id="favicon" href="favicon.ico">
</div>
</head>
<body>
<div class="none">
</div>
<div id="container">
<span class="intro">
<img id="avatar" alt="Avatar">
<span>
<h1 id="intro-text-title"></h1>
<h1 id="intro-text-intro"></h1>
</span>
</span>
<p><a onclick="window.history.back(-1);" style="vertical-align: middle;"><i class="material-icons arrow_back"
style="vertical-align: middle;"></i>Back</a><div id="func"></div></p>
<div id="content">
<div class="tags" id="tags">
<div id="tag">
</div>
<div id="post">
</div>
</div>
</div>
<footer>
<span class="siteinfo">
<span id="blogginginfo">
Powered By <a class="hoverlink" href="https://github.com/186526/blogging">Blogging</a>, a
Lightweight Blog Platform.</span>
<span id="aboutme"> </span>
</span>
</footer>
</div>
</body>
<script>
blogging_info("Start show page");
var debugtext = {
FetchThing: settings.content.url,
StatusCode: settings.content.status,
success: settings.content.success,
content: settings.content.preview,
};
if (getpar("debug")) {
document.all[0].innerHTML = "<pre><xmp>" + JSON.stringify(debugtext) + "</xmp></pre>";
console.log("Debug ON");
} else {
document.getElementById("intro_js").src = settings.themeUrl + "src/intro-min.js"
document.getElementById("aboutme").innerHTML = "Copyright " + settings.date.getFullYear() + " <a class='hoverlink' href=" + settings.domain + ">" + config.theme_config.author + "'s Blog. </a>All Rights Reserved.";
document.getElementById("head").innerHTML = "<link rel='stylesheet' href='" + settings.themeUrl + "src/main-min.css'><title> Home -- " + config.theme_config.author + "'s Blog</title>";
}
</script>
</html>

2
theme/classic/src/intro-min.js
File diff suppressed because it is too large
View File

64
theme/classic/src/intro.js

@ -34,15 +34,13 @@ async function get_posts_content(post_url, x) {
.then(function () {
if (window.location.search === "?page=archive") {
post.container =
'<div class="post-container"><h1>' +
'<div class="post-container"><a href="?p=' +
config.post[x].url +
'"><h1>' +
post.preview.title +
'</h1><div class="post-info">' +
post.preview.mdcontent +
'</div><div class="post-time"><i class="material-icons date_range"></i>' +
'</h1></a><div class="post-time margin-bottom"><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>';
'</div></div>';
} else {
post.container =
'<div class="post-container"><h1>' +
@ -51,7 +49,7 @@ async function get_posts_content(post_url, x) {
post.preview.intro +
'</p><div class="post-time"><i class="material-icons date_range"></i>' +
loadtime(config.post[x].url).posttime +
'</div><p><a href="?p=' +
'</div><div class="post-tags">' + createtags(config.post[x].url).innerHTML + '</div><p><a href="?p=' +
config.post[x].url +
'">Reading<i class="material-icons arrow_forward"></i></a></p></div>';
}
@ -76,6 +74,34 @@ async function init_post_container() {
return post_container;
}
var search = async () => {
var post_container = "";
document.getElementById("tag").append(createtag([decodeURI(getpar("tag"))]));
if (!getpar("tag")) {
window.location.href = settings.domain;
}
try {
checktags([decodeURI(getpar("tag"))]);
} catch {
document.querySelector("#tags").innerHTML = "<h1>Tags Not Found</h1>";
}
if (checktags([decodeURI(getpar("tag"))]) == false) {
document.querySelector("#tags").innerHTML = "<h1>Tags Not Found</h1>";
}
let a = checktags([decodeURI(getpar("tag"))]);
for (let x = 0; x < config.post.length; x++) {
for (let y in a) {
if (config.post[x].url === a[y]) {
const post = {};
post.url = settings.post + config.post[x].url + ".md";
post_container = post_container + get_posts_content(post, x);
break;
}
}
}
return post_container;
};
async function init_plugins() {
blogging_info("Load Plugin who loadtime = themerender");
for (let i in config.plugins) {
@ -154,18 +180,22 @@ function config_page() {
async function init_post() {
document.getElementById("func").append(gettime(getpar("p")));
//document.getElementById("func").append(createtags(getpar("p")));
document.getElementById("func").append(createtags(getpar("p")));
}
var createtags = (url) => {
let tags = gettags(url);
return createtag(tags);
};
var createtag = (tags) => {
let tags_tags = [];
let a = document.createElement("div");
a.classList = "tags-container";
for (let i in tags) {
tags_tags[i] = document.createElement("a");
tags_tags[i].classList = "tags-tags";
tags_tags[i].innerHTML = tags[i];
tags_tags[i].innerHTML = "<i class='material-icons i-1'>label</i>" + tags[i];
tags_tags[i].href = "?page=tags&tag=" + tags[i];
a.append(tags_tags[i]);
}
@ -179,7 +209,11 @@ var checktags = (tags) => {
if (gettags(config.post[i].url).toString().match(tags[y]) === null) {
continue;
} else {
x.push(config.post[i].url);
for (let z in gettags(config.post[i].url)) {
if (gettags(config.post[i].url)[z] === tags[y]) {
x.push(config.post[i].url);
}
}
}
}
}
@ -194,11 +228,11 @@ var gettags = (url) => {
}
};
if (getpar("page")) {
if (getpar("page") != "tags" && getpar("page")) {
init_plugins();
config_page();
init_post_container();
} else {
} else if (getpar("p")) {
let finished = true;
if (
finished &&
@ -221,5 +255,9 @@ if (getpar("page")) {
init_plugins();
config_page();
init_post();
} else if (getpar("page") === "tags") {
init_plugins();
config_page();
search();
}
document.getElementById("des").content = config.theme_config.introduction;

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

@ -1 +1 @@
@import url("https://fonts.googleapis.com/icon?family=Material+Icons");@import url("https://fonts.googleapis.com/css2?family=Montserrat&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,h2,h3,h4,h5,h6{font-family:"Montserrat","PingFang SC","更纱黑体 UI SC","Sarasa UI SC","Roboto","Noto Sans SC",sans-serif;}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%;}tags-container{max-width:2%;max-height:import;}tags-container{max-width:2%;}@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%}}
@import url("https://fonts.googleapis.com/icon?family=Material+Icons");@import url("https://fonts.googleapis.com/css2?family=Montserrat&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,h2,h3,h4,h5,h6{font-family:"Montserrat","PingFang SC","更纱黑体 UI SC","Sarasa UI SC","Roboto","Noto Sans SC",sans-serif}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-1{vertical-align:middle;padding-left:.2%}i{vertical-align:middle;padding:0% 1%}.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}.margin-bottom{margin-bottom:3%}.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%}.post-tags{padding:3% 3% 0%}#func{margin-top:1%}.tags-container{margin-top:3%;margin-left:1%;max-height:2%}.tags-tags{border :2px solid var(--white-background-darker);border-radius:10px;padding:.5%;margin-right:3%;background-color:var(--white-background-darker);word-wrap:break-word;word-break:break-all}@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)}.tags-tags{background-color:var(--dark-background-darker);border :2px solid var(--dark-background-darker)}}@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%}}

56
theme/classic/src/main.css

@ -155,31 +155,14 @@ code * {
padding: 0% 1%;
}
i {
.i-1{
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%;
padding-left: 0.2%;
}
.post-info table,
.post-info table * {
padding: 0%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
i {
vertical-align: middle;
padding: 0% 1%;
}
.arrow_forward::before {
@ -214,6 +197,10 @@ i {
white-space: nowrap;
}
.margin-bottom {
margin-bottom: 3%;
}
.intro {
display: inline-block;
margin-bottom: 4%;
@ -297,17 +284,28 @@ blockquote footer {
padding: 0 4%;
}
.post-tags{
padding: 3% 3% 0%;
}
#func {
margin-top: 1%;
}
tags-container {
max-width: 2%;
max-height: import;
.tags-container {
margin-top:3%;
margin-left: 1%;
max-height: 2%;
}
tags-container {
max-width: 2%;
.tags-tags{
border : 2px solid var(--white-background-darker);
border-radius: 10px;
padding:0.5%;
margin-right: 3%;
background-color: var(--white-background-darker);
word-wrap: break-word;
word-break: break-all;
}
@media (prefers-color-scheme: dark) {
@ -342,6 +340,10 @@ tags-container {
blockquote {
border-left-color: rgba(255, 255, 255, 0.12);
}
.tags-tags{
background-color: var(--dark-background-darker);
border : 2px solid var(--dark-background-darker);
}
}
@media screen and (max-width: 1165px) {
Loading…
Cancel
Save