$(document).ready(function() { // doAJAX('daily-challenges', 'GET').promise.then((res) => { // if(res.success) { // const uploadReceiptChallenge = res.data.list.find(ch => ch.id === 6); // if(uploadReceiptChallenge) { // skaleChallenges.showChallengeItem(uploadReceiptChallenge); // } else { // console.error('Upload receipt challenge not found in the list.'); // } // } else { // console.error('Failed to fetch the list of challenges.'); // } // }).catch((err) => { // console.error('An error occurred while fetching the list of challenges:', err); // }); $('.main-game-wrapper span[name="chance_balance"]').closest('.text-bold').hide(); // const registerPopup = ` // // `; // $('body').append(registerPopup); // if (window.location.pathname === '/register') { // $('#register-popup').modal('show'); // } }); // Add a page-flag class only on the registration page // this is to add padding so that bottom sentence on registration page can be seen (function () { function isRegistrationPage() { const path = (location.pathname || "").toLowerCase(); const q = (location.search || "").toLowerCase(); if (path.includes("register")) { return true; } } function applyRegistrationFlag() { if (isRegistrationPage()) { document.documentElement.classList.add("skale-register"); document.body.classList.add("skale-register"); // fallback in case CSS load order is tricky const main = document.querySelector(".main-section"); if (main) main.style.paddingBottom = "3rem"; } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", applyRegistrationFlag); } else { applyRegistrationFlag(); } })(); // change header text only for registration page (function () { if (!/\/register\/?$/.test(location.pathname.toLowerCase())) return; function updateHeader() { const el = document.querySelector('.main-section .col.col-12.col-sm-9.mx-auto h4.text-center') || document.querySelector('.main-section h4.text-center'); if (el) el.textContent = 'Pharm-D Health Science Rewards'; } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', updateHeader); } else { updateHeader(); } })(); // inserts a logo image onto home page, on top of the challenges footer bar at the bottom (function ($) { $(function () { var IMAGE_URL = '/file/images/list_of_logo.webp'; var selectorBottomBar = 'section.bottom_section.bottom-gradient.position-fixed.w-100.z-1'; var $bottomBar = $(selectorBottomBar); // Create banner once function ensureBanner() { var $existing = $('#skale-custom-bottom-banner'); if ($existing.length) return $existing; var $banner = $( '
' + '' + '
' ); $('body').append($banner); return $banner; } // Read current bottom bar height (0 if missing/hidden) function getBottomBarHeight() { if ($bottomBar.length && $bottomBar.is(':visible')) { // include margins just in case layout uses them return Math.max( $bottomBar.outerHeight(true) || 0, parseInt($bottomBar.css('height'), 10) || 0 ); } return 0; } // Position banner above the bar with a small gap function positionBanner() { var gap = 8; // px var lift = getBottomBarHeight() + gap; $('#skale-custom-bottom-banner').css('bottom', lift + 'px'); } function startObservers() { var $banner = ensureBanner(); positionBanner(); // Reposition on viewport changes $(window).on('resize.skaleCustomBanner', positionBanner); // If the bottom bar exists, watch for size/class/style changes if ($bottomBar.length) { // ResizeObserver for height changes (if supported) if (window.ResizeObserver) { var ro = new ResizeObserver(positionBanner); ro.observe($bottomBar.get(0)); } // MutationObserver for visibility/class/style toggling var mo = new MutationObserver(positionBanner); mo.observe($bottomBar.get(0), { attributes: true, attributeFilter: ['style', 'class'] }); } else { var moRoot = new MutationObserver(function () { $bottomBar = $(selectorBottomBar); if ($bottomBar.length) { positionBanner(); startObservers(); moRoot.disconnect(); } }); moRoot.observe(document.body, { childList: true, subtree: true }); } } startObservers(); }); })(window.jQuery || window.$); /* === show #popup_custom on /home === * - If we're on /register and #popup_custom isn't in the DOM, fetch /home, extract the modal markup, append it, then show it. */ (function () { if (window.location.pathname !== '/register') return; function showPopupCustom() { var modalEl = document.getElementById('popup_custom'); if (!modalEl) return; if (window.bootstrap && window.bootstrap.Modal) { var inst = bootstrap.Modal.getOrCreateInstance(modalEl, { backdrop: true, keyboard: true }); inst.show(); } else if (window.jQuery && typeof jQuery(modalEl).modal === 'function') { jQuery(modalEl).modal('show'); } } // if it already exists (e.g., the backend started rendering it globally later), just show it if (document.getElementById('popup_custom')) { setTimeout(showPopupCustom, 300); return; } // otherwise, fetch markup from /home and extract it jQuery .get('/home') .done(function (html) { var $scratch = jQuery('
').html(html); // grab the modal node from /home var $modal = $scratch.find('#popup_custom').first(); if (!$modal.length) return; // ensure we don't already have a node with this id jQuery('body').append($modal); // copy over any associated inline styles from /home’s