Skip to content

Commit

Permalink
feat: 加入track_all.html badge切换
Browse files Browse the repository at this point in the history
  • Loading branch information
sctop committed Apr 13, 2024
1 parent 0b3aaf1 commit 854a96d
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions static/css/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -503,4 +503,8 @@ a > code {
color: #FFF;
height: 1em;
padding: 0.15em;
}

.page-all-track-badge {
display: none;
}
29 changes: 29 additions & 0 deletions static/js/page_all_track_display.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
function setDefaultTrackBadgePreference() {
localStorage.setItem("track_badge", "1");
}

function setTrackBadgeDisplayStatus(selectElement) {
localStorage.setItem("track_badge", String(selectElement.value));

displayTrackBadgeElement();
}

function displayTrackBadgeElement() {
let status = localStorage.getItem("track_badge");
if (status === null) {
setDefaultTrackBadgePreference();
status = "1";
}

if (status === "0") {
setElementDisplay("page-all-track-badge", "none");
}
else if (status === "1") {
setElementDisplay("page-all-track-badge-stats", "inline-block");
setElementDisplay("page-all-track-badge-tags", "none");
}
else if (status === "2") {
setElementDisplay("page-all-track-badge-stats", "none");
setElementDisplay("page-all-track-badge-tags", "inline-block");
}
}

0 comments on commit 854a96d

Please sign in to comment.