diff --git a/src/Ankia-Theme.ejs b/src/Ankia-Theme.ejs index bbc1f4f..2aa4083 100644 --- a/src/Ankia-Theme.ejs +++ b/src/Ankia-Theme.ejs @@ -457,6 +457,25 @@
<%= bloggerName%>
<%= subRoot.note.getLabelValue("motto") %>
+ <% + const linkLabels = [ + "githubLink", + "RSSLink", + "zhihuLink", + "sspaiLink", + "netEaseCloudLink", + "bilibiliLink", + "doubanLink", + "telegramLink", + "mailLink" + ]; + const socialInformationExist = linkLabels.some(element => { + if (subRoot.note.hasLabel(element)){ + return true; + } + }); + %> + <% if (socialInformationExist) {%>
<% if (subRoot.note.hasLabel("githubLink") && subRoot.note.getLabelValue("githubLink")!=null) { %> "> @@ -528,6 +547,7 @@ <% } %>
+ <% } %>
公告

diff --git a/src/Ankia-Theme.js b/src/Ankia-Theme.js index 4af911f..a457fa6 100644 --- a/src/Ankia-Theme.js +++ b/src/Ankia-Theme.js @@ -352,15 +352,4 @@ document.addEventListener( }); }, false -); - -document.addEventListener( - "DOMContentLoaded", - () => { - const otherPlatformBar = document.getElementById("otherPlatformBar"); - if (otherPlatformBar.children.length === 0) { - otherPlatformBar.style.display = "none"; - } - }, - false ); \ No newline at end of file diff --git a/src/Ankia-Theme.min.js b/src/Ankia-Theme.min.js index 7bcd1b9..dfd10dc 100644 --- a/src/Ankia-Theme.min.js +++ b/src/Ankia-Theme.min.js @@ -1 +1 @@ -async function fetchNote(e=null){e||(e=document.body.getAttribute("data-note-id"));const t=await fetch(`api/notes/${e}`);return await t.json()}document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("toggleMenuButton"),t=document.getElementById("mobileMenuContainer"),n=document.getElementById("bloggerInfoCard"),o=document.getElementById("menuCard"),d=document.getElementById("main");let c=!1;e.addEventListener("click",()=>{e.classList.toggle("active"),c?(t.removeChild(n),t.removeChild(o),d.style.display="block",c=!1):(n.style.setProperty("display","flex","important"),o.style.setProperty("display","flex","important"),t.appendChild(n),t.appendChild(o),d.style.display="none",c=!0),t.classList.toggle("showMenu")})},!1),document.addEventListener("DOMContentLoaded",()=>{var e=document.querySelectorAll(".navigationItemsStyle");e.forEach(function(e){var t=e.querySelector(".menuLinkStyle"),n=e.querySelector(".dropDownStyle");if(!t||!n)return;var o=t.querySelector("svg");let d=!1;t.addEventListener("mouseover",function(){d=!0,n.style.display="flex",o.classList.add("unfolding")}),t.addEventListener("mouseout",function(){d=!1,setTimeout(function(){d||(n.style.display="none",o.classList.remove("unfolding"))},200)}),n.addEventListener("mouseover",function(){d=!0}),n.addEventListener("mouseout",function(){d=!1,setTimeout(function(){d||(n.style.display="none",o.classList.remove("unfolding"))},200)})})},!1),document.addEventListener("DOMContentLoaded",()=>{var e=window.pageYOffset;const t=10;window.onscroll=function(){var n=window.pageYOffset;const o=document.getElementById("navigationBar");n<100||(e>n?o.classList.remove("hide"):n-e>t&&!document.querySelector("#mobileMenuContainer.showMenu")&&o.classList.add("hide"),e=n)}},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("rewardBtn"),t=document.getElementById("rewardImgContainer");e&&e.addEventListener("click",function(){"flex"===t.style.display?(t.style.opacity="0",setTimeout(function(){t.style.display="none",t.style.flexWrap=""},500)):(t.style.opacity="1",t.style.display="flex",t.style.flexWrap="wrap")})},!1),document.addEventListener("DOMContentLoaded",()=>{function e(){let e=o.length;for(;--e&&window.scrollYe.classList.remove("tocActive")),d[e].classList.add("tocActive")}function t(){const e=document.getElementById("toc-pane"),t=document.getElementById("toc"),n=parseFloat(window.getComputedStyle(e).getPropertyValue("max-height"));let o=e.querySelector(".tocActive"),d=o.offsetTop;d>n-50?e.scrollTo({top:9999,behavior:"smooth"}):t.offsetHeight-d>n-50&&e.scrollTo({top:0,behavior:"smooth"})}const n=document.getElementById("toc");if(!n)return;n.clientHeight;const o=document.querySelectorAll("#content h2, #content h3, #content h4, #content h5, #content h6"),d=n.querySelectorAll("a");d.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=document.getElementById(e.getAttribute("href").slice(1));n&&n.scrollIntoView({behavior:"smooth"})})}),e(),window.addEventListener("scroll",()=>{e(),setTimeout(t,500)})},!1),document.addEventListener("DOMContentLoaded",()=>{function e(e,t){e.textContent=t,setTimeout(function(){e.textContent="Copy"},1e3)}function t(e){var t=window.getSelection(),n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),t}function n(n){var o=document.createElement("button");o.className="copyButtonStyle",o.textContent="Copy",o.setAttribute("title","复制");var d=n.firstElementChild;o.addEventListener("click",function(){try{var n=t(d);document.execCommand("copy"),n.removeAllRanges(),e(o,"Copied!")}catch(t){console&&console.log(t),e(o,"Failed")}}),n.appendChild(o)}if(document.queryCommandSupported("copy")){var o=document.querySelectorAll("pre");Array.prototype.forEach.call(o,n)}},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("onTop");e.addEventListener("click",e=>{window.scrollTo({top:0,behavior:"smooth"})})},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("content");if(!e)return;const t=document.getElementById("articleWordCount");t.innerText=e.innerText.split(/[\s-+:,/\\]+/).filter(e=>""!==e).join("").length},!1),document.addEventListener("DOMContentLoaded",()=>{function e(e){return`\n
${e.title}
\n
`}function t(e,t){let n;return function(...o){const d=()=>{n=null,Reflect.apply(e,null,o)};n&&clearTimeout(n),n=setTimeout(d,t)}}async function n(){const t=o.value.trim();if(""!==t){d.innerHTML="";const t=document.body.dataset.ancestorNoteId,n=o.value,c=await fetch(`api/notes?search=${n}&ancestorNoteId=${t}`),l=await c.json(),s=l.results;for(const t of s)!1!==t.path.includes("🗓️时间线")&&(d.innerHTML+=e(t))}}const o=document.getElementById("searchInput"),d=document.getElementById("searchResults"),c=document.getElementById("searchContainer"),l=document.getElementById("searchButton");l.addEventListener("click",()=>{c.style.display="flex"}),o.addEventListener("keyup",t(async()=>{await n()},400)),document.addEventListener("click",e=>{e.target.closest("#searchContainer")||e.target.closest("#searchButton")||(c.style.display="none")})},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("otherPlatformBar");0===e.children.length&&(e.style.display="none")},!1); \ No newline at end of file +async function fetchNote(e=null){e||(e=document.body.getAttribute("data-note-id"));const t=await fetch(`api/notes/${e}`);return await t.json()}document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("toggleMenuButton"),t=document.getElementById("mobileMenuContainer"),n=document.getElementById("bloggerInfoCard"),o=document.getElementById("menuCard"),d=document.getElementById("main");let c=!1;e.addEventListener("click",()=>{e.classList.toggle("active"),c?(t.removeChild(n),t.removeChild(o),d.style.display="block",c=!1):(n.style.setProperty("display","flex","important"),o.style.setProperty("display","flex","important"),t.appendChild(n),t.appendChild(o),d.style.display="none",c=!0),t.classList.toggle("showMenu")})},!1),document.addEventListener("DOMContentLoaded",()=>{var e=document.querySelectorAll(".navigationItemsStyle");e.forEach(function(e){var t=e.querySelector(".menuLinkStyle"),n=e.querySelector(".dropDownStyle");if(!t||!n)return;var o=t.querySelector("svg");let d=!1;t.addEventListener("mouseover",function(){d=!0,n.style.display="flex",o.classList.add("unfolding")}),t.addEventListener("mouseout",function(){d=!1,setTimeout(function(){d||(n.style.display="none",o.classList.remove("unfolding"))},200)}),n.addEventListener("mouseover",function(){d=!0}),n.addEventListener("mouseout",function(){d=!1,setTimeout(function(){d||(n.style.display="none",o.classList.remove("unfolding"))},200)})})},!1),document.addEventListener("DOMContentLoaded",()=>{var e=window.pageYOffset;const t=10;window.onscroll=function(){var n=window.pageYOffset;const o=document.getElementById("navigationBar");n<100||(e>n?o.classList.remove("hide"):n-e>t&&!document.querySelector("#mobileMenuContainer.showMenu")&&o.classList.add("hide"),e=n)}},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("rewardBtn"),t=document.getElementById("rewardImgContainer");e&&e.addEventListener("click",function(){"flex"===t.style.display?(t.style.opacity="0",setTimeout(function(){t.style.display="none",t.style.flexWrap=""},500)):(t.style.opacity="1",t.style.display="flex",t.style.flexWrap="wrap")})},!1),document.addEventListener("DOMContentLoaded",()=>{function e(){let e=o.length;for(;--e&&window.scrollYe.classList.remove("tocActive")),d[e].classList.add("tocActive")}function t(){const e=document.getElementById("toc-pane"),t=document.getElementById("toc"),n=parseFloat(window.getComputedStyle(e).getPropertyValue("max-height"));let o=e.querySelector(".tocActive"),d=o.offsetTop;d>n-50?e.scrollTo({top:9999,behavior:"smooth"}):t.offsetHeight-d>n-50&&e.scrollTo({top:0,behavior:"smooth"})}const n=document.getElementById("toc");if(!n)return;n.clientHeight;const o=document.querySelectorAll("#content h2, #content h3, #content h4, #content h5, #content h6"),d=n.querySelectorAll("a");d.forEach(e=>{e.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation();const n=document.getElementById(e.getAttribute("href").slice(1));n&&n.scrollIntoView({behavior:"smooth"})})}),e(),window.addEventListener("scroll",()=>{e(),setTimeout(t,500)})},!1),document.addEventListener("DOMContentLoaded",()=>{function e(e,t){e.textContent=t,setTimeout(function(){e.textContent="Copy"},1e3)}function t(e){var t=window.getSelection(),n=document.createRange();return n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n),t}function n(n){var o=document.createElement("button");o.className="copyButtonStyle",o.textContent="Copy",o.setAttribute("title","复制");var d=n.firstElementChild;o.addEventListener("click",function(){try{var n=t(d);document.execCommand("copy"),n.removeAllRanges(),e(o,"Copied!")}catch(t){console&&console.log(t),e(o,"Failed")}}),n.appendChild(o)}if(document.queryCommandSupported("copy")){var o=document.querySelectorAll("pre");Array.prototype.forEach.call(o,n)}},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("onTop");e.addEventListener("click",e=>{window.scrollTo({top:0,behavior:"smooth"})})},!1),document.addEventListener("DOMContentLoaded",()=>{const e=document.getElementById("content");if(!e)return;const t=document.getElementById("articleWordCount");t.innerText=e.innerText.split(/[\s-+:,/\\]+/).filter(e=>""!==e).join("").length},!1),document.addEventListener("DOMContentLoaded",()=>{function e(e){return`\n
${e.title}
\n
`}function t(e,t){let n;return function(...o){const d=()=>{n=null,Reflect.apply(e,null,o)};n&&clearTimeout(n),n=setTimeout(d,t)}}async function n(){const t=o.value.trim();if(""!==t){d.innerHTML="";const t=document.body.dataset.ancestorNoteId,n=o.value,c=await fetch(`api/notes?search=${n}&ancestorNoteId=${t}`),l=await c.json(),s=l.results;for(const t of s)!1!==t.path.includes("🗓️时间线")&&(d.innerHTML+=e(t))}}const o=document.getElementById("searchInput"),d=document.getElementById("searchResults"),c=document.getElementById("searchContainer"),l=document.getElementById("searchButton");l.addEventListener("click",()=>{c.style.display="flex"}),o.addEventListener("keyup",t(async()=>{await n()},400)),document.addEventListener("click",e=>{e.target.closest("#searchContainer")||e.target.closest("#searchButton")||(c.style.display="none")})},!1); \ No newline at end of file