Montana
Bring your Treasures to the Montana Appraisal Fair in Billings
`;
//Diable page scrollable
let body = document.querySelector(“body”);
body.classList.add(“aarp-c-modal–open”);
let closeButton = modal.nextElementSibling;
if (uxdiaUrl) {
modal.parentElement.parentElement.classList.add(
“uxdia-c-lightbox__container”,
);
modal.classList.add(“uxdia-c-coi-modal__content”);
closeButton
? closeButton.classList.add(“uxdia-c-coi-close-button”)
: “”;
closeButton
? (closeButton.dataset.formelementid = “COI-ALERT-CLOSE-UXDIA”)
: “”;
modal.querySelector(“#sendmail-btn”).dataset.formelementid =
“COI-ALERT-SEND-UXDIA”;
}
//Remove aarp-c-modal–closed class
const interval = setInterval(() => {
const modal = document.querySelector(
“.aarp-c-modal:has(.uxdia-c-coi-modal__content)”,
);
if (modal && modal.classList.contains(“aarp-c-modal–closed”)) {
modal.classList.remove(“aarp-c-modal–closed”);
clearInterval(interval);
}
}, 500);
const modalCloseButton = document.querySelector(
“.uxdia-c-coi-close-button”,
);
const parentModalContainer = document.querySelector(
“.aarp-c-modal__overlay”,
).parentElement;
const modalContainer = document.querySelector(
“.aarp-c-modal__container”,
);
const sendMailBtn = document.querySelector(“#sendmail-btn”);
// Close on button click
modalCloseButton.addEventListener(“click”, () => {
body.classList.remove(“aarp-c-modal–open”);
parentModalContainer.classList.add(“aarp-coi-modal-closed”);
});
// Close only when clicking outside modal
parentModalContainer.addEventListener(“click”, (e) => {
// Ignore click if it’s inside modal OR on sendmail button
if (
!modalContainer.contains(e.target) &&
!e.target.closest(“#sendmail-btn”)
) {
body.classList.remove(“aarp-c-modal–open”);
parentModalContainer.classList.add(“aarp-coi-modal-closed”);
}
});
const atCookie = decodeURIComponent(
AARP.StayingSharp.evs.cookie[“at”],
);
const cookiesObj = atCookie.split(“&”).reduce(function (n, o) {
const x = o.split(“=”);
n[x[0]] = x[1];
return n;
}, {});
const userFirstName = cookiesObj.f
? cookiesObj.f.replace(/+/g, ” “)
: AARP?.store?.getState()?.cookie?.at?.f;
const title = modal.querySelector(“#emailverification-modal-title”);
if (title) {
if (userFirstName) {
title.textContent = greetingText + ” ” + userFirstName;
} else {
title.textContent = “Please confirm your email address”;
}
}
const button = $(“#sendmail-btn”);
if (button) {
$(“#sendmail-btn”).addEventListener(“click”, function (event) {
event.preventDefault();
AARP.StayingSharp.evs.sendEvsEmail();
if (uxdiaUrl) {
let modalDescriptionElements = modal.querySelectorAll(
“.sharp-c-coi-modal__padding”,
);
title.textContent = “Thank you!”;
modalDescriptionElements[0]
? (modalDescriptionElements[0].innerHTML = `A verification email is waiting for you in your inbox. Simply click the link in the email and you are good to go!`)
: “”;
modalDescriptionElements[1]?.remove();
button.remove();
closeButton
? (closeButton.dataset.formelementid = “COI-TY-CLOSE-UXDIA”)
: “”;
} else {
// Hide popup here
AARP.Everywhere.GlobalModal.close();
}
});
AARP.StayingSharp.openModal(
“sharp-c-coi-modal”,
closedCoiModalCallback,
);
}
}
},
showConfirmationModal: function (data, confirmCallback, cancelCallback) {
const modal = document.querySelector(“#aarp-c-modal-content”);
if (modal) {
modal.innerHTML = “;
const yesButton = document.getElementById(“confirm-modal-yes-btn”);
const noButton = document.getElementById(“confirm-modal-no-btn”);
const titleElement = document.getElementById(“confirm-modal-title”);
const messageElement = document.getElementById(
“confirm-modal-message”,
);
if (data) {
if (yesButton && data.positiveButtonText) {
yesButton.textContent = data.positiveButtonText;
}
if (noButton && data.negativeButtonText) {
noButton.textContent = data.negativeButtonText;
}
if (titleElement && data.title) {
titleElement.textContent = data.title;
}
if (messageElement && data.message) {
messageElement.textContent = data.message;
}
}
if (yesButton) {
yesButton.addEventListener(“click”, function (event) {
event.preventDefault();
if (confirmCallback) {
confirmCallback();
}
AARP.Everywhere.GlobalModal.close();
});
}
if (noButton) {
noButton.addEventListener(“click”, function (event) {
event.preventDefault();
if (cancelCallback) {
cancelCallback();
}
AARP.Everywhere.GlobalModal.close();
});
AARP.StayingSharp.openModal(“sharp-c-coi-modal”);
}
}
},
drawErrorMssgOverlay: function () {
// $(“#email-verification-failed”).classList.classList.remove(“sharp-c-coi-modal–close”)
},
drawThankYouOverlay: function () {
// $(“#thankyou-popup”).classList.classList.remove(“sharp-c-coi-modal–close”)
},
drawRewardsThankYouOverlay: function () {
const modal = document.querySelector(“#aarp-c-modal-content”);
if (modal) {
modal.parentElement.classList.add(“sharp-c-coi-modal__popup”);
if (uxdiaUrl) {
modal.parentElement.parentElement.classList.add(
“uxdia-c-lightbox__container”,
);
modal.classList.add(“uxdia-c-coi-modal__content”);
modal.innerHTML = `
`;
let closeButton = modal.nextElementSibling;
closeButton
? closeButton.classList.add(“uxdia-c-coi-close-button”)
: “”;
closeButton
? (closeButton.dataset.formelementid = “COI-TY-CLOSE-UXDIA”)
: “”;
} else {
modal.innerHTML = `
`;
}
const userFirstName = AARP?.store?.getState()?.cookie?.at?.f || “”;
const title = modal.querySelector(“#emailverification-modal-title”);
if (title) {
title.textContent = “Thank You” + ” ” + userFirstName;
}
const button = $(“#continue-btn”);
if (button) {
$(“#continue-btn”).addEventListener(“click”, function (event) {
event.preventDefault();
// hide popup here
AARP.Everywhere.GlobalModal.close();
});
AARP.StayingSharp.openModal(“sharp-c-coi-modal”);
}
}
},
};
if (
(AARP?.StayingSharp?.apiConstants?.isEditMode === “false” &&
AARP?.StayingSharp?.apiConstants?.isPreviewMode === “false”) ||
(AARP?.Everywhere?.isAuthor === false &&
AARP?.Everywhere?.isEdit === false)
) {
if (window.location.href.includes(“stayingsharp”)) {
AARP.readyStateLoader(function () {
const checkAppViewParam = AARP.StayingSharp?.utils?.getQueryString(
“EXP”,
window.parent.location.href,
);
sessionStorage.setItem(“STAYINGSHARP_COI_MODAL_DISPLAY”, “COIMODAL”);
if (
sessionStorage.getItem(“STAYINGSHARP_LEGAL_MODAL_DISPLAY”) ===
“LEGALMODAL” ||
sessionStorage.getItem(“STAYINGSHARP_FREE_TRIAL_MODAL_DISPLAY”) ===
“FREETRIALMODAL” ||
sessionStorage.getItem(“FREE_TRIAL_ASSESMENT_MODAL_DISPLAY”) ===
“FREETRIALASSESMENTMODAL” ||
sessionStorage.getItem(“ASSESSMENT_REMINDER_MODAL”) ||
checkAppViewParam === “staying_sharp_app”
) {
return;
}
document.addEventListener(“FREE_TRIAL_ASSES_MODAL_LOADED”, () => {
if (
sessionStorage.getItem(“STAYINGSHARP_ACTIVE_MODAL_DISPLAY”) ===
“UNAUTHMODAL” ||
sessionStorage.getItem(“STAYINGSHARP_LEGAL_MODAL_DISPLAY”) ===
“LEGALMODAL” ||
sessionStorage.getItem(
“STAYINGSHARP_FREE_TRIAL_MODAL_DISPLAY”,
) === “FREETRIALMODAL” ||
sessionStorage.getItem(“FREE_TRIAL_ASSESMENT_MODAL_DISPLAY”) ===
“FREETRIALASSESMENTMODAL”
) {
return;
}
AARP.StayingSharp.evs.doEvsCheck();
});
});
} else {
AARP.StayingSharp.evs.doEvsCheck();
}
}
})();