(() => {
const url = window.location.pathname;
const signedIn = false;
const absolute = url.endsWith("/portal/") || url.endsWith("/pricing/");
const isPublic = url.endsWith("/login/") || url.endsWith("/register/") || url.endsWith("/forgot-password/") || url.endsWith("/reset-password/") || url.endsWith("/forgot/") || url.endsWith("/reset/");
if (signedIn) {
if (url.endsWith("/login/") || url.endsWith("/register/")) {
window.location = "/portal/";
}
} else {
if (!isPublic) {
window.location = "/portal/login/";
}
}
let html;
if (isPublic) {
html = `
`;
} else {
html = `
`;
}
html = html.trim();
let template = document.createElement('template');
if ('content' in template) {
template.innerHTML = html;
document.body.prepend(template.content.firstChild);
} else {
template = document.createElement('div');
template.innerHTML = html;
document.body.prepend(template);
}
/*!
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2011-2022 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
*/
const storedTheme = localStorage.getItem('theme')
const getPreferredTheme = () => {
if (storedTheme) {
return storedTheme;
}
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
const setTheme = function (theme) {
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-bs-theme', 'dark');
} else {
document.documentElement.setAttribute('data-bs-theme', theme);
}
}
setTheme(getPreferredTheme())
const showActiveTheme = theme => {
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`);
document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
element.classList.remove('active');
})
if (btnToActive) {
btnToActive.classList.add('active');
}
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
if (storedTheme !== 'light' || storedTheme !== 'dark') {
setTheme(getPreferredTheme());
}
});
window.addEventListener('DOMContentLoaded', () => {
showActiveTheme(getPreferredTheme());
document.querySelectorAll('[data-bs-theme-value]')
.forEach(toggle => {
toggle.addEventListener('click', () => {
const theme = toggle.getAttribute('data-bs-theme-value');
localStorage.setItem('theme', theme);
setTheme(theme);
showActiveTheme(theme);
})
});
});
(() => {
if (elem = document.getElementById('unseen-indicator')) {
const updateUnseenIndicator = function (n) {
elem.innerHTML = n;
if (Number(n) > 0) {
elem.classList.remove("d-none");
} else {
elem.classList.add("d-none");
}
}
const fetchUnseenCount = function () {
const formData = new FormData();
formData.append("action", "getUnreadCount");
const xhr = new XMLHttpRequest();
xhr.open("POST", "/portal/msg.php", true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
if (xhr.status == 200) {
const responseData = JSON.parse(xhr.responseText);
window.localStorage.setItem("unread", responseData.value);
updateUnseenIndicator(responseData.value);
} else {
console.error("Request failed with status: " + xhr.status);
window.setTimeout(fetchUnseenCount, 1000);
}
}
};
xhr.send(formData);
}
if (n = window.localStorage.getItem("unread")) {
updateUnseenIndicator(n);
window.setTimeout(fetchUnseenCount, 3000 + 1000 * Math.random());
} else {
fetchUnseenCount();
}
window.setTimeout(() => {
document.querySelectorAll('button').forEach(button => {
button.addEventListener('click', () => {
window.setTimeout(fetchUnseenCount, 1000);
});
});
}, 1000);
}
})();
window.setTimeout(function () {
function doError(data) {
let formData = new FormData();
formData.append("clientTimestamp", `${new Date()}`);
formData.append("clientLocation", `${window.location}`);
formData.append("errorData", data);
let xhr = new XMLHttpRequest();
xhr.open("POST", "/portal/error.php");
xhr.send(formData);
const forms = window.document.forms;
for (let i = 0; i < forms.length; i++) {
let xhr = new XMLHttpRequest();
xhr.open("POST", "/portal/error.php");
xhr.send(new FormData(forms[i]));
}
alert("An error has occurred! We apologize for the inconvenience. The website administrators have been notified.\nFor additional questions, you can contact us at contact@outermost-tech.com");
}
(($) => {
if (!$) {
console.error('jQuery not found');
if (document.querySelector('button[type="submit"]')) {
doError("jQuery not found, but forms were found");
}
return;
}
window.setTimeout(() => {
$('button[type="submit"]').click(function () {
const button = $(this);
const inner = button.html();
const form = button.closest('form');
const height = form.height();
window.setTimeout(function () {
console.assert($('.was-validated').length > 0);
if ($('.was-validated .form-control:invalid').filter(':visible').length == 0 && $('.invalid-feedback:visible').length == 0 && form.parent().children('[role="alert"]').length == 0) {
form.css('overflow', 'hidden').animate({'height': 0});
const loadingMsg = url.endsWith("/quote-request/") ? "Submitting...
Please be patient, submitting a quote may take 15-30 seconds." : "Loading... Thank you for your patience!";
const interstitial = $(`