Fix outer page things not getting cached
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Hamcha 2020-06-21 19:29:57 +02:00
parent df914edcb5
commit e700bb9c30
Signed by: Hamcha
GPG Key ID: 41467804B19A3315
2 changed files with 6 additions and 6 deletions

View File

@ -59,12 +59,12 @@ async function loadPage(page: string, elem: HTMLElement) {
processHTML(elem, page);
// Save result to cache
cache.set(key, elem.innerHTML, CURRENT_VERSION).then(() => {
cache.set(key, elem.outerHTML, CURRENT_VERSION).then(() => {
console.log(`${page}: saved to cache`);
});
} else {
// Set cached content as HTML
elem.innerHTML = html;
elem.outerHTML = html;
}
bindFunctions(elem, page);

View File

@ -4,9 +4,12 @@ import { findParent } from "./utils";
// This is used for cache busting when userscript changes significantly.
// Only change it when you made changes to the processHTML part!
export const CURRENT_VERSION = "7930f961710641f022ef0cd3ad3277ffd4eab7eb";
export const CURRENT_VERSION = "df914edcb5522670309ceb8dfd0195dc70fb81d4";
function chemistryFixups(root: HTMLElement) {
// Enable page-specific CSS rules
root.classList.add("bchem");
// Fix inconsistencies with <p> on random parts
// Ideally I'd like a <p> or something on every part, wrapping it completely, but for now let's just kill 'em
root
@ -135,9 +138,6 @@ function chemistryFixups(root: HTMLElement) {
if (overdose) overdose.parentElement.removeChild(overdose);
if (addiction) addiction.parentElement.removeChild(addiction);
});
// Enable page-specific CSS rules
root.classList.add("bchem");
}
export function processHTML(root: HTMLElement, docname: string): void {