Blog generator, publish manager, share scripts, theme CSS, highlight.js bundles, font, favicon, templates and generated-reference outputs, plus an English installation guide.
39 lines
1.4 KiB
JavaScript
39 lines
1.4 KiB
JavaScript
<script>
|
|
(function () {
|
|
var states = window.blogStates || {};
|
|
var id = document.body.getAttribute("data-note-id");
|
|
if (!id || !states[id]) return;
|
|
var state = states[id];
|
|
var s = String(state).toLowerCase();
|
|
document.body.classList.add("is-garden");
|
|
function inject() {
|
|
var title = document.getElementById("title");
|
|
if (!title) return;
|
|
var icons = {
|
|
"seed": "bx bxs-coffee-bean",
|
|
"seedling": "bx bxs-coffee-bean",
|
|
"sprout": "bx bxs-leaf",
|
|
"sprouting": "bx bxs-leaf",
|
|
"bud": "bx bxs-leaf",
|
|
"evergreen": "bx bxs-tree-alt",
|
|
"draft": "bx bx-edit",
|
|
"review": "bx bx-search-alt"
|
|
};
|
|
var growth = ["seed", "seedling", "sprout", "sprouting", "bud", "evergreen"];
|
|
var cls;
|
|
if (growth.indexOf(s) >= 0) cls = "state-growth";
|
|
else if (s === "draft") cls = "state-draft";
|
|
else if (s === "review") cls = "state-review";
|
|
else cls = "state-unknown";
|
|
var badge = document.createElement("span");
|
|
badge.className = "note-state " + cls;
|
|
badge.innerHTML = '<i class="' + (icons[s] || "bx bxs-circle") + '"></i>' + state;
|
|
title.appendChild(badge);
|
|
}
|
|
if (document.readyState === "loading") {
|
|
document.addEventListener("DOMContentLoaded", inject);
|
|
} else {
|
|
inject();
|
|
}
|
|
})();
|
|
</script> |