From 172adfb014596423d7cc3043f2a288ac01884cba Mon Sep 17 00:00:00 2001 From: verdant Date: Sun, 31 May 2026 16:33:36 +0800 Subject: Add minify configuration, modify favicon url --- static/js/webmention.min.js | 196 -------------------------------------------- 1 file changed, 196 deletions(-) delete mode 100644 static/js/webmention.min.js (limited to 'static/js/webmention.min.js') diff --git a/static/js/webmention.min.js b/static/js/webmention.min.js deleted file mode 100644 index 61f107d..0000000 --- a/static/js/webmention.min.js +++ /dev/null @@ -1,196 +0,0 @@ -// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt -!(function () { - "use strict"; - window.i18next = window.i18next || { - t: function t(e) { - return e; - }, - }; - let t = window.i18next.t.bind(window.i18next); - function e(t, e) { - return document.currentScript.getAttribute("data-" + t) || e; - } - let o = e("page-url", window.location.href.replace(/#.*$/, "")), - n = e("add-urls", void 0), - r = e("id", "webmentions"), - s = e("wordcount"), - l = e("max-webmentions", 30), - i = e("prevent-spoofing") ? "wm-source" : "url", - a = e("sort-by", "published"), - u = e("sort-dir", "up"), - p = e("comments-are-reactions", !1), - c = { - "in-reply-to": t("replied"), - "like-of": t("liked"), - "repost-of": t("reposted"), - "bookmark-of": t("bookmarked"), - "mention-of": t("mentioned"), - rsvp: t("RSVPed"), - "follow-of": t("followed"), - }, - f = { - "in-reply-to": "\uD83D\uDCAC", - "like-of": "❤️", - "repost-of": "\uD83D\uDD04", - "bookmark-of": "⭐️", - "mention-of": "\uD83D\uDCAC", - rsvp: "\uD83D\uDCC5", - "follow-of": "\uD83D\uDC1C", - }, - m = { - yes: "✅", - no: "❌", - interested: "\uD83D\uDCA1", - maybe: "\uD83D\uDCAD", - }; - function d(t) { - return t.replace( - /[&<>"]/g, - (t) => - ({ "&": "&", "<": "<", ">": ">", '"': """ })[ - t - ] || t, - ); - } - function h(e, o) { - let n = d(e.author?.name || e.url.split("/")[2]), - r = c[e["wm-property"]] || t("reacted"); - !o && e.content && e.content.text && (r += ": " + x(e)); - let s = ""; - s = - e.author && e.author.photo - ? ` - ${n} - ` - : ` - ${n}$ - `; - let l = ""; - return ( - e.rsvp && m[e.rsvp] && (l = `${m[e.rsvp]}`), - ` - - ${s} - ${f[e["wm-property"]] || "\uD83D\uDCA5"} - ${l} - - ` - ); - } - function g(t) { - return t.substr(t.indexOf("//")); - } - function w(t) { - let e = [], - o = {}; - return ( - t.forEach(function (t) { - let n = g(t.url); - o[n] || (e.push(t), (o[n] = !0)); - }), - e - ); - } - function x(t) { - let e = d(t.content.text); - if (s) { - let o = e.replace(/\s+/g, " ").split(" ", s + 1); - o.length > s && - ((o[s - 1] += "…"), (e = (o = o.slice(0, s)).join(" "))); - } - return e; - } - window.addEventListener("load", async function () { - let e = document.getElementById(r); - if (!e) return; - let s = [g(o)]; - n && - n.split("|").forEach(function (t) { - s.push(g(t)); - }); - let c = `https://webmention.io/api/mentions.jf2?per-page=${l}&sort-by=${a}&sort-dir=${u}`; - s.forEach(function (t) { - c += `&target[]=${encodeURIComponent("http:" + t)}&target[]=${encodeURIComponent("https:" + t)}`; - }); - let f = {}; - try { - let m = await window.fetch(c); - m.status >= 200 && m.status < 300 - ? (f = await m.json()) - : (console.error("Could not parse response"), - Error(m.statusText)); - } catch (y) { - console.error("Request failed", y); - } - let b = [], - k = []; - p && (b = k); - let B = { - "in-reply-to": b, - "like-of": k, - "repost-of": k, - "bookmark-of": k, - "follow-of": k, - "mention-of": b, - rsvp: b, - }; - f.children.forEach(function (t) { - let e = B[t["wm-property"]]; - e && e.push(t); - }); - let S = ""; - b.length > 0 && - b !== k && - (S = (function e(o) { - let n = `

${t("Responses")}

`, - r = o - .map((e) => { - let o = h(e, !0), - n = d(e.url.split("/")[2]); - e.author && e.author.name && (n = d(e.author.name)); - let r = `${n}`, - s = "name", - l = `(${t("mention")})`; - e.name - ? ((s = "name"), (l = d(e.name))) - : e.content && - e.content.text && - ((s = "text"), (l = x(e))); - let a = `${l}`; - return `
  • ${o} ${r} ${a}
  • `; - }) - .join(""); - return ` - ${n} - - `; - })(w(b))); - let D = ""; - k.length > 0 && - (D = (function e(o) { - let n = `

    ${t("Reactions")}

    `, - r = o.map((t) => h(t)).join(""); - return ` - ${n} - - `; - })(w(k))); - let $ = `${S}${D}`; - ($.trim() || ($ = '

    暂无 Webmention 回应。

    '), - (e.innerHTML = $)); - }); -})(); // @license-end -- cgit v1.2.3