From 04b3569c64a13e569bb141d559b5195155dc8314 Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Wed, 26 Feb 2025 11:24:25 -0800 Subject: [PATCH 1/2] fix: Qualtrics on staging env not showing --- biome.json | 4 +++- layouts/partials/qualtrics-feedback.html | 20 +++++++++++++------- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/biome.json b/biome.json index 8bb60fc..683bcda 100644 --- a/biome.json +++ b/biome.json @@ -24,7 +24,9 @@ "**/highlight.css", "**/*-overrides.css", - "exampleSite" + "exampleSite", + "public/*", + "test-results/*" ] }, "formatter": { diff --git a/layouts/partials/qualtrics-feedback.html b/layouts/partials/qualtrics-feedback.html index 2d4ed58..5580578 100644 --- a/layouts/partials/qualtrics-feedback.html +++ b/layouts/partials/qualtrics-feedback.html @@ -47,17 +47,23 @@ a.src=g; document.body&&document.body.appendChild(a) } - }; - + }; + this.start=function(){ var t=this; "complete"!==document.readyState?window.addEventListener ? window.addEventListener("load",function(){t.go()},!1) : - window.attachEvent&&window.attachEvent("onload",function(){t.go()}):t.go()};}; - try{ - (new g(100,"r","QSI_S_ZN_2QSTn2r41YlXrYk","https://zn2qstn2r41ylxryk-f5.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_2QSTn2r41YlXrYk")).start() - } - catch(i){}})(); + window.attachEvent&&window.attachEvent("onload",function(){t.go()}):t.go()}; + }; + + try{ + (new g(100,"r", window.location.hostname.includes("staging") ? "QSI_S_ZN_2YG73ads2zp5bN0" : "QSI_S_ZN_2QSTn2r41YlXrYk", window.location.hostname.includes("staging") ? "https://zn2yg73ads2zp5bn0-f5.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_2YG73ads2zp5bN0" : "https://zn2qstn2r41ylxryk-f5.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_2QSTn2r41YlXrYk")).start() + } + catch(i){}})(); + + document.addEventListener("DOMContentLoaded", function () { + document.querySelector(".qualtrics-feedback").id = window.location.hostname.includes("staging") ? "ZN_2YG73ads2zp5bN0" : "ZN_2QSTn2r41YlXrYk" + });
From 8aeb82bf793cc3c956793b09a999f1b28e9c2fbf Mon Sep 17 00:00:00 2001 From: Lam Nguyen Date: Wed, 26 Feb 2025 12:06:16 -0800 Subject: [PATCH 2/2] chore: Refactored code cleaner --- layouts/partials/qualtrics-feedback.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/layouts/partials/qualtrics-feedback.html b/layouts/partials/qualtrics-feedback.html index 5580578..7c47138 100644 --- a/layouts/partials/qualtrics-feedback.html +++ b/layouts/partials/qualtrics-feedback.html @@ -56,8 +56,10 @@ window.attachEvent&&window.attachEvent("onload",function(){t.go()}):t.go()}; }; - try{ - (new g(100,"r", window.location.hostname.includes("staging") ? "QSI_S_ZN_2YG73ads2zp5bN0" : "QSI_S_ZN_2QSTn2r41YlXrYk", window.location.hostname.includes("staging") ? "https://zn2yg73ads2zp5bn0-f5.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_2YG73ads2zp5bN0" : "https://zn2qstn2r41ylxryk-f5.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_2QSTn2r41YlXrYk")).start() + try{ + const project_id = window.location.hostname.includes("staging") ? "QSI_S_ZN_2YG73ads2zp5bN0" : "QSI_S_ZN_2QSTn2r41YlXrYk"; + const endpoint = window.location.hostname.includes("staging") ? "https://zn2yg73ads2zp5bn0-f5.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_2YG73ads2zp5bN0" : "https://zn2qstn2r41ylxryk-f5.siteintercept.qualtrics.com/SIE/?Q_ZID=ZN_2QSTn2r41YlXrYk"; + (new g(100,"r", project_id, endpoint)).start() } catch(i){}})();