diff --git a/worker.js b/worker.js index 17dd635..809c7a2 100644 --- a/worker.js +++ b/worker.js @@ -23,7 +23,13 @@ const PAGE_DESCRIPTION = /* Step 4: enter a Google Font name, you can choose from https://fonts.google.com */ const GOOGLE_FONT = "Rubik"; -/* Step 5: enter any custom scripts you'd like */ +/* Step 5: Add a custom favicon (your Notion avatar URL works too) */ +const CUSTOM_AVATAR = ""; + +/* Step 6: enter any custom CSS, no style tag needed */ +const CUSTOM_STYLE = ``; + +/* Step 7: enter any custom scripts you'd like, script tag needed */ const CUSTOM_SCRIPT = ``; /* CONFIGURATION ENDS HERE */ @@ -175,12 +181,26 @@ class MetaRewriter { } } + class LinkRewriter { + element(element) { + if (element.getAttribute('rel') === 'shortcut icon') { + element.setAttribute('href', CUSTOM_AVATAR); + } + + if (element.getAttribute('rel') === 'apple-touch-icon') { + element.setAttribute('href', CUSTOM_AVATAR); + } + } + } + class HeadRewriter { element(element) { if (GOOGLE_FONT !== "") { - element.append( - ` - `, + element.append(` + `, { html: true } @@ -196,6 +216,8 @@ class HeadRewriter { div.notion-topbar-mobile > div:nth-child(4) { display: none !important; } div.notion-topbar > div > div:nth-child(1n).toggle-mode { display: block !important; } div.notion-topbar-mobile > div:nth-child(1n).toggle-mode { display: block !important; } + + ${CUSTOM_STYLE} `, { html: true @@ -209,8 +231,9 @@ class BodyRewriter { this.SLUG_TO_PAGE = SLUG_TO_PAGE; } element(element) { - element.append( + element.append( `