// Include a reference to this script after the Qualtrics Site Intercept include code. // Set the script's data-overlay-selector to the selector for a modal overlay, if other than "#cboxOverlay". // Set the script's data-overlay-selector to an empty string if no modal overlay // For example: // // (function(){ // Map images IDs in the Qualtrics image library to Alt text descriptions. // IDs obtained from https://co1.qualtrics.com/ControlPanel/?ClientAction=ChangePage&Section=GraphicsSection, // Using inspector on "ODPHP Site/Page Surveys", get the image ID by looking for graphic-id="[the image id]" in the image's attributes // List below is sorted by: Last Modified, Descending // On 12/14/2016, newest item in list had graphic-modified-time="1480434825" var alt_text_from_im = { "IM_50e69M4ojFqWBDf" : "Health.gov logo", "IM_8cvmOXJnKq7BHfL" : "Health.gov logo", "IM_bvZHBswcXALaTEp" : "", // HF "no" Button background - empty alt text "IM_cwjNDbjTh2PRNIh" : "", // HF "yes" Button background - empty alt text "IM_9B6kgtdpKVQTKPb" : "healthfinder.gov logo", "IM_ablGLINmCvF6nhb" : "healthfinder.gov logo", "IM_08GQqeYsu8J1b4p" : "healthfinder.gov logo", "IM_3b1mwV8vh2CBqL3" : "", // HF Separator: empty alt text "IM_bwGmsHWPdFFFu0B" : "Health.gov logo", "IM_2uxEJNEipKoK4g5" : "Health.gov logo", "IM_a4RUH2WJ2z1Uv0p" : "Health.gov logo", "IM_7aot2Y14978lEvH" : "HealthyPeople.gov logo", "IM_ezGX8JdhQ2f6Rnv" : "", // HP Separator: empty alt text "IM_2ubSbX3lVIYywcJ" : "HealthyPeople.gov logo", "IM_1FavMeoZuxzuglf" : "HealthyPeople.gov logo", "IM_740BeEV3OmOcOfr" : "Department of Health and Human Services (HHS), Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_9tSApeFnaf6BmAt" : "Department of Health and Human Services (HHS), Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_085b4VRN0o2pBWd" : "Department of Health and Human Services (HHS), Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_6V6NjDBuSRSDWYd" : "", // HP "no" Button background (no border) - empty alt text "IM_3UBxV5NSSG0lWoR" : "", // HP "no" Button background - empty alt text "IM_0jJImoSl4G2XC9T" : "", // HP "yes" Button background (no border) - empty alt text "IM_aXmZKr01jiVZRcx" : "", // HP "yes" Button background - empty alt text "IM_3WrDq31UnegFhY1" : "HealthyPeople 2020 logo", "IM_bdUR0AQxqgxMlvv" : "HealthyPeople.gov logo", "IM_5AccHka1yAZyjgp" : "", // HP "no" Button background - empty alt text "IM_eJM6IYcj8mqDXqB" : "", // HP "no" Button background - empty alt text "IM_4OCPYRRJxZwKxyl" : "", // HP "no" Button background - empty alt text "IM_7OOqHhuUyv8ThfT" : "", // HP Separator: empty alt text "IM_01xZZt1lVEvtmux" : "", // HP Separator: empty alt text "IM_39nPLwzG5SWatGl" : "", // HP "yes" Button background - empty alt text "IM_6KlMuoS3qcpU1db" : "", // HP "yes" Button background - empty alt text "IM_9nTZ5WdWcueWKmF" : "Department of Health and Human Services (HHS), Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_esuGxuZgnnxBhXL" : "Department of Health and Human Services (HHS), Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_37znoJ3FsBiK3wF" : "Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_9ochVtAuIHR0qxL" : "Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_7UnLTLOBWXrSHxX" : "Department of Health and Human Services (HHS), Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_0PxDBQjG1VSaNaB" : "Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_cAPC8TRetfV6DxH" : "Department of Health and Human Services (HHS), Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_9T5ubg9TX3y195P" : "Office of Disease Prevention and Health Promotion (ODPHP) logo", "IM_0iI0FCyCrjdtzUx" : "", // separator - empty alt text "IM_9B4Q7xyBptsXCol" : "", // separator - empty alt text "IM_9oQDOSdw4niMnPf" : "HealthyPeople.gov/HealthyPeople 2020 logo" }; var im_regex = /.*[\?|&]IM\=([^&^#]+).*/; // Pull data- properties from the script tags var thisScript = document.querySelector('script[src$="/survey-wrapper.js"]'); var overlaySelector = thisScript && thisScript.getAttribute("data-overlay-selector"); if(!overlaySelector && overlaySelector !== "") { overlaySelector = "#cboxOverlay"; } function nodeHasClass(node,className) { return node.getAttribute && (" " + node.getAttribute("class") + " ").indexOf(" " + className + " ") >= 0; } function pointerDivKeyPress(event){ var key=event.keyCode || event.which; if (key==13){ var clickEvent = new MouseEvent("click", { "view": window, "bubbles": true, "cancelable": false }); this.dispatchEvent(clickEvent); } } function closeImgKeyPress(event){ var key=event.keyCode || event.which; if (key==13){ var clickEvent = new MouseEvent("click", { "view": window, "bubbles": true, "cancelable": false }); this.dispatchEvent(clickEvent); } } // Here we wait for the Qualtics Site Intercept div to appear // When it does, we modify to iframe to get focus // and modify the close button to become focusable and keyboard clickable. if(window.MutationObserver) (new MutationObserver(function(mutations) { var node,i,j,overlay,iframes,closeImgs,pointerDivs,imgs,img,src,im; mutations.forEach(function(mutation) { for(i=0;mutation.removedNodes && i 0){ iframes[0].setAttribute("tabindex",0); } pointerDivs = node.querySelectorAll('div[style*="cursor: pointer;"]'); for(j=0;pointerDivs&&jWe thank you for your time spent taking this survey.
// Your response has been recorded.
//
// // // 2) a default close button in the Site Intercept creative. function onmessage(event) { var data = event.message || event.data; if(data === "Close Survey"){ var closeSurveyBtn = document.querySelector('.QSIEmbeddedTarget img[src$="siteintercept/bwc_close.png"]'); if(closeSurveyBtn){ closeSurveyBtn.click(); } else { console.warn ("No closeSurveyBtn found"); } } else if(typeof data === "object" && data.surveyHeight ) { var eventOrigin = event.origin; var sourceFrame = null; // this is the IFRAME which send the postMessage var myFrames = document.getElementsByTagName("IFRAME"); for (var i=0; i0))) { sourceFrame = myFrames[i]; break; } } if(sourceFrame){ sourceFrame.setAttribute("scrolling","no"); } var parentDiv = sourceFrame ? sourceFrame.parentElement : null; while(parentDiv) { parentDiv.style.height = data.surveyHeight +"px"; parentDiv.style.maxWidth = "100%"; if((" "+parentDiv.getAttribute("class")+" ").indexOf(" QSIUserDefinedHTML ")>=0){ break; } parentDiv = parentDiv.parentElement; } } } // Some IE-friendly handling of events if (window.addEventListener){ window.addEventListener("message", onmessage, true); } else { window.attachEvent("onmessage", onmessage, true); } var sessionStart = window.sessionStorage ? window.sessionStorage.getItem("sessionStart") : undefined; if (sessionStart) { sessionStart = parseInt(sessionStart); } if (!sessionStart) { sessionStart = Math.ceil((new Date()).getTime() / 1000); if (window.sessionStorage) { window.sessionStorage.setItem("sessionStart", sessionStart); } } window.wait_for_session_delay = function (delay, andThen, obj) { var now = Math.ceil((new Date()).getTime() / 1000); var elapsed = now - sessionStart; if (elapsed >= delay) { andThen.call(obj); return; } var waitDuration = 1000 * (sessionStart ? delay - elapsed : 1); setTimeout(function () { window.wait_for_session_delay(delay, andThen, obj); }, waitDuration); }; }());