From b81dabf65894a48b1107d87873a8fbaf820d5241 Mon Sep 17 00:00:00 2001 From: Max Edell Date: Mon, 13 Nov 2023 12:02:37 -0800 Subject: [PATCH] fix: disable language selector for now --- blocks/header/header.js | 6 +++++- scripts/lib-franklin.js | 12 ------------ scripts/scripts.js | 18 ++++++++++++++++-- 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/blocks/header/header.js b/blocks/header/header.js index 725e9b2..31bda98 100644 --- a/blocks/header/header.js +++ b/blocks/header/header.js @@ -10,6 +10,7 @@ import { isTouchDevice, parseFragment, render, + LANGUAGE_SELECTOR_ENABLED, } from '../../scripts/scripts.js'; // @@ -642,7 +643,10 @@ export default async function decorate(block) { } // load custom elements - import('../language-selector/language-selector.js'); + + if (LANGUAGE_SELECTOR_ENABLED) { + import('../language-selector/language-selector.js'); + } import('../search-bar/search-bar.js'); import('../theme-toggle/theme-toggle.js'); } diff --git a/scripts/lib-franklin.js b/scripts/lib-franklin.js index 920dbff..6ccfbf6 100644 --- a/scripts/lib-franklin.js +++ b/scripts/lib-franklin.js @@ -671,18 +671,6 @@ export function loadFooter(footer) { return loadBlock(footerBlock); } -/** - * Loads a block named 'language selector' just above the footer - * @param footer footer element - * @returns {Promise} - */ -export function loadLanguageSelector(footer) { - const languageSelectorBlock = buildBlock('language-selector', ''); - footer.append(languageSelectorBlock); - decorateBlock(languageSelectorBlock); - return loadBlock(languageSelectorBlock); -} - /** * Setup block utils. */ diff --git a/scripts/scripts.js b/scripts/scripts.js index a28521b..8f76f22 100644 --- a/scripts/scripts.js +++ b/scripts/scripts.js @@ -12,7 +12,6 @@ import { loadCSS, loadFooter, loadHeader, - loadLanguageSelector, sampleRUM, toClassName, updateSectionsStatus, @@ -24,6 +23,7 @@ polyfill(); const range = document.createRange(); +export const LANGUAGE_SELECTOR_ENABLED = false; export const BRANCH_ORIGIN = 'https://prisma-cloud-docs-production.adobeaem.workers.dev'; // export const BRANCH_ORIGIN = 'http://127.0.0.1:3001'; @@ -1012,6 +1012,18 @@ export function addFavIcon(href) { } } +/** + * Loads a block named 'language selector' just above the footer + * @param footer footer element + * @returns {Promise} + */ +function loadLanguageSelector(footer) { + const languageSelectorBlock = buildBlock('language-selector', ''); + footer.append(languageSelectorBlock); + decorateBlock(languageSelectorBlock); + return loadBlock(languageSelectorBlock); +} + /** * Loads everything that doesn't need to be delayed. * @param {Element} doc The container element @@ -1026,7 +1038,9 @@ async function loadLazy(doc) { if (hash && element) element.scrollIntoView(); loadHeader(doc.querySelector('header')); - loadLanguageSelector(doc.querySelector('footer')); + if (LANGUAGE_SELECTOR_ENABLED) { + loadLanguageSelector(doc.querySelector('footer')); + } loadFooter(doc.querySelector('footer')); if (doc.body.classList.contains('book')) {