diff --git a/lib/components/WikiPage.tsx b/lib/components/WikiPage.tsx index 2722122..b76a96a 100644 --- a/lib/components/WikiPage.tsx +++ b/lib/components/WikiPage.tsx @@ -48,9 +48,9 @@ export default function WikiPage({ page, visible }) { visibility: visible ? "" : "hidden", }} > -

You start skimming through the manual...

+

You start skimming through the manual...

); diff --git a/lib/userscript.ts b/lib/userscript.ts index b39aaf1..850bc99 100644 --- a/lib/userscript.ts +++ b/lib/userscript.ts @@ -378,6 +378,81 @@ export default function (root: HTMLElement, docname: string) { name.map((e, i) => ({ id: i, str: e })) ); + // Remove "Removed medicines" section + let remTable = root.querySelector( + "#Non-craftable_Medicines + h4 + p + table" + ); + remTable.parentElement.removeChild(remTable); + + root + .querySelectorAll("div[data-name] .wikitable.sortable tr") + .forEach((el: HTMLElement) => { + let sectionEl = el.parentElement; + while (!sectionEl.dataset.name) { + sectionEl = sectionEl.parentElement; + } + const section = sectionEl.dataset.name; + if (el.querySelector("td") === null) { + // Remove unused rows if found + const row = el.querySelectorAll("th"); + row.forEach((th, i) => { + if (i < 2) { + return; + } + th.parentElement.removeChild(th); + }); + return; + } + let rows = Array.from(el.querySelectorAll("td")).slice(1); + let treatment = null; + let desc = null; + let metabolism = null; + let overdose = null; + let addiction = null; + // Handle special cases + switch (section) { + case "Components": + case "Virology Recipes": + [desc] = rows; + break; + case "Narcotics": + [desc, metabolism, overdose, addiction] = rows; + break; + case "Explosive Strength": + case "Other Reagents": + case "Mutation Toxins": + [desc, metabolism] = rows; + break; + default: + // All fields + [treatment, desc, metabolism, overdose, addiction] = rows; + } + const title = el.querySelector("th"); + let content = `
${title.innerHTML}
`; + if (treatment) { + content += `

${treatment.innerHTML}

`; + } + if (metabolism) { + content += `

${metabolism.innerHTML}

`; + } + if (addiction && addiction.innerHTML.trim() != "N/A") { + content += `

${addiction.innerHTML}

`; + } + if (overdose && overdose.innerHTML.trim() != "N/A") { + content += `

${overdose.innerHTML}

`; + } + if (desc) { + content += `

${desc.innerHTML}

`; + } + title.classList.add("reagent-ext"); + title.innerHTML = content; + if (desc) desc.parentElement.removeChild(desc); + if (treatment) treatment.parentElement.removeChild(treatment); + if (metabolism) metabolism.parentElement.removeChild(metabolism); + if (overdose) overdose.parentElement.removeChild(overdose); + if (addiction) addiction.parentElement.removeChild(addiction); + }); + document.body.addEventListener("keydown", function (ev) { if (ev.shiftKey) { switch (ev.keyCode) { diff --git a/style/bgus.scss b/style/bgus.scss index fa73fbc..7157cf8 100644 --- a/style/bgus.scss +++ b/style/bgus.scss @@ -27,8 +27,10 @@ #bgus_fz_searchbox ul { list-style: none; margin: 5px; + padding: 0; } #bgus_fz_searchbox li { + margin: 0; padding: 5px; cursor: pointer; } @@ -71,8 +73,8 @@ span.bgus_nested_element:not(.bgus_collapsed) + div.tooltiptext { padding: 5px 8px; line-height: 10pt; } -table.wikitable > tbody > tr > td:nth-child(2) { - min-width: 30%; +.bchem table.wikitable > tbody > tr > td:nth-child(2) { + width: 45%; padding: 10px; } .bgus_fz_selected { @@ -101,3 +103,39 @@ body.bgus_cbox input[type="checkbox"]:checked + span[data-src]:before, body.bgus_cbox input[type="checkbox"]:checked + span[data-src] { color: green; } + +.reagent-ext { + .reagent-header { + font-size: 12pt; + text-align: left; + padding: 10pt; + padding-bottom: 0; + } + p { + font-size: 8pt; + font-weight: 300; + line-height: 1.4em; + word-spacing: -0.1em; + } + .treatment { + font-size: 10pt; + } + .metabolism:before { + font-size: 9pt; + content: "Metabolism rate: "; + font-weight: bold; + } + .overdose, + .addiction { + font-size: 9pt; + font-weight: bold; + } + .overdose:before { + color: #ffae68; + content: "Overdose at "; + } + .addiction:before { + color: #ffdf97; + content: "Addiction at "; + } +} diff --git a/style/main.scss b/style/main.scss index 0c7022d..7fd9ef3 100644 --- a/style/main.scss +++ b/style/main.scss @@ -76,18 +76,23 @@ body { grid-row: 1; grid-column: 1; &.waiting { + position: fixed; + top: 0; + left: 0; + width: 100vw; + height: 100vh; + overflow: hidden; display: flex; flex-direction: column; height: 100%; .speen { flex: 1; display: flex; + flex-direction: column; justify-content: center; align-items: center; img { - flex: 1; - width: 50%; - height: 50%; + width: 60vmin; opacity: 0.9; } }