From 89f0870e2b26043d5ffe2007a34aa7bcd5480444 Mon Sep 17 00:00:00 2001 From: Maxim Mig Date: Tue, 3 Dec 2024 22:40:03 +0100 Subject: [PATCH] Change structure of project --- background.js | 4 ++-- manifests/chrome/manifest.json | 2 +- manifests/firefox/manifest.json | 2 +- popups/assets/styles.css | 8 ++++++++ popups/{clone.js => clone/assets/scripts.js} | 16 ++++------------ popups/{clone.html => clone/index.html} | 4 ++-- popups/{disabled.html => disabled/index.html} | 2 +- popups/popup.css | 8 -------- webpack.config.js | 2 +- 9 files changed, 20 insertions(+), 28 deletions(-) create mode 100644 popups/assets/styles.css rename popups/{clone.js => clone/assets/scripts.js} (87%) rename popups/{clone.html => clone/index.html} (97%) rename popups/{disabled.html => disabled/index.html} (85%) delete mode 100644 popups/popup.css diff --git a/background.js b/background.js index ccdc2e0..6802053 100644 --- a/background.js +++ b/background.js @@ -68,7 +68,7 @@ const handleMessage = (message, sender, sendResponse) => { }); const { project, https, ssh } = message; - const url = encodeURI(`popups/clone.html?project=${project}&https=${https}&ssh=${ssh}`); + const url = encodeURI(`popups/clone/index.html?project=${project}&https=${https}&ssh=${ssh}`); chrome.action.setPopup({ tabId: sender.tab.id, popup: chrome.runtime.getURL(url), @@ -81,7 +81,7 @@ const handleMessage = (message, sender, sendResponse) => { }); chrome.action.setPopup({ tabId: sender.tab.id, - popup: chrome.runtime.getURL("popups/disabled.html"), + popup: chrome.runtime.getURL("popups/disabled/index.html"), }); break; case "get-protocol": diff --git a/manifests/chrome/manifest.json b/manifests/chrome/manifest.json index 5826b76..0233ea4 100644 --- a/manifests/chrome/manifest.json +++ b/manifests/chrome/manifest.json @@ -10,7 +10,7 @@ "action": { "default_icon": "icons/icon-disabled-128.png", "default_title": "JetBrains Toolbox Extension", - "default_popup": "popups/disabled.html" + "default_popup": "popups/disabled/index.html" }, "background": { "service_worker": "jetbrains-toolbox-background.js" diff --git a/manifests/firefox/manifest.json b/manifests/firefox/manifest.json index fb18014..5a05b68 100644 --- a/manifests/firefox/manifest.json +++ b/manifests/firefox/manifest.json @@ -10,7 +10,7 @@ "action": { "default_icon": "icons/icon-disabled-128.png", "default_title": "JetBrains Toolbox Extension", - "default_popup": "popups/disabled.html" + "default_popup": "popups/disabled/index.html" }, "background": { "scripts": ["jetbrains-toolbox-background.js"] diff --git a/popups/assets/styles.css b/popups/assets/styles.css new file mode 100644 index 0000000..5de987e --- /dev/null +++ b/popups/assets/styles.css @@ -0,0 +1,8 @@ +@import url("../../styles/variables.css"); +@import url("../../styles/common.css"); + +body { + font-size: 0.75rem; + line-height: 1.334; + width: 22rem; +} diff --git a/popups/clone.js b/popups/clone/assets/scripts.js similarity index 87% rename from popups/clone.js rename to popups/clone/assets/scripts.js index 1aba30a..3911632 100644 --- a/popups/clone.js +++ b/popups/clone/assets/scripts.js @@ -40,9 +40,7 @@ const setToolActionClickHandler = (action) => { chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { const toolTag = toolAction.dataset.tag; - const protocolInput = document.querySelector( - ".js-protocol-input:checked", - ); + const protocolInput = document.querySelector(".js-protocol-input:checked"); const protocol = protocolInput.value.toLowerCase(); const cloneUrl = toolAction.dataset[protocol]; chrome.tabs.sendMessage(tabs[0].id, { @@ -63,9 +61,7 @@ const query = decodeURI(location.search) return acc; }, {}); -const inputs = document.querySelectorAll( - 'input[type="radio"][name="protocol"]', -); +const inputs = document.querySelectorAll('input[type="radio"][name="protocol"]'); inputs.forEach((input) => { input.addEventListener("change", (e) => { if (e.currentTarget.checked) { @@ -81,9 +77,7 @@ chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { chrome.runtime .sendMessage({ type: "get-protocol" }) .then((data) => { - const protocolInput = document.querySelector( - `.js-protocol-input[value="${data.protocol}"]`, - ); + const protocolInput = document.querySelector(`.js-protocol-input[value="${data.protocol}"]`); protocolInput.checked = true; }) .catch((e) => { @@ -99,9 +93,7 @@ chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { const fragment = document.createDocumentFragment(); tools.forEach((tool) => { - fragment.append( - createOpenToolAction(tool, query.project, query.https, query.ssh), - ); + fragment.append(createOpenToolAction(tool, query.project, query.https, query.ssh)); }); document.querySelector(".js-tool-action-placeholder").remove(); document.querySelector(".js-tool-actions").append(fragment); diff --git a/popups/clone.html b/popups/clone/index.html similarity index 97% rename from popups/clone.html rename to popups/clone/index.html index e395e80..4e36575 100644 --- a/popups/clone.html +++ b/popups/clone/index.html @@ -3,7 +3,7 @@ Open project in JetBrains IDEs - +