Trending
Din Tai Fung is coming to Scottsdale
Chandler building first new affordable housing since 1972
23 photos of the Phoenix skyline, from 1889 to now
City of Phoenix acquiring Fry’s Electronics store
The worst Phoenix restaurant inspections in July
News
We have a favor to ask
We're in the midst of our summer membership campaign, and we have until August 25 to raise $8,500. Your contributions are an investment in our election coverage – they help sustain our newsroom, help us plan, and could lead to an increase in freelance writers or photographers. If you value our work, please make a contribution today to help us reach our goal.
Progress to goal
$8,500
$700
Browse the weekly print newspaper— and the latest special issues —from your laptop with Phoenix New Times' interactive flipbook.
Flipbook Archive
Music
Cannabis
Phoenix New Times Stuff
Don't Miss Out
SIGN UP for the latestfree stuff and more!
Newsletter Sign Up
Enter your name, zip code, and email
I agree to the Terms of Service andPrivacy Policy
Story Console Sponsored Content
`); sm.containerWidth = options.containerWidth || 640; sm.containerHeight = options.containerHeight || 480; sm.containerWidthSmall = options.containerWidthSmall || 300; sm.containerHeightSmall = options.containerHeightSmall || 300; // sm.slideModalStylesText = `#${sm.containerId} { position: fixed; width: ${sm.containerWidth}px; height: ${sm.containerHeight}px; max-width: 100%; background-color: #FFF; box-sizing: border-box; transition-timing-function: cubic-bezier(.65,.05,.36,1); transition-duration: 750ms;}#${sm.containerId}.origin-top { left: calc(50% - ${sm.containerWidth/2}px); top: -${sm.containerHeight}px; transition-property: top;}#${sm.containerId}.origin-bottom { left: calc(50% - ${sm.containerWidth/2}px); bottom: -${sm.containerHeight}px; transition-property: bottom;}#${sm.containerId}.origin-left { top: calc(50% - ${sm.containerHeight/2}px); left: -${sm.containerWidth}px; transition-property: left;}#${sm.containerId}.origin-right { top: calc(50% - ${sm.containerHeight/2}px); right: -${sm.containerWidth}px; transition-property: right;}#${sm.containerId}.origin-top.slide-to-edge { top: 0; }#${sm.containerId}.origin-bottom.slide-to-edge { bottom: 0; }#${sm.containerId}.origin-left.slide-to-edge { left: 0; }#${sm.containerId}.origin-right.slide-to-edge { right: 0; }#${sm.containerId}.origin-top.slide-to-center { top: calc(50% - ${sm.containerHeight/2}px); }#${sm.containerId}.origin-bottom.slide-to-center { bottom: calc(50% - ${sm.containerHeight/2}px); }#${sm.containerId}.origin-left.slide-to-center { left: calc(50% - ${sm.containerWidth/2}px); }#${sm.containerId}.origin-right.slide-to-center { right: calc(50% - ${sm.containerWidth/2}px); }@media (max-width:${sm.containerWidth - 1}px) or (max-height:${sm.containerHeight - 1}px) { #${sm.containerId} { width: ${sm.containerWidthSmall}px; height: ${sm.containerHeightSmall}px; } #${sm.containerId}.origin-top { left: calc(50% - ${sm.containerWidthSmall/2}px); top: -${sm.containerHeightSmall}px; transition-property: top; } #${sm.containerId}.origin-bottom { left: calc(50% - ${sm.containerWidthSmall/2}px); bottom: -${sm.containerHeightSmall}px; transition-property: bottom; } #${sm.containerId}.origin-left { top: calc(50% - ${sm.containerHeightSmall/2}px); left: -${sm.containerWidthSmall}px; transition-property: left; } #${sm.containerId}.origin-right { top: calc(50% - ${sm.containerHeightSmall/2}px); right: -${sm.containerWidthSmall}px; transition-property: right; } #${sm.containerId}.origin-top.slide-to-center { top: calc(50% - ${sm.containerHeightSmall/2}px); } #${sm.containerId}.origin-bottom.slide-to-center { bottom: calc(50% - ${sm.containerHeightSmall/2}px); } #${sm.containerId}.origin-left.slide-to-center { left: calc(50% - ${sm.containerWidthSmall/2}px); } #${sm.containerId}.origin-right.slide-to-center { right: calc(50% - ${sm.containerWidthSmall/2}px); }} `; // sm.getLocalStorageVersion = function () { return parseInt(window.localStorage.getItem(sm.localStorageVersionKey)) || sm.version; } sm.getLastDismissedTime = function () { return parseInt(window.localStorage.getItem(sm.localStorageDismissedKey)) || 0; } sm.getLastDismissedForeverTime = function () { return parseInt(window.localStorage.getItem(sm.localStorageDismissedForeverKey)) || 0; } sm.getLastDeniedTime = function () { return parseInt(window.localStorage.getItem(sm.localStorageDeniedKey)) || 0; } sm.resetSlideModalLocalStorage = function () { window.localStorage.setItem(sm.localStorageVersionKey, sm.version); window.localStorage.removeItem(sm.localStorageDismissedKey); window.localStorage.removeItem(sm.localStorageDismissedForeverKey); window.localStorage.removeItem(sm.localStorageDeniedKey); } sm.showSlideModal = function () { sm.container.addClass(`slide-to-${sm.slideTo}`); } sm.hideSlideModal = function () { sm.container.removeClass(`slide-to-${sm.slideTo}`); } sm.dismissSlideModal = function () { window.localStorage.setItem(sm.localStorageVersionKey, sm.version); window.localStorage.setItem(sm.localStorageDismissedKey, new Date().getTime()); console.log(`SlideModal dismissed.`); sm.hideSlideModal(); } sm.dismissForeverSlideModal = function () { window.localStorage.setItem(sm.localStorageVersionKey, sm.version); window.localStorage.setItem(sm.localStorageDismissedForeverKey, new Date().getTime()); console.log(`SlideModal dismissed.`); sm.hideSlideModal(); } sm.denySlideModal = function (e) { window.localStorage.setItem(sm.localStorageVersionKey, sm.version); window.localStorage.setItem(sm.localStorageDeniedKey, new Date().getTime()); console.log(`SlideModal denied.`); sm.hideSlideModal(); } injectSlideModalStyles = function () { console.log(`SlideModal styles added.`); const slideModalStyleContainer = jQuery(`
`); slideModalStyleContainer.text(sm.slideModalStylesText); jQuery('head').append(slideModalStyleContainer); } injectSlideModalBlock = function () { console.log(`SlideModal element added.`); sm.container = jQuery(`
`); sm.container .attr(`id`, sm.containerId) .attr(`fdn-slide-modal`,``) .attr(`form-part-showing`,`1`) .addClass(`origin-${sm.slideOrigin}`) .html(sm.htmlBlock) jQuery('body').append(sm.container); } setupSlideModalBehavior = function () { console.log(`SlideModal behavior setup.`); jQuery(document).on(`keydown`, (e) => { if (e.key === `Escape` && sm.escClose === true) { sm.hideSlideModal(); } }); jQuery(document).on(`click`, (e) => { const myTarget = jQuery(e.target); const notSlideModal = myTarget.not(`#${sm.containerId} *`).length > 0; const isDismissTarget = myTarget.closest(sm.dismissSelector).length > 0; const isDismissForeverTarget = myTarget.closest(sm.dismissForeverSelector).length > 0; const isDenyTarget = myTarget.closest(sm.deniedSelector).length > 0; window.console.log(`notSlideModal: ${notSlideModal}; isDismissTarget: ${isDismissTarget}; isDenyTarget: ${isDenyTarget}; sm.bgClose: ${sm.bgClose}`); if (notSlideModal && sm.bgClose === true) sm.hideSlideModal(); if (isDismissTarget || isDismissForeverTarget || isDenyTarget) e.preventDefault(); if (isDismissTarget) sm.dismissSlideModal(); if (isDismissForeverTarget) sm.dismissForeverSlideModal(); if (isDenyTarget) sm.denySlideModal(); }); } if (sm.getLocalStorageVersion() < sm.version) { sm.resetSlideModalLocalStorage(); } const notDismissed = new Date().getTime() > sm.getLastDismissedTime() + sm.delayAfterDismissed; const notDismissedForever = new Date().getTime() > sm.getLastDismissedForeverTime() + sm.delayAfterDismissedForever; const notDenied = new Date().getTime() > sm.getLastDeniedTime() + sm.delayAfterDenied; jQuery(() => { if (notDismissed && notDenied && notDismissedForever) { injectSlideModalStyles(); injectSlideModalBlock(); setupSlideModalBehavior(); const contentReady = new Event(sm.contentReadyEventId); console.log(`Content ready fired. EventId: ${sm.contentReadyEventId}`); window.dispatchEvent(contentReady); // 100 milliseconds added to ensure setup is complete before show setTimeout(sm.showSlideModal, sm.delayBeforeShow + 100); } }); Foundation.SlideModal[slideModalId] = sm;}