misc
This commit is contained in:
parent
d117966b61
commit
9f39318ed4
@ -2,22 +2,22 @@ const Render=()=>
|
|||||||
{
|
{
|
||||||
if(new Date() < new Date(`Jan 1 2026`))
|
if(new Date() < new Date(`Jan 1 2026`))
|
||||||
{
|
{
|
||||||
|
const layoutBase =(hexColor, ...messages)=>`<div style="padding: 1rem; text-align: center; background:${hexColor}; color:white;">${messages.join("")}</div>`;
|
||||||
|
const messageSmall = `<p style="margin:0;">The Bible teaching from Truth For Life is funded by your donations!</p>`;
|
||||||
|
const messageLarge =(message)=> `<p style="margin:0; font-size:2rem; font-family: Sanchez;">${message}</p>`;
|
||||||
|
|
||||||
/** @type {(selector:string)=>false|(markup:string)=>void} */
|
/** @type {(selector:string)=>false|(markup:string)=>void} */
|
||||||
const BuildInserter =(selector)=>{
|
const BuildInserter =(selector)=>{
|
||||||
const element = document.querySelector(selector);
|
const element = document.querySelector(selector);
|
||||||
return element ? (markup)=>element.insertAdjacentHTML("afterend", markup) : false;
|
return element ? (markup)=>element.insertAdjacentHTML("afterend", markup) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const layoutBase =(hexColor, ...messages)=>`<div style="padding: 1rem; text-align: center; background:${hexColor}; color:white;">${messages.join("")}</div>`;
|
|
||||||
const messageSmall = `<p style="margin:0;">The Bible teaching from Truth For Life is funded by your donations!</p>`;
|
|
||||||
const messageLarge =(message)=> `<p style="margin:0; font-size:2rem; font-family: Sanchez;">${message}</p>`;
|
|
||||||
|
|
||||||
const insert = BuildInserter(".nav-outer-wrapper");
|
const insert = BuildInserter(".nav-outer-wrapper");
|
||||||
|
|
||||||
if(insert) // if the main nav exists
|
if(insert) // if the main nav exists
|
||||||
{
|
{
|
||||||
if(location.pathname.startsWith("/store/")) // if we are on a store page
|
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
|
if(location.pathname === `/store/category/gifts/`) // if we are on the store category for the gifts page, add this tweak css and *keep going*
|
||||||
{
|
{
|
||||||
insert(`<style>
|
insert(`<style>
|
||||||
.cards.cards-default .row
|
.cards.cards-default .row
|
||||||
@ -84,9 +84,8 @@ const Render=()=>
|
|||||||
</style>`)
|
</style>`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!location.pathname.startsWith("/store/checkout/")) // if not on the checkout, show store messaging and quit
|
if(!location.pathname.startsWith("/store/checkout/")) // if not on the checkout, show CHECKOUT BANNER and *quit*
|
||||||
{
|
{
|
||||||
|
|
||||||
insert(
|
insert(
|
||||||
layoutBase(
|
layoutBase(
|
||||||
"#945c57",
|
"#945c57",
|
||||||
@ -96,9 +95,24 @@ const Render=()=>
|
|||||||
);
|
);
|
||||||
return;
|
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
|
if(location.pathname == "/store/checkout/donate/") // if we are on the donation part of the checkout process, replace the messaging "header" over the form and *quit*
|
||||||
{
|
{
|
||||||
|
document.querySelector(".checkout-donate-header__wrapper").innerHTML = `<img src="https://info.truthforlife.org/hubfs/__Misc/year-end/donation-messge.jpg" style="
|
||||||
|
width: 100%;
|
||||||
|
margin-bottom: 2rem;
|
||||||
|
"><p class="padded_text checkout-donate-header">Your year-end donation will help sustain the global Gospel outreach of Truth For Life. <em>Thank you</em>.</p>`
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!location.pathname.startsWith("/donate/")) // if we are not on any donate process page, show the DONATION BANNER and *quit*
|
||||||
|
{
|
||||||
|
// if(localStorage.getItem("ye-2025-donation")) // TODO: don't show donatio messaing if a donation has been madee
|
||||||
|
// {
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
insert(
|
insert(
|
||||||
layoutBase(
|
layoutBase(
|
||||||
"#bb8618",
|
"#bb8618",
|
||||||
@ -109,29 +123,15 @@ const Render=()=>
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(location.pathname == "/store/checkout/donate/")
|
if(location.pathname.startsWith("/donate/thank-you/")) // if we are on the donation thank you page, take note
|
||||||
{
|
|
||||||
document.querySelector(".checkout-donate-header__wrapper").innerHTML = `<img src="https://info.truthforlife.org/hubfs/__Misc/year-end/donation-messge.jpg" style="
|
|
||||||
width: 100%;
|
|
||||||
margin-bottom: 2rem;
|
|
||||||
"><p class="padded_text checkout-donate-header">Your year-end donation will help sustain the global Gospel outreach of Truth For Life. <em>Thank you</em>.</p>`
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
|
|
||||||
if(location.pathname.startsWith("/donate/thank-you/"))
|
|
||||||
{
|
{
|
||||||
localStorage.setItem("ye-2025-donation", "true");
|
localStorage.setItem("ye-2025-donation", "true");
|
||||||
}
|
}
|
||||||
if(localStorage.getItem("ye-2025-donation"))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(location.pathname == "/donate/")
|
}
|
||||||
|
else // we are on a non-standard header page
|
||||||
|
{
|
||||||
|
if(location.pathname == "/donate/") // if we are on the donate page, insert a THIN DONATION BANNER
|
||||||
{
|
{
|
||||||
const insert = BuildInserter(".donation-header");
|
const insert = BuildInserter(".donation-header");
|
||||||
if(insert)
|
if(insert)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user