From 850cd384fb90b9ab755c8d60465b9ea608c00879 Mon Sep 17 00:00:00 2001 From: Vitaly Tsaplin Date: Tue, 18 Jun 2024 13:43:04 +0200 Subject: [PATCH 1/2] Revert "feat: add mystique button" This reverts commit bac30bfcd4cf2fa610fcc2ac14a8f024f39b3984. --- scripts/delayed.js | 18 ------------------ tools/sidekick/config.json | 6 ------ 2 files changed, 24 deletions(-) diff --git a/scripts/delayed.js b/scripts/delayed.js index a08e3ec7..3ec6aebf 100644 --- a/scripts/delayed.js +++ b/scripts/delayed.js @@ -19,21 +19,3 @@ const analyticsConsent = localStorage.getItem('consent_status_ANALYTICS'); if (analyticsConsent) { await analyticsSetConsent(analyticsConsent === 'ALLOW'); } - -const mystique = async ({ detail }) => { - // const sk = detail.data; - // // your custom code from button.action goes here - console.log('Load Mystique here...', sk); -}; - -const sk = document.querySelector('helix-sidekick'); -if (sk) { - // sidekick already loaded - sk.addEventListener('custom:mystique', mystique); -} else { - // wait for sidekick to be loaded - document.addEventListener('sidekick-ready', () => { - document.querySelector('helix-sidekick') - .addEventListener('custom:mystique', mystique); - }, { once: true }); -} \ No newline at end of file diff --git a/tools/sidekick/config.json b/tools/sidekick/config.json index e0b181ff..346d2410 100644 --- a/tools/sidekick/config.json +++ b/tools/sidekick/config.json @@ -24,12 +24,6 @@ "passConfig": true, "environments": [ "preview", "live", "edit" ], "includePaths": ["**.docx**"] - }, - { - "id": "mystique", - "title": "Mystique", - "event": "mystique", - "environments": [ "dev", "preview" ] } ] } From 0b39338ca3b99a8630f74da9ff276a2b0857d9a6 Mon Sep 17 00:00:00 2001 From: Vitaly Tsaplin Date: Tue, 18 Jun 2024 13:43:15 +0200 Subject: [PATCH 2/2] Revert "feat: add style toggle buttons" This reverts commit 124a6ea9d020ecabe04bfe3175ac70a8ff495c46. --- head.html | 1 - toggleStyles.js | 108 ------------------------------------------------ 2 files changed, 109 deletions(-) delete mode 100644 toggleStyles.js diff --git a/head.html b/head.html index 0dbfcbb2..9c1b93b2 100644 --- a/head.html +++ b/head.html @@ -1,5 +1,4 @@ - diff --git a/toggleStyles.js b/toggleStyles.js deleted file mode 100644 index 203d8acb..00000000 --- a/toggleStyles.js +++ /dev/null @@ -1,108 +0,0 @@ -document.addEventListener('DOMContentLoaded', () => { - // Check query parameters - const urlParams = new URLSearchParams(window.location.search); - const useGeneratedStyles = urlParams.has('generatedStyles'); - - // Create stylesheets and buttons - const stylesheets = []; - const buttons = []; - - if (useGeneratedStyles) { - // Create and add the generatedStyles.css stylesheet - const stylesheet = document.createElement('link'); - stylesheet.id = 'generatedStyles'; - stylesheet.rel = 'stylesheet'; - stylesheet.href = '/generatedStyles.css'; - stylesheet.disabled = false; - document.head.appendChild(stylesheet); - } else { - // Add stylesheets and buttons for files in the /generated folder - for (let i = 0; i <= 5; i++) { // Assuming there are 5 stylesheets for this example - (function (i) { - const stylesheet = document.createElement('link'); - stylesheet.id = `style${i}`; - stylesheet.rel = 'stylesheet'; - stylesheet.href = `/generated/styles${i}.css`; - stylesheet.disabled = true; - document.head.appendChild(stylesheet); - stylesheets.push(stylesheet); - - const button = document.createElement('button'); - button.className = 'toggle-button'; - button.innerHTML = `Enable Variation ${i}`; - button.style.bottom = `${20 + (i + 1) * 50}px`; // Adjust vertical position - button.onclick = function () { - toggleStyle(i); - }; - document.body.appendChild(button); - buttons.push(button); - }(i)); - } - - // Add the disable all styles button - const disableAllButton = document.createElement('button'); - disableAllButton.className = 'toggle-button'; - disableAllButton.innerHTML = 'Original Styles'; - disableAllButton.style.bottom = '20px'; // Position at the bottom - disableAllButton.onclick = disableAllStyles; - document.body.appendChild(disableAllButton); - } - - // Define the toggle function for each stylesheet - function toggleStyle(index) { - stylesheets.forEach((stylesheet, i) => { - stylesheet.disabled = true; - buttons[i].innerHTML = `Enable Variation ${i}`; - buttons[i].style.backgroundColor = '#007BFF'; - }); - - const stylesheet = document.getElementById(`style${index}`); - stylesheet.disabled = false; - updateButtonState(index); - } - - // Define the function to disable all stylesheets - function disableAllStyles() { - stylesheets.forEach((stylesheet, i) => { - stylesheet.disabled = true; - buttons[i].innerHTML = `Enable Variation ${i}`; - buttons[i].style.backgroundColor = '#007BFF'; - }); - } - - // Define the function to update the button state - function updateButtonState(index) { - const button = buttons[index]; - button.innerHTML = `Disable Variation ${index}`; - button.style.backgroundColor = '#FF0000'; - } - - // Hide buttons if using generatedStyles.css - if (useGeneratedStyles) { - console.log('Hiding buttons'); - buttons.forEach((button) => { - button.style.display = 'none'; - }); - } - - // Add styles for the buttons - const style = document.createElement('style'); - style.innerHTML = ` - .toggle-button { - position: fixed; - right: 20px; - padding: 10px 20px; - background-color: #007BFF; - color: white; - border: none; - border-radius: 5px; - cursor: pointer; - z-index: 1000; - } - - .toggle-button:hover { - opacity: 0.8; - } - `; - document.head.appendChild(style); -});