diff --git a/blogBase.json b/blogBase.json index 4f6906a..31f0cea 100644 --- a/blogBase.json +++ b/blogBase.json @@ -1 +1 @@ -{"singlePage": [], "startSite": "", "filingNum": "", "onePageListNum": 15, "commentLabelColor": "#006b75", "yearColorList": ["#bc4c00", "#0969da", "#1f883d", "#A333D0"], "i18n": "CN", "themeMode": "manual", "dayTheme": "light", "nightTheme": "dark", "urlMode": "pinyin", "script": "", "style": "", "bottomText": "", "showPostSource": 1, "iconList": {}, "UTC": 8, "rssSplit": "sentence", "title": "Blog Title", "subTitle": "Blog description", "avatarUrl": "https://github.githubassets.com/favicons/favicon.svg", "GMEEK_VERSION": "last", "postListJson": {"P1": {"htmlDir": "docs/post/Label.html", "labels": ["good first issue"], "postTitle": "Label", "postUrl": "post/Label.html", "postSourceUrl": "https://github.com/TM0088/Gmeek-miniblog/issues/1", "commentNum": 0, "wordCount": 5, "description": "Label\u3002", "top": 0, "createdAt": 1711417468, "style": "", "script": "", "createdDate": "2024-03-26", "dateLabelColor": "#bc4c00"}, "P2": {"htmlDir": "docs/post/l.html", "labels": ["good first issue"], "postTitle": "l", "postUrl": "post/l.html", "postSourceUrl": "https://github.com/TM0088/Gmeek-miniblog/issues/2", "commentNum": 0, "wordCount": 1, "description": "l\u3002", "top": 0, "createdAt": 1711419966, "style": "", "script": "", "createdDate": "2024-03-26", "dateLabelColor": "#bc4c00"}}, "singeListJson": {}, "labelColorDict": {"bug": "#d73a4a", "documentation": "#0075ca", "duplicate": "#cfd3d7", "enhancement": "#a2eeef", "good first issue": "#7057ff", "help wanted": "#008672", "invalid": "#e4e669", "question": "#d876e3", "wontfix": "#ffffff"}, "displayTitle": "Blog Title", "faviconUrl": "https://github.githubassets.com/favicons/favicon.svg", "homeUrl": "https://TM0088.github.io/Gmeek-miniblog", "prevUrl": "disabled", "nextUrl": "disabled"} \ No newline at end of file +{"singlePage": [], "startSite": "", "filingNum": "", "onePageListNum": 15, "commentLabelColor": "#006b75", "yearColorList": ["#bc4c00", "#0969da", "#1f883d", "#A333D0"], "i18n": "CN", "themeMode": "manual", "dayTheme": "light", "nightTheme": "dark", "urlMode": "pinyin", "script": "", "style": "", "bottomText": "", "showPostSource": 1, "iconList": {}, "UTC": 8, "rssSplit": "sentence", "exlink": {}, "title": "Blog Title", "subTitle": "Blog description", "avatarUrl": "https://github.githubassets.com/favicons/favicon.svg", "GMEEK_VERSION": "last", "postListJson": {"P1": {"htmlDir": "docs/post/Label.html", "labels": ["good first issue"], "postTitle": "Label", "postUrl": "post/Label.html", "postSourceUrl": "https://github.com/TM0088/Gmeek-miniblog/issues/1", "commentNum": 0, "wordCount": 5, "description": "Label\u3002", "top": 0, "createdAt": 1711417468, "style": "", "script": "", "createdDate": "2024-03-26", "dateLabelColor": "#bc4c00"}, "P2": {"htmlDir": "docs/post/l.html", "labels": ["good first issue"], "postTitle": "l", "postUrl": "post/l.html", "postSourceUrl": "https://github.com/TM0088/Gmeek-miniblog/issues/2", "commentNum": 0, "wordCount": 1, "description": "l\u3002", "top": 0, "createdAt": 1711419966, "style": "", "script": "", "createdDate": "2024-03-26", "dateLabelColor": "#bc4c00"}}, "singeListJson": {}, "labelColorDict": {"bug": "#d73a4a", "documentation": "#0075ca", "duplicate": "#cfd3d7", "enhancement": "#a2eeef", "good first issue": "#7057ff", "help wanted": "#008672", "invalid": "#e4e669", "question": "#d876e3", "wontfix": "#ffffff"}, "displayTitle": "Blog Title", "faviconUrl": "https://github.githubassets.com/favicons/favicon.svg", "homeUrl": "https://TM0088.github.io/Gmeek-miniblog", "prevUrl": "disabled", "nextUrl": "disabled"} \ No newline at end of file diff --git a/docs/index.html b/docs/index.html index f4e91f1..b919bca 100644 --- a/docs/index.html +++ b/docs/index.html @@ -30,10 +30,10 @@ .SideNav{min-width: 360px;} .SideNav-icon{margin-right: 16px} -.SideNav-item .Label{color: #fff;margin-left:8px;} +.SideNav-item .Label{color: #fff;margin-left:4px;} .d-flex{min-width:0;} .listTitle{overflow:hidden;white-space:nowrap;text-overflow: ellipsis;max-width: 100%;} -.listLabels{white-space:nowrap;} +.listLabels{white-space:nowrap;display:flex;} .listLabels object{max-height:16px;max-width:24px;} @media (max-width: 600px) { @@ -51,22 +51,23 @@

avatarBlog Title

- + - - +
@@ -161,6 +162,8 @@

} + + diff --git a/docs/post/Label.html b/docs/post/Label.html index 9919da4..20bc29b 100644 --- a/docs/post/Label.html +++ b/docs/post/Label.html @@ -43,26 +43,24 @@ diff --git a/docs/post/l.html b/docs/post/l.html index 548aa47..fe55948 100644 --- a/docs/post/l.html +++ b/docs/post/l.html @@ -43,26 +43,24 @@ diff --git a/docs/tag.html b/docs/tag.html index 0e0adf7..b13a761 100644 --- a/docs/tag.html +++ b/docs/tag.html @@ -29,8 +29,11 @@ .subnav-search-input{width:160px;border-top-right-radius:0px;border-bottom-right-radius:0px;} .subnav-search button{padding:5px 8px;border-top-left-radius:0px;border-bottom-left-radius:0px;} -.SideNav-icon{margin-right: 16px} -.Label{color: #fff;margin-left:8px;} +.SideNav-icon{margin-right:16px} +.Label{color: #fff;margin-left:4px;} +#taglabel .Label {margin-bottom:8px;} +.Counter{color:#fff;background-color:rgba(234, 238, 242, 0.5)} + .genTime{float: right;} .d-flex{min-width:0;} .listTitle{overflow:hidden;white-space:nowrap;text-overflow: ellipsis;max-width: 100%;} @@ -55,20 +58,20 @@

- - +
-
+
@@ -127,6 +130,7 @@ document.getElementById("searchSVG").setAttribute("d",IconList["search"]); tagList=[]; +labelsCount={}; jsonData=''; let requestJson="postList.json" let request=new XMLHttpRequest(); @@ -136,41 +140,40 @@ request.onload=function(){ jsonData=JSON.parse(request.response); console.log(jsonData); - showList(); + showList(labelsCount); setClassDisplay(decodeURI(window.location.hash.slice(1))); } -function showList(){ +function showList(labelsCount){ let SideNav=document.getElementsByClassName("SideNav")[0]; - SideNav.setAttribute("class","SideNav border"); - let tagLable=document.getElementById("tagLable"); - - if(tagList.length==0){ - let showLabels=document.createElement("button"); - showLabels.setAttribute("class","Label"); - showLabels.setAttribute("style","background-color:#000"); - showLabels.innerHTML="All"; - showLabels.setAttribute("onclick","javascript:updateShowTag('All');"); - tagLable.appendChild(showLabels); - } + SideNav.classList.add("border"); + let taglabel=document.getElementById("taglabel"); - let labelsSet = new Set(); - for(let key in jsonData) { + jsonData['labelColorDict']["All"]="#000"; + labelsCount["All"]=0; + for (let key in jsonData) { if (key !== 'labelColorDict' && Array.isArray(jsonData[key]['labels'])) { + labelsCount["All"]++; for (let label of jsonData[key]['labels']) { - labelsSet.add(label); + labelsCount[label] = (labelsCount[label] || 0) + 1; } } } - let labelsList = Array.from(labelsSet); - for(label of labelsList){ + + let sortedLabelsList = Object.keys(labelsCount).sort((a, b) => labelsCount[b] - labelsCount[a]); + for (let label of sortedLabelsList) { tagList.push(label); - let showLabels=document.createElement("button"); - showLabels.setAttribute("class","Label"); - showLabels.setAttribute("style","background-color:"+jsonData['labelColorDict'][label]); - showLabels.innerHTML=label; - showLabels.setAttribute("onclick","javascript:updateShowTag('"+label+"');"); - tagLable.appendChild(showLabels); + let showLabels = document.createElement("button"); + showLabels.setAttribute("class", "Label"); + showLabels.setAttribute("style", "background-color:" + jsonData['labelColorDict'][label]+";padding:4px;"); + showLabels.innerHTML="  "+label+" "; + showLabels.setAttribute("onclick", "javascript:updateShowTag('" + label + "');"); + + let LabelNum=document.createElement("span"); + LabelNum.setAttribute("class","Counter"); + LabelNum.innerHTML=labelsCount[label]; + showLabels.appendChild(LabelNum); + taglabel.appendChild(showLabels); } for(i in jsonData){ @@ -229,29 +232,29 @@ } } -function setClassDisplay(lable){ +function setClassDisplay(label){ let lists = document.getElementsByClassName("lists"); let tagTitle = document.getElementsByClassName("tagTitle")[0]; - tagTitle.innerHTML="Tag #"+lable; - document.title=lable+" - Blog Title"; + tagTitle.innerHTML="Tag #"+label; + document.title=label+" - Blog Title"; document.getElementsByClassName("subnav-search-input")[0].value=''; - if(lable=="All"){ + if(label=="All"){ for(let i = 0; i < lists.length; i++){lists[i].style.display='block';} document.getElementsByClassName("notFind")[0].style.display='none'; } - else if(tagList.indexOf(lable)!=-1){ + else if(tagList.indexOf(label)!=-1){ for(let i = 0; i < lists.length; i++){ lists[i].style.display='none'; } - let lables = document.getElementsByClassName(lable); - for(let i = 0; i < lables.length; i++){ - lables[i].style.display='block'; + let labels = document.getElementsByClassName(label); + for(let i = 0; i < labels.length; i++){ + labels[i].style.display='block'; } document.getElementsByClassName("notFind")[0].style.display='none'; } else{ - document.getElementsByClassName("subnav-search-input")[0].value=lable; + document.getElementsByClassName("subnav-search-input")[0].value=label; searchShow(); } }