From 547d4137defbcbb0c547f802ad4bd3966466e9c9 Mon Sep 17 00:00:00 2001 From: Meekdai Date: Tue, 21 Nov 2023 22:52:13 +0800 Subject: [PATCH] Update tag.html --- templates/tag.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/templates/tag.html b/templates/tag.html index 6a7d031..f859062 100644 --- a/templates/tag.html +++ b/templates/tag.html @@ -69,6 +69,7 @@ document.getElementById("{{ blogBase['singeListJson'][num]['postTitle'] }}").set {%- endfor %} tagList=[]; +jsonData=''; let requestJson="blogBase.json" let request=new XMLHttpRequest(); request.open("GET",requestJson); @@ -77,10 +78,10 @@ request.send(); request.onload=function(){ jsonData=JSON.parse(request.response); console.log(jsonData); - showList(jsonData,window.location.hash.slice(1)); + showList(window.location.hash.slice(1)); } -function showList(jsonData,tag){ +function showList(tag){ let SideNav=document.getElementsByClassName("SideNav")[0]; let tagLable=document.getElementById("tagLable"); for(i in jsonData["postListJson"]){ @@ -140,9 +141,9 @@ function showList(jsonData,tag){ function updateShowTag(label){ if(window.location.hash.slice(1)!=encodeURI(label)){ window.location.hash="#"+(label); - showList(jsonData,label); + showList(label); + console.log("change to "+label); } - }