diff --git a/docusaurus.config.js b/docusaurus.config.js index c810b5f4..63b5f1c7 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -151,42 +151,29 @@ const config = { }), plugins: ["docusaurus-plugin-sass"], - headTags: [ + headTags: [], + scripts: [ { - tagName: "script", - innerHTML: ` - window['_fs_host'] = 'fullstory.com'; - window['_fs_script'] = 'edge.fullstory.com/s/fs.js'; - window['_fs_org'] = 'o-1QJ4QX-na1'; - window['_fs_namespace'] = 'FS'; - !function(m,n,e,t,l,o,g,y){var s,f,a=function(h){ - return!(h in m)||(m.console&&m.console.log&&m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'),!1)}(e) - ;function j(b){var h,d=[];function k(){h&&(d.forEach((function(b){var d;try{d=b[h[0]]&&b[h[0]](h[1])}catch(h){return void(b[3]&&b[3](h))} - d&&d.then?d.then(b[2],b[3]):b[2]&&b[2](d)})),d.length=0)}function r(b){return function(d){h||(h=[b,d],k())}}return b(r(0),r(1)),{ - then:function(b,h){return j((function(r,i){d.push([b,h,r,i]),k()}))}}}a&&(g=m[e]=function(){var b=function(b,d,k,r){function i(i,c){ - h(b,d,k,i,c,r)}r=r||2;var c,u=/Async$/;return u.test(b)?(b=b.replace(u,""),"function"==typeof Promise?new Promise(i):j(i)):h(b,d,k,c,c,r)} - ;function h(h,d,k,r,i,c){return b._api?b._api(h,d,k,r,i,c):(b.q&&b.q.push([h,d,k,r,i,c]),null)}return b.q=[],b}(),y=function(b){function h(h){ - "function"==typeof h[4]&&h[4](new Error(b))}var d=g.q;if(d){for(var k=0;k + `; + headerContainer.appendChild(customBanner); + + const announcementBar = document.createElement('div'); + announcementBar.className = 'announcementBar'; + announcementBar.innerHTML = ` +
${announcementText}
+ + `; + headerContainer.appendChild(announcementBar); + } +} + +function setInitialVisibility() { + const customBanner = document.getElementById('bannerica'); + const announcementBar = document.querySelector('.announcementBar'); + const savedState = localStorage.getItem('bannerVisible'); + + if (savedState !== null) { + const isBannerVisible = savedState === 'true'; + customBanner.style.display = isBannerVisible ? 'block' : 'none'; + announcementBar.style.display = isBannerVisible ? 'none' : 'block'; + } else { + customBanner.style.display = 'block'; + announcementBar.style.display = 'none'; + } +} + +function bindEventListeners() { + const customBanner = document.getElementById('bannerica'); + const announcementBar = document.querySelector('.announcementBar'); + const closeBtn = customBanner.querySelector('.close-banner-btn'); + const expandBtn = announcementBar.querySelector('.expand-banner-btn'); + + if (closeBtn && !closeBtn.hasAttribute('data-listener')) { + closeBtn.addEventListener('click', handleBannerClose); + closeBtn.setAttribute('data-listener', 'true'); + } + + if (expandBtn && !expandBtn.hasAttribute('data-listener')) { + expandBtn.addEventListener('click', handleBannerExpand); + expandBtn.setAttribute('data-listener', 'true'); + } +} + +function handleBannerClose(event) { + event.preventDefault(); + event.stopPropagation(); + + const customBanner = document.getElementById('bannerica'); + const announcementBar = document.querySelector('.announcementBar'); + + customBanner.style.display = 'none'; + announcementBar.style.display = 'block'; + localStorage.setItem('bannerVisible', 'false'); +} + +function handleBannerExpand() { + const customBanner = document.getElementById('bannerica'); + const announcementBar = document.querySelector('.announcementBar'); + + customBanner.style.display = 'block'; + announcementBar.style.display = 'none'; + localStorage.setItem('bannerVisible', 'true'); +} diff --git a/static/scripts/fullstory.js b/static/scripts/fullstory.js new file mode 100644 index 00000000..54cca9d1 --- /dev/null +++ b/static/scripts/fullstory.js @@ -0,0 +1,19 @@ +window['_fs_host'] = 'fullstory.com'; +window['_fs_script'] = 'edge.fullstory.com/s/fs.js'; +window['_fs_org'] = 'o-1QJ4QX-na1'; +window['_fs_namespace'] = 'FS'; +!function(m,n,e,t,l,o,g,y){var s,f,a=function(h){ + return!(h in m)||(m.console&&m.console.log&&m.console.log('FullStory namespace conflict. Please set window["_fs_namespace"].'),!1)}(e) +;function j(b){var h,d=[];function k(){h&&(d.forEach((function(b){var d;try{d=b[h[0]]&&b[h[0]](h[1])}catch(h){return void(b[3]&&b[3](h))} + d&&d.then?d.then(b[2],b[3]):b[2]&&b[2](d)})),d.length=0)}function r(b){return function(d){h||(h=[b,d],k())}}return b(r(0),r(1)),{ + then:function(b,h){return j((function(r,i){d.push([b,h,r,i]),k()}))}}}a&&(g=m[e]=function(){var b=function(b,d,k,r){function i(i,c){ + h(b,d,k,i,c,r)}r=r||2;var c,u=/Async$/;return u.test(b)?(b=b.replace(u,""),"function"==typeof Promise?new Promise(i):j(i)):h(b,d,k,c,c,r)} +;function h(h,d,k,r,i,c){return b._api?b._api(h,d,k,r,i,c):(b.q&&b.q.push([h,d,k,r,i,c]),null)}return b.q=[],b}(),y=function(b){function h(h){ + "function"==typeof h[4]&&h[4](new Error(b))}var d=g.q;if(d){for(var k=0;k