/* PM delivery-only: hide pickup/search UI, force default store, go to menu */ (function(){ var DEFAULT = {slug:"papa-murphys-4010-ne-fremont", id:"45717", name:"Papa Murphy's 4010 NE Fremont"}; function hasStore(){ try { return !!localStorage.getItem("PMI_SelectedStore"); } catch(e){ return false; } } function gotoMenu(){ location.replace("/order/" + DEFAULT.slug + "/?storeId=" + DEFAULT.id + "&storeName=" + encodeURIComponent(DEFAULT.name) + "&deliveryMode="); } function boot(){ if (location.pathname === "/order/") { if (!hasStore()) { fetch("/pmapi/restaurants/near?lat=45.5142733&long=-122.6389770&radius=25&limit=1") .then(function(r){ return r.json(); }) .then(function(arr){ var s = (arr && arr[0]) || DEFAULT; localStorage.setItem("PMI_SelectedStore", JSON.stringify(s)); localStorage.setItem("PMI_StoreId", String(s.id || DEFAULT.id)); localStorage.setItem("PMI_SelectedStoreName", s.name || DEFAULT.name); localStorage.setItem("PMI_StoreSlug", s.slug || DEFAULT.slug); }).catch(function(){}) .finally(function(){ gotoMenu(); }); } else { gotoMenu(); } } } /* hide the search panel css on order root */ var st = document.createElement("style"); st.textContent = '.order-search .tablist,[role="search"]{display:none!important}'; document.head.appendChild(st); if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", boot); else boot(); })();