128 lines
4.6 KiB
Plaintext
128 lines
4.6 KiB
Plaintext
<script>
|
|
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)=>`<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");
|
|
if(insert)
|
|
{
|
|
if(location.pathname.startsWith("/store/"))
|
|
{
|
|
if(!location.pathname.startsWith("/store/checkout/"))
|
|
{
|
|
// show store messaging
|
|
insert(
|
|
layoutBase(
|
|
"#945c57",
|
|
messageSmall,
|
|
messageLarge(`Will you kindly add a year-end gift of any amount at checkout? <em>Thank you.</em>`)
|
|
)
|
|
);
|
|
return;
|
|
}
|
|
}
|
|
else if(!location.pathname.startsWith("/donate/")) // donation confirmation screens use the full nav....
|
|
{
|
|
// donation massaging
|
|
insert(
|
|
layoutBase(
|
|
"#bb8618",
|
|
messageSmall,
|
|
messageLarge(`Will you kindly <a style="color:white; text-decoration:underline;" href="/donate">give a year-end gift</a> of any amount? <em>Thank you.</em>`)
|
|
)
|
|
);
|
|
return;
|
|
}
|
|
|
|
if(location.pathname == "/store/checkout/donate/")
|
|
{
|
|
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");
|
|
}
|
|
if(localStorage.getItem("ye-2025-donation"))
|
|
{
|
|
return;
|
|
}
|
|
|
|
if(location.pathname == "/donate/")
|
|
{
|
|
const insert = BuildInserter(".donation-header");
|
|
if(insert)
|
|
{
|
|
insert(`<div style="padding: 1rem; text-align: center; background:#bb8618; color:white;">
|
|
<p style="margin:0; font-size:2rem; font-family: Sanchez;">
|
|
Your year-end donation will help sustain the global Gospel outreach of Truth For Life.
|
|
<em>Thank you.</em>
|
|
</p>
|
|
</div>`)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
// render and setup subsequent pjax renders
|
|
Render();
|
|
const observer = new MutationObserver(Render);
|
|
observer.observe(document.querySelector("#site-wrapper"), {subtree: false, childList: true});
|
|
</script>
|
|
|
|
<!-- hs src code tracking -->
|
|
<script>
|
|
const url = new URL(location);
|
|
if(url.pathname == `/resources/daily-devotionals/latest/`)
|
|
{
|
|
const src=url.searchParams.get("src");
|
|
if(src)
|
|
{
|
|
const ping = setInterval(()=>
|
|
{
|
|
const input = document.querySelector("input[name='orisrccode']");
|
|
if(input){
|
|
input.value = src;
|
|
input.setAttribute("value", src);
|
|
clearInterval(ping);
|
|
}
|
|
}, 1000)
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<!-- Hotjar Tracking Code for www.truthforlife.org -->
|
|
<script>
|
|
/*
|
|
(function(h,o,t,j,a,r){
|
|
h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};
|
|
h._hjSettings={hjid:474840,hjsv:6};
|
|
a=o.getElementsByTagName('head')[0];
|
|
r=o.createElement('script');r.async=1;
|
|
r.src=t+h._hjSettings.hjid+j+h._hjSettings.hjsv;
|
|
a.appendChild(r);
|
|
})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv=');
|
|
*/
|
|
</script> |