This commit is contained in:
parent
e49a3b43fd
commit
c9293c59e1
2 changed files with 11 additions and 7 deletions
|
@ -204,12 +204,13 @@ export function chemistryScript(root: HTMLElement): void {
|
||||||
);
|
);
|
||||||
|
|
||||||
registerSearchEntries(
|
registerSearchEntries(
|
||||||
Array.from(root.querySelectorAll<HTMLElement>("table.wikitable > tbody > tr:not(:first-child) th .reagent-header")).map((element, id) => ({
|
Array.from(
|
||||||
|
root.querySelectorAll<HTMLElement>(
|
||||||
|
"table.wikitable > tbody > tr:not(:first-child) th .reagent-header"
|
||||||
|
)
|
||||||
|
).map((element, id) => ({
|
||||||
page: "Guide_to_chemistry",
|
page: "Guide_to_chemistry",
|
||||||
name: element
|
name: element.textContent.trim().replace(/\n.+$/gm, "").replace("▮", ""),
|
||||||
.textContent.trim()
|
|
||||||
.replace(/\n.+$/gm, "")
|
|
||||||
.replace("▮", ""),
|
|
||||||
element,
|
element,
|
||||||
alignment: "center",
|
alignment: "center",
|
||||||
id,
|
id,
|
||||||
|
|
|
@ -75,7 +75,7 @@ export function processGlobal(root: HTMLElement, docname: string): void {
|
||||||
if (toc) {
|
if (toc) {
|
||||||
const tocHeader = toc.querySelector("h2");
|
const tocHeader = toc.querySelector("h2");
|
||||||
toc.parentNode.insertBefore(tocHeader, toc);
|
toc.parentNode.insertBefore(tocHeader, toc);
|
||||||
const tocTitle = toc.querySelector("#toctitle")
|
const tocTitle = toc.querySelector("#toctitle");
|
||||||
if (tocTitle != null) {
|
if (tocTitle != null) {
|
||||||
toc.removeChild(tocTitle);
|
toc.removeChild(tocTitle);
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,10 @@ export function processGlobal(root: HTMLElement, docname: string): void {
|
||||||
const container = findParent(span, (el) =>
|
const container = findParent(span, (el) =>
|
||||||
el.classList.contains("mw-headline-cont")
|
el.classList.contains("mw-headline-cont")
|
||||||
);
|
);
|
||||||
if (container && container.querySelectorAll<HTMLElement>(".mw-headline").length === 1) {
|
if (
|
||||||
|
container &&
|
||||||
|
container.querySelectorAll<HTMLElement>(".mw-headline").length === 1
|
||||||
|
) {
|
||||||
container.id = span.id;
|
container.id = span.id;
|
||||||
span.id += "-span";
|
span.id += "-span";
|
||||||
container.dataset.name = span.textContent;
|
container.dataset.name = span.textContent;
|
||||||
|
|
Reference in a new issue