MtF-wiki/assets/customize.js

31 lines
834 B
JavaScript
Raw Normal View History

2022-02-09 00:51:38 +08:00
document.querySelectorAll("a[href]").forEach((link) => {
2021-12-25 10:55:57 +08:00
if (!/^https?:$/.test(link.protocol)) return;
2021-12-25 06:56:39 +08:00
if (link.hostname === location.hostname) return;
2022-02-09 00:51:38 +08:00
link.target = "_blank";
2021-12-25 06:56:39 +08:00
});
2022-02-09 00:51:38 +08:00
document.querySelectorAll("a[data-email]").forEach((element) => {
2021-12-25 06:56:39 +08:00
element.href = atob(element.dataset.email);
delete element.dataset.email;
2021-12-24 18:12:54 +08:00
});
document.addEventListener(
"click",
(event) => {
if (event.target.tagName !== "A") return
if (event.target.hostname !== "open.weixin.qq.com") return
event.preventDefault();
event.stopPropagation();
const qrcode = document.createElement("img");
qrcode.src = event.target.href;
qrcode.width = 430;
qrcode.height = 430;
swal(event.target.title, { content: qrcode })
},
{ capture: true },
);
2022-08-22 00:51:59 +08:00
function showHiddenPhoto(elem) {
elem.classList.add('show');
}