diff --git a/src/css/popup.css b/src/css/popup.css index 3ce65aa..2dc9bc9 100644 --- a/src/css/popup.css +++ b/src/css/popup.css @@ -91,7 +91,7 @@ table { } .scrollable { - border-block-start: 1px solid #f1f1f1; +/* border-block-start: 1px solid #f1f1f1;*/ inline-size: 100%; max-block-size: 400px; overflow: auto; @@ -493,24 +493,6 @@ manage things like container crud */ margin-inline-start: var(--inline-item-space-size); } -#container-panel #sort-containers-link { - align-items: center; - block-size: var(--block-url-label-size); - border: 1px solid #d8d8d8; - border-radius: var(--small-radius); - color: var(--title-text-color); - display: flex; - font-size: var(--small-text-size); - inline-size: var(--inline-button-size); - justify-content: center; - text-decoration: none; -} - -#container-panel #sort-containers-link:hover, -#container-panel #sort-containers-link:focus { - background: #f2f2f2; -} - span ~ .panel-header-text { padding-block-end: 0; padding-block-start: 0; @@ -649,7 +631,7 @@ span ~ .panel-header-text { background-image: var(--identity-icon); background-position: center center; background-repeat: no-repeat; - background-size: 20px 20px; + background-size: 16px 16px; block-size: 100%; fill: var(--identity-icon-color); filter: url('/img/filters.svg#fill'); @@ -1008,3 +990,121 @@ span ~ .panel-header-text { .amo-rate-cta { background: #0f1126; } + +body { + font-family: 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif; + color: #000000; + font-size: 13px; + letter-spacing: -0.1px; + width: 320px; + /* remove in prodcution*/ +} + +h3.title { + width: 100%; + color: #000000; + font-size: 13px; + letter-spacing: -0.1px; + font-weight: bold; + line-height: 40px; + text-align: center; + height: 40px; +} + +.menu { + width: 100%; + border-style: none; +} + +.menu-item { + height: 24px; + line-height: 24px; + width: 100%; + cursor: pointer; +} + +.menu-item:hover { + background: #1296F8; + color: #FFFFFF; +} + +.hover-highlight { + +} + +.menu-text { + line-height: 24px; +} + +.menu-icon { + float: left; + text-align: center; + width: 40px; + display: block; + height: 24px; + padding: 0 8px 0 16px; +} + +.menu-right-float { + float: right; + text-align: right; + width: 60px; + display: inline-block; + height: 24px; +} + +.container-count { + opacity: 0.6; + padding: 0 6px 0 0; + text-align: right; +} + +.menu-arrow { + float: right; + text-align: center; + width: 18px; + display: inline-block; + height: 24px; + padding: 6px 12px 6px 0; +} + +.menu-arrow img { + padding: 2 2 2 2; + height: 12px; + width: 12px; +} + +hr { + display: block; + border: 0; + border-top: 1px solid #e3e3e3; + padding: 0 0 6px 0; + margin: 6px 0 0 0; +} + +.sub-header { + height: 24px; + color: #737373; + line-height: 24px; + padding: 0 16px 0 16px; +} + +.identities-list { + margin: 0 0 41px 0; +} + +.bottom-btn { + height: 41px; + line-height: 41px; + background-color: #e3e3e3; + padding: 0 16px 0 16px; + border: solid 1px #d9d9d9; + cursor: pointer; + position: fixed; + bottom: 0px; + width: 100%; +} + +.menu-panel { + justify-content: flex-start; +} \ No newline at end of file diff --git a/src/img/arrow-icon-left.svg b/src/img/arrow-icon-left.svg new file mode 100644 index 0000000..ab0a30f --- /dev/null +++ b/src/img/arrow-icon-left.svg @@ -0,0 +1 @@ + diff --git a/src/img/arrow-icon-right.svg b/src/img/arrow-icon-right.svg new file mode 100644 index 0000000..f740140 --- /dev/null +++ b/src/img/arrow-icon-right.svg @@ -0,0 +1,21 @@ + + diff --git a/src/img/movetowindow-16.svg b/src/img/movetowindow-16.svg new file mode 100644 index 0000000..80181a3 --- /dev/null +++ b/src/img/movetowindow-16.svg @@ -0,0 +1,7 @@ + + diff --git a/src/img/open-in-new-16.svg b/src/img/open-in-new-16.svg new file mode 100644 index 0000000..c6685c4 --- /dev/null +++ b/src/img/open-in-new-16.svg @@ -0,0 +1,7 @@ + + diff --git a/src/img/open-in-stop-16.svg b/src/img/open-in-stop-16.svg new file mode 100644 index 0000000..8ba3d97 --- /dev/null +++ b/src/img/open-in-stop-16.svg @@ -0,0 +1,7 @@ + + diff --git a/src/img/password-hide.svg b/src/img/password-hide.svg new file mode 100644 index 0000000..af7818d --- /dev/null +++ b/src/img/password-hide.svg @@ -0,0 +1,9 @@ + + diff --git a/src/img/refresh-16.svg b/src/img/refresh-16.svg new file mode 100644 index 0000000..2e40ef6 --- /dev/null +++ b/src/img/refresh-16.svg @@ -0,0 +1,6 @@ + + diff --git a/src/img/sort-16_1.svg b/src/img/sort-16_1.svg new file mode 100644 index 0000000..83ae0ee --- /dev/null +++ b/src/img/sort-16_1.svg @@ -0,0 +1,6 @@ + + diff --git a/src/img/tab-new-16.svg b/src/img/tab-new-16.svg new file mode 100644 index 0000000..d8c7ba6 --- /dev/null +++ b/src/img/tab-new-16.svg @@ -0,0 +1,6 @@ + + diff --git a/src/js/popup.js b/src/js/popup.js index 1349ffa..1d4fce6 100644 --- a/src/js/popup.js +++ b/src/js/popup.js @@ -20,7 +20,11 @@ const P_ONBOARDING_5 = "onboarding5"; const P_ONBOARDING_6 = "onboarding6"; const P_ONBOARDING_7 = "onboarding7"; const P_CONTAINERS_LIST = "containersList"; -const P_CONTAINERS_EDIT = "containersEdit"; +const P_CONTAINER_PICKER = "containerPicker"; +const OPEN_NEW_CONTAINER_PICKER = "new-tab"; +const MANAGE_CONTAINERS_PICKER = "manage"; +const REOPEN_IN_CONTAINER = "reopen-in"; +const ALWAYS_OPEN_IN_PICKER = "always-open-in"; const P_CONTAINER_INFO = "containerInfo"; const P_CONTAINER_EDIT = "containerEdit"; const P_CONTAINER_DELETE = "containerDelete"; @@ -275,7 +279,7 @@ const Logic = { } }, - async showPanel(panel, currentIdentity = null) { + async showPanel(panel, currentIdentity = null, pickerType = null) { // Invalid panel... ?!? if (!(panel in this._panels)) { throw new Error("Something really bad happened. Unknown panel: " + panel); @@ -283,6 +287,7 @@ const Logic = { this._previousPanel = this._currentPanel; this._currentPanel = panel; + this.pickerType = pickerType; this._currentIdentity = currentIdentity; @@ -589,16 +594,20 @@ Logic.registerPanel(P_CONTAINERS_LIST, { // This method is called when the object is registered. async initialize() { - Logic.addEnterHandler(document.querySelector("#container-add-link"), () => { - Logic.showPanel(P_CONTAINER_EDIT, { name: Logic.generateIdentityName() }); - }); - - Logic.addEnterHandler(document.querySelector("#edit-containers-link"), (e) => { + Logic.addEnterHandler(document.querySelector("#manage-containers-link"), (e) => { if (!e.target.classList.contains("disable-edit-containers")) { - Logic.showPanel(P_CONTAINERS_EDIT); + Logic.showPanel(P_CONTAINER_PICKER, null, MANAGE_CONTAINERS_PICKER); } }); - + Logic.addEnterHandler(document.querySelector("#open-new-tab-in"), () => { + Logic.showPanel(P_CONTAINER_PICKER, null, OPEN_NEW_CONTAINER_PICKER); + }); + Logic.addEnterHandler(document.querySelector("#reopen-site-in"), () => { + Logic.showPanel(P_CONTAINER_PICKER, null, REOPEN_IN_CONTAINER); + }); + Logic.addEnterHandler(document.querySelector("#always-open-in"), () => { + Logic.showPanel(P_CONTAINER_PICKER, null, ALWAYS_OPEN_IN_PICKER); + }); Logic.addEnterHandler(document.querySelector("#sort-containers-link"), async () => { try { await browser.runtime.sendMessage({ @@ -660,123 +669,47 @@ Logic.registerPanel(P_CONTAINERS_LIST, { break; } }); - - // When the popup is open sometimes the tab will still be updating it's state - this.tabUpdateHandler = (tabId, changeInfo) => { - const propertiesToUpdate = ["title", "favIconUrl"]; - const hasChanged = Object.keys(changeInfo).find((changeInfoKey) => { - if (propertiesToUpdate.includes(changeInfoKey)) { - return true; - } - }); - if (hasChanged) { - this.prepareCurrentTabHeader(); - } - }; - browser.tabs.onUpdated.addListener(this.tabUpdateHandler); }, unregister() { - browser.tabs.onUpdated.removeListener(this.tabUpdateHandler); - }, - setupAssignmentCheckbox(siteSettings, currentUserContextId) { - const assignmentCheckboxElement = document.getElementById("container-page-assigned"); - let checked = false; - if (siteSettings && Number(siteSettings.userContextId) === currentUserContextId) { - checked = true; - } - assignmentCheckboxElement.checked = checked; - let disabled = false; - if (siteSettings === false) { - disabled = true; - } - assignmentCheckboxElement.disabled = disabled; - }, - - async prepareCurrentTabHeader() { - const currentTab = await Logic.currentTab(); - const currentTabElement = document.getElementById("current-tab"); - const assignmentCheckboxElement = document.getElementById("container-page-assigned"); - const currentTabUserContextId = Logic.userContextId(currentTab.cookieStoreId); - assignmentCheckboxElement.addEventListener("change", () => { - Logic.setOrRemoveAssignment(currentTab.id, currentTab.url, currentTabUserContextId, !assignmentCheckboxElement.checked); - }); - currentTabElement.hidden = !currentTab; - this.setupAssignmentCheckbox(false, currentTabUserContextId); - if (currentTab) { - const identity = await Logic.identity(currentTab.cookieStoreId); - const siteSettings = await Logic.getAssignment(currentTab); - this.setupAssignmentCheckbox(siteSettings, currentTabUserContextId); - const currentPage = document.getElementById("current-page"); - currentPage.innerHTML = escaped`${currentTab.title}`; - const favIconElement = Utils.createFavIconElement(currentTab.favIconUrl || ""); - currentPage.prepend(favIconElement); - - const currentContainer = document.getElementById("current-container"); - currentContainer.innerText = identity.name; - - currentContainer.setAttribute("data-identity-color", identity.color); - } }, // This method is called when the panel is shown. async prepare() { const fragment = document.createDocumentFragment(); - this.prepareCurrentTabHeader(); - Logic.identities().forEach(identity => { - const hasTabs = (identity.hasHiddenTabs || identity.hasOpenTabs); const tr = document.createElement("tr"); - const context = document.createElement("td"); - const manage = document.createElement("td"); + tr.classList.add("menu-item"); + const td = document.createElement("td"); + const openTabs = identity.numberOfOpenTabs || "" ; - tr.classList.add("container-panel-row"); - - context.classList.add("userContext-wrapper", "open-newtab", "clickable", "firstTabindex"); - manage.classList.add("show-tabs", "pop-button"); - manage.setAttribute("title", `View ${identity.name} container`); - context.setAttribute("tabindex", "0"); - context.setAttribute("title", `Create ${identity.name} tab`); - context.innerHTML = escaped` -
+ `; + fragment.appendChild(tr); - Logic.addEnterHandler(tr, e => { - if (e.target.matches(".edit-container-icon") || e.target.parentNode.matches(".edit-container-icon")) { - Logic.showPanel(P_CONTAINER_EDIT, identity); - } else if (e.target.matches(".delete-container-icon") || e.target.parentNode.matches(".delete-container-icon")) { - Logic.showPanel(P_CONTAINER_DELETE, identity); - } + tr.appendChild(td); + + Logic.addEnterHandler(tr, () => { + pickedFunction(identity); }); }); - const list = document.querySelector("#edit-identities-list"); + const list = document.querySelector("#picker-identities-list"); list.innerHTML = ""; list.appendChild(fragment); return Promise.resolve(null); - }, + } }); // P_CONTAINER_EDIT: Editor for a container. diff --git a/src/popup.html b/src/popup.html index 813a02d..dca1948 100644 --- a/src/popup.html +++ b/src/popup.html @@ -115,34 +115,79 @@ Done -