From d117966b6118cc45a556e6c20691a3a49e1f2f45 Mon Sep 17 00:00:00 2001 From: Seth Trowbridge Date: Mon, 27 Oct 2025 16:25:23 -0400 Subject: [PATCH] init --- proposed-backup.txt | 128 +++++++++++++++++++++++++++++++++++++ ye-snippet.js | 151 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 279 insertions(+) create mode 100644 proposed-backup.txt create mode 100644 ye-snippet.js diff --git a/proposed-backup.txt b/proposed-backup.txt new file mode 100644 index 0000000..e2bde38 --- /dev/null +++ b/proposed-backup.txt @@ -0,0 +1,128 @@ + + + + + + + \ No newline at end of file diff --git a/ye-snippet.js b/ye-snippet.js new file mode 100644 index 0000000..eebc5bf --- /dev/null +++ b/ye-snippet.js @@ -0,0 +1,151 @@ +const Render=()=> +{ + if(new Date() < new Date(`Jan 1 2026`)) + { + /** @type {(selector:string)=>false|(markup:string)=>void} */ + const BuildInserter =(selector)=>{ + const element = document.querySelector(selector); + return element ? (markup)=>element.insertAdjacentHTML("afterend", markup) : false; + } + + const layoutBase =(hexColor, ...messages)=>`
${messages.join("")}
`; + const messageSmall = `

The Bible teaching from Truth For Life is funded by your donations!

`; + const messageLarge =(message)=> `

${message}

`; + + const insert = BuildInserter(".nav-outer-wrapper"); + if(insert) // if the main nav exists + { + if(location.pathname.startsWith("/store/")) // if we are on a store page + { + if(location.pathname === `/store/category/gifts/`) // if we are on the gifts page, add this css and keep going + { + insert(``) + } + + if(!location.pathname.startsWith("/store/checkout/")) // if not on the checkout, show store messaging and quit + { + + insert( + layoutBase( + "#945c57", + messageSmall, + messageLarge(`Will you kindly add a year-end gift of any amount at checkout? Thank you.`) + ) + ); + return; + } + } + else if(!location.pathname.startsWith("/donate/")) // if we are on a page with the main nav, but its not any store or donate process page, show donation mesaging and quit + { + insert( + layoutBase( + "#bb8618", + messageSmall, + messageLarge(`Will you kindly give a year-end gift of any amount? Thank you.`) + ) + ); + return; + } + + if(location.pathname == "/store/checkout/donate/") + { + document.querySelector(".checkout-donate-header__wrapper").innerHTML = `

Your year-end donation will help sustain the global Gospel outreach of Truth For Life. Thank you.

` + return; + } + + } + else + { + + if(location.pathname.startsWith("/donate/thank-you/")) + { + localStorage.setItem("ye-2025-donation", "true"); + } + if(localStorage.getItem("ye-2025-donation")) + { + return; + } + + if(location.pathname == "/donate/") + { + const insert = BuildInserter(".donation-header"); + if(insert) + { + insert(layoutBase("#bb8618", messageLarge(`Your year-end donation will help sustain the global Gospel outreach of Truth For Life. Thank you.