summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBigCoke233 <hi@guhub.cn>2026-01-06 10:20:45 +0800
committerBigCoke233 <hi@guhub.cn>2026-01-06 10:20:45 +0800
commit062176e960255e0bb50ef441f928219e11999925 (patch)
treeb8eeddf7ab38ff94191c3f3e11f0e3ff6c77e742
parentf4a9e4a3322c167801c2eaabead495eb47c997b8 (diff)
chore: cleanup unused webmention.js
-rw-r--r--assets/css/_webmention.scss67
-rw-r--r--assets/css/main.scss1
-rw-r--r--layouts/_partials/scripts.html1
-rw-r--r--static/js/webmention.min.js3
4 files changed, 0 insertions, 72 deletions
diff --git a/assets/css/_webmention.scss b/assets/css/_webmention.scss
deleted file mode 100644
index 3a4557ad..00000000
--- a/assets/css/_webmention.scss
+++ /dev/null
@@ -1,67 +0,0 @@
-
-#webmentions {
- margin: 0;
- position: relative;
- z-index: 100;
- line-height: 1.2em;
- margin: 1rem 0;
- background: var(--block-background-color);
- padding: 0.5rem 1rem;
- border-radius: 0.25rem;
-
- ul.comments {
- max-height: 20em;
- overflow-x: hidden;
- overflow-y: scroll;
- list-style-type: none;
- margin: 0;
- padding: 4px;
-
- li {
- text-indent: -1em;
- padding-left: 1em;
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- a.source {
- font-weight: 700;
- }
- .text {
- color: #555;
- font-style: italic;
- text-decoration: none;
- }
- .name {
- color: var(--secondary-text-color)
- }
- }
- }
- h2 {
- display: none;
- }
- .reacts img {
- margin: 3px -1ex 1px 0;
- }
- img.missing {
- background: white;
- border: dashed black 1px;
- }
- a.reaction {
- position: relative;
- text-decoration: none;
- text-shadow: 0px 0px 3px white;
- margin-right: 0;
- letter-spacing: -1ex;
- margin-right: 2ex;
- font-size: 80%;
- img {
- max-height: 1.3rem;
- width: auto;
- margin-right: -1ex;
- border-radius: 25%;
- }
- sub {
- font-size: 50%;
- }
- }
-}
diff --git a/assets/css/main.scss b/assets/css/main.scss
index a9b80b84..0bc8d722 100644
--- a/assets/css/main.scss
+++ b/assets/css/main.scss
@@ -2,7 +2,6 @@
@import "utils/reset";
@import "utils/utility";
@import "markdown";
-@import "webmention";
@import "components/libra";
@import "components/toc";
diff --git a/layouts/_partials/scripts.html b/layouts/_partials/scripts.html
index 7c094221..b1e9aa2e 100644
--- a/layouts/_partials/scripts.html
+++ b/layouts/_partials/scripts.html
@@ -10,4 +10,3 @@
{{ partial "scripts/libra-js" . }}
{{ partial "scripts/aplayer-js" . }}
-<script src="/js/webmention.min.js" async></script>
diff --git a/static/js/webmention.min.js b/static/js/webmention.min.js
deleted file mode 100644
index 8f07b29f..00000000
--- a/static/js/webmention.min.js
+++ /dev/null
@@ -1,3 +0,0 @@
-// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt
-!function(){"use strict";window.i18next=window.i18next||{t:function(n){return n}};const n=window.i18next.t.bind(window.i18next);function t(n,t){return document.currentScript.getAttribute("data-"+n)||t}const e=t("page-url",window.location.href.replace(/#.*$/,"")),o=t("add-urls",void 0),r=t("id","webmentions"),s=t("wordcount"),i=t("max-webmentions",30),l=t("prevent-spoofing")?"wm-source":"url",a=t("sort-by","published"),c=t("sort-dir","up"),u=t("comments-are-reactions",!1),p={"in-reply-to":n("replied"),"like-of":n("liked"),"repost-of":n("reposted"),"bookmark-of":n("bookmarked"),"mention-of":n("mentioned"),rsvp:n("RSVPed"),"follow-of":n("followed")},f={"in-reply-to":"💬","like-of":"❤️","repost-of":"🔄","bookmark-of":"⭐️","mention-of":"💬",rsvp:"📅","follow-of":"🐜"},m={yes:"✅",no:"❌",interested:"💡",maybe:"💭"};function d(n){return n.replace(/[&<>"]/g,(n=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"}[n]||n)))}function w(t,e){const o=d(t.author?.name||t.url.split("/")[2]);let r=p[t["wm-property"]]||n("reacted");!e&&t.content&&t.content.text&&(r+=": "+x(t));let s="";s=t.author&&t.author.photo?`\n <img\n src="${d(t.author.photo)}"\n loading="lazy"\n decoding="async"\n alt="${o}"\n >\n `:`\n <img\n class="missing"\n src="data:image/webp;base64,UklGRkoCAABXRUJQVlA4TD4CAAAvP8APAIV0WduUOLr/m/iqY6SokDJSMD5xYX23SQizRsVdZmIj/f6goYUbiOj/BED7MOPReuBNT3vBesSzIex+SeqMFFkjebFmzH3S7POxDSJ1yaCbCmMnS2R46cRMPyQLw4GBK4esdK60pYwsZakecUCl5zsHv/5cPH08nx9/7i6rEEVCg2hR8VSd30PxMZpVoJZQO6Dixgg6X5oKFCmlVHIDmmMFShWumAXgCuyqVN8hHff/k+9fj8+ei7BVjpxBmZCUJv+6DhWGZwWvs+UoLHFCKsPYpfJtIcEXBTopEEsKwedZUv4ku1FZErKULLyQwFGgnmTs2vBD5qu44xwnG9uyjgrFOd+KRVlXyQfwQlauydaU6AVI7OjKXLUEqNtxJBmQegNDZgV7lxxqYMOMrDyC1NdAGbdiH9Ij0skjG+oTyfO0lmjdgvoH8iIgreuBMRYLSH+R3sAztXgL+XfS7E2bmfo6gnS0TrpnzHT7kL+skj7PgHuBwv/zpN8LDLQg7zfJZLBubMKnyeh6ZGyfDEfc2LYpnlUtG7JqsSHq1WoASbUS4KVaLwB8be5mfsGMDwBcm5VxbuxWxx3nkFanB6lYqsqSkOGkKicoDvXsneR7BkKU7DtaEuT7+pxBGVwx+9gVyqf2pVA9sC2CsmjZ1RJqEJHS4Tj/pCcS0JoyBYOsB91Xjh3OFfQPQhvCAYyeLJlaOoFp0XNNuD0BC8exr8uPx7D1JWkwFdZIXmD3MOPReuDNzHjBesSzIbQD"\n alt="${o}$"\n >\n `;let i="";return t.rsvp&&m[t.rsvp]&&(i=`<sub>${m[t.rsvp]}</sub>`),`\n <a\n class="reaction"\n rel="nofollow ugc"\n title="${o} ${r}"\n href="${t[l]}"\n >\n ${s}\n ${f[t["wm-property"]]||"💥"}\n ${i}\n </a>\n `}function h(n){return n.substr(n.indexOf("//"))}function g(n){const t=[],e={};return n.forEach((function(n){const o=h(n.url);e[o]||(t.push(n),e[o]=!0)})),t}function x(n){let t=d(n.content.text);if(s){let n=t.replace(/\s+/g," ").split(" ",s+1);n.length>s&&(n[s-1]+="&hellip;",n=n.slice(0,s),t=n.join(" "))}return t}window.addEventListener("load",(async function(){const t=document.getElementById(r);if(!t)return;const s=[h(e)];o&&o.split("|").forEach((function(n){s.push(h(n))}));let p=`https://webmention.io/api/mentions.jf2?per-page=${i}&sort-by=${a}&sort-dir=${c}`;s.forEach((function(n){p+=`&target[]=${encodeURIComponent("http:"+n)}&target[]=${encodeURIComponent("https:"+n)}`}));let f={};try{const n=await window.fetch(p);n.status>=200&&n.status<300?f=await n.json():(console.error("Could not parse response"),new Error(n.statusText))}catch(n){console.error("Request failed",n)}let m=[];const $=[];u&&(m=$);const y={"in-reply-to":m,"like-of":$,"repost-of":$,"bookmark-of":$,"follow-of":$,"mention-of":m,rsvp:m};f.children.forEach((function(n){const t=y[n["wm-property"]];t&&t.push(n)}));let b="";m.length>0&&m!==$&&(b=function(t){return`\n <h2>${n("Responses")}</h2>\n <ul class="comments">${t.map((t=>{const e=w(t,!0);let o=d(t.url.split("/")[2]);t.author&&t.author.name&&(o=d(t.author.name));const r=`<a class="source" rel="nofollow ugc" href="${t[l]}">${o}</a>`;let s="name",i=`(${n("mention")})`;return t.name?(s="name",i=d(t.name)):t.content&&t.content.text&&(s="text",i=x(t)),`<li>${e} ${r} <span class="${s}">${i}</span></li>`})).join("")}</ul>\n `}(g(m)));let k="";var B;$.length>0&&(B=g($),k=`\n <h2>${n("Reactions")}</h2>\n <ul class="reacts">${B.map((n=>w(n))).join("")}</ul>\n `),t.innerHTML=`${b}${k}`}))}();
-// @license-end