Content deleted Content added
Syncing script from GitHub (via script) |
Syncing script from GitHub (via script) |
||
Line 4:
"use strict";
(() => {
const title = document.
if (!title)
return mw.notify("Could not find title element!", { type: "error" });
if (!element.textContent)
if (element.nodeType === Node.TEXT_NODE)
title.replaceChild(document.createRange().createContextualFragment(markHomographs(element.textContent)), element);
else if (element.classList.contains("mw-page-title-main") || element.tagName === "I")
element.innerHTML = markHomographs(element.innerHTML);
}
function markHomographs(string) {
return
/* Cyrillics */
/[\u0400-\
/* Greek */
/[
/[
/[ⅠⅡⅢⅣⅤⅥⅦⅧⅨⅩⅪⅫⅬⅭⅮⅯ]/i.test(char) ? `<abbr title="This character is a homograph!" style="text-decoration: none; background-color: #ff5555">${char}</abbr>` : char
);
}).join("");
}
|