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(
|
||||
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",
|
||||
name: element
|
||||
.textContent.trim()
|
||||
.replace(/\n.+$/gm, "")
|
||||
.replace("▮", ""),
|
||||
name: element.textContent.trim().replace(/\n.+$/gm, "").replace("▮", ""),
|
||||
element,
|
||||
alignment: "center",
|
||||
id,
|
||||
|
|
|
@ -75,7 +75,7 @@ export function processGlobal(root: HTMLElement, docname: string): void {
|
|||
if (toc) {
|
||||
const tocHeader = toc.querySelector("h2");
|
||||
toc.parentNode.insertBefore(tocHeader, toc);
|
||||
const tocTitle = toc.querySelector("#toctitle")
|
||||
const tocTitle = toc.querySelector("#toctitle");
|
||||
if (tocTitle != null) {
|
||||
toc.removeChild(tocTitle);
|
||||
}
|
||||
|
@ -102,7 +102,10 @@ export function processGlobal(root: HTMLElement, docname: string): void {
|
|||
const container = findParent(span, (el) =>
|
||||
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;
|
||||
span.id += "-span";
|
||||
container.dataset.name = span.textContent;
|
||||
|
|
Reference in a new issue