From 4a47aaae2673b20a6d1d1c3cff6f0f2bb203d848 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 2 Jul 2021 10:59:50 +0900 Subject: [PATCH 01/75] Add: Lightmode - Color darker #24 --- userChrome.css | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/userChrome.css b/userChrome.css index 547e561..a5438eb 100644 --- a/userChrome.css +++ b/userChrome.css @@ -1,4 +1,9 @@ @media (-moz-proton) { + /** Lightmode - Color darker ************************************************/ + :root[lwtheme-mozlightdark][lwthemetextcolor="dark"] { + --lwt-accent-color: rgb(229, 229, 235) !important; /* Original: rgb(240, 240, 244) */ + } + /** Darkmode - Color lighter ************************************************/ :root[lwtheme-mozlightdark][lwthemetextcolor="bright"] { --toolbar-bgcolor: rgba(43, 42, 51, 5) !important; /* Original: rgba(43, 42, 51, 1) */ From 0d3202c6f455dccd87a783ffb0233e251d2359fe Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Sun, 4 Jul 2021 17:36:18 +0900 Subject: [PATCH 02/75] Add: Fully Theme Mode - Notification --- userChrome.css | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/userChrome.css b/userChrome.css index a5438eb..9f42dc3 100644 --- a/userChrome.css +++ b/userChrome.css @@ -71,6 +71,57 @@ } } + /* Fully Theme Mode *********************************************************/ + /*= Notification ===========================================================*/ + @-moz-document url("chrome://global/content/alerts/alert.xhtml") { + #alertBox { + color: var(--menu-color) !important; + background-color: var(--menu-background-color) !important; + border-color: var(--menu-border-color) !important; + border-radius: 6px !important; + -moz-window-shadow: cliprounded !important; + } + + #alertSettings { + fill: currentColor !important; + color: inherit !important; + border-radius: 0 !important; + margin-inline: 0 !important; + margin-bottom: -4px !important; + } + #alertSettings > .button-box, + .close-icon > .toolbarbutton-icon{ + border-radius: 4px !important; + padding: 2px !important; + margin: 2px 2px -2px 0 !important; + } + #alertSettings > .button-box { + margin: -4px 4px 3px 0 !important; + } + #alertSettings > .button-box > .box-inherit > .button-icon { + padding: 1px; + } + + /* Color */ + #alertSettings, + .close-icon { + background: transparent !important + } + .close-icon:hover > .toolbarbutton-icon, + #alertSettings:is(:hover,[open]) > .button-box { + background-color: var(--menuitem-hover-background-color) !important; + } + + @media (-moz-toolbar-prefers-color-scheme:dark) { + :root { + --menu-border-color: rgba(107,107,107,.3) !important; + } + #alertSourceLabel { + color: rgb(5,209,241) !important; + } + } + } + /** Root - Reduce Padding ***************************************************/ :root { /* Tab Bar */ From 7446edd955f24ddb9684d1086a9959466e3669ae Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 5 Jul 2021 11:50:18 +0900 Subject: [PATCH 03/75] Fix: Fully Theme Mode - Notification property update --- userChrome.css | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/userChrome.css b/userChrome.css index 9f42dc3..e6d6e4f 100644 --- a/userChrome.css +++ b/userChrome.css @@ -74,14 +74,16 @@ /* Fully Theme Mode *********************************************************/ /*= Notification ===========================================================*/ @-moz-document url("chrome://global/content/alerts/alert.xhtml") { + /* line below removes background from the notification "window" on linux */ + #alertNotification{ background: transparent !important; } + #alertBox { - color: var(--menu-color) !important; - background-color: var(--menu-background-color) !important; - border-color: var(--menu-border-color) !important; + color: var(--menu-color, #15141a) !important; + background-color: var(--menu-background-color, #f9f9fb) !important; + border-color: var(--menu-border-color, #cfcfd8) !important; border-radius: 6px !important; -moz-window-shadow: cliprounded !important; } - #alertSettings { fill: currentColor !important; color: inherit !important; @@ -89,13 +91,15 @@ margin-inline: 0 !important; margin-bottom: -4px !important; } - #alertSettings > .button-box, - .close-icon > .toolbarbutton-icon{ + + /* Shape */ + .close-icon > .toolbarbutton-icon, + #alertSettings > .button-box > .box-inherit { border-radius: 4px !important; padding: 2px !important; margin: 2px 2px -2px 0 !important; } - #alertSettings > .button-box { + #alertSettings > .button-box > .box-inherit { margin: -4px 4px 3px 0 !important; } #alertSettings > .button-box > .box-inherit > .button-icon { @@ -103,19 +107,29 @@ } /* Color */ - #alertSettings, - .close-icon { + .close-icon, + #alertSettings { background: transparent !important } .close-icon:hover > .toolbarbutton-icon, - #alertSettings:is(:hover,[open]) > .button-box { - background-color: var(--menuitem-hover-background-color) !important; + #alertSettings:is(:hover,[open]) > .button-box > .box-inherit { + background-color: var(--menuitem-hover-background-color, #e0e0e6) !important; } @media (-moz-toolbar-prefers-color-scheme:dark) { :root { --menu-border-color: rgba(107,107,107,.3) !important; } + + #alertBox { + color: var(--menu-color, #fbfbfe) !important; + background-color: var(--menu-background-color, #2b2a33) !important; + } + .close-icon:hover > .toolbarbutton-icon, + #alertSettings:is(:hover, [open]) > .button-box > .box-inherit { + background-color: var(--menuitem-hover-background-color, #52525e) !important; + } + #alertSourceLabel { color: rgb(5,209,241) !important; } From 887b1eac660fc66168b4f3f5e5332f052d6bd468 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 5 Jul 2021 16:37:11 +0900 Subject: [PATCH 04/75] Add: Fully Theme Mode - Menu color --- userChrome.css | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/userChrome.css b/userChrome.css index e6d6e4f..e3f74da 100644 --- a/userChrome.css +++ b/userChrome.css @@ -72,6 +72,25 @@ } /* Fully Theme Mode *********************************************************/ + /* Default Themes + https://github.com/mozilla/gecko-dev/blob/master/toolkit/mozapps/extensions/default-theme/manifest.json + https://github.com/mozilla/gecko-dev/blob/master/browser/themes/addons/light/manifest.json + https://github.com/mozilla/gecko-dev/blob/master/browser/themes/addons/dark/manifest.json + */ + + /*== Menu color ===========================================================*/ + :root { + /* is same as toolbar color https://github.com/mozilla/gecko-dev/blob/master/toolkit/themes/windows/global/global.css#L17-L67 */ + --menu-color: var(--toolbar-color) !important; + --menu-background-color: var(--toolbar-bgcolor) !important; + + --menu-border-color: var(--toolbarbutton-active-background, var(--button-active-bgcolor)) !important; + --menuitem-hover-background-color: var(--toolbarbutton-hover-background, var(--button-hover-bgcolor)) !important; + + --menu-disabled-color: color-mix(in srgb, var(--toolbar-color) 40%, transparent) !important; + --menuitem-disabled-hover-background-color: color-mix(in srgb, var(--menuitem-hover-background-color) 40%, transparent) !important; + } + /*= Notification ===========================================================*/ @-moz-document url("chrome://global/content/alerts/alert.xhtml") { /* line below removes background from the notification "window" on linux */ From b6306a0802f4d76dad86f0481ebbf5e2d80d6b35 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 6 Jul 2021 08:59:36 +0900 Subject: [PATCH 05/75] Fix: Menupopup - Color for shadow root --- userChrome.css | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/userChrome.css b/userChrome.css index 6f7e737..c3486b4 100644 --- a/userChrome.css +++ b/userChrome.css @@ -85,7 +85,8 @@ */ /*== Menu color ===========================================================*/ - :root { + :root, + menupopup { /* is same as toolbar color https://github.com/mozilla/gecko-dev/blob/master/toolkit/themes/windows/global/global.css#L17-L67 */ --menu-color: var(--toolbar-color) !important; --menu-background-color: var(--toolbar-bgcolor) !important; From 7a67a59e1c310aa226932473ac32b6a5431d8a94 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Thu, 8 Jul 2021 12:12:43 +0900 Subject: [PATCH 06/75] Add: Info Bar - Reduce Padding --- userChrome.css | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/userChrome.css b/userChrome.css index e47f925..46aac01 100644 --- a/userChrome.css +++ b/userChrome.css @@ -323,6 +323,52 @@ margin-top: 0px; /* Original: 2px */ } + /*= Info Bar - Reduce Padding ==============================================*/ + :root:not([uidensity]) #tab-notification-deck { + --infobar-message-margin: 0 4px 3px; + } + :root[uidensity=compact] #tab-notification-deck { + --infobar-message-margin: 0 4px 2px; + } + #tab-notification-deck notification-message[message-bar-type="infobar"] { + margin: var(--infobar-message-margin, 0 4px 4px) !important; + } + + :root:not([uidensity]) notification-message[message-bar-type="infobar"] { + --infobar-vertical-margin: 7px; + --infobar-button-vertical-margin: 3px; + } + :root[uidensity=compact] notification-message[message-bar-type="infobar"] { + --infobar-vertical-margin: 6px; + --infobar-button-vertical-margin: 2px; + } + .infobar > .icon { + margin-block: var(--infobar-vertical-margin, 8px) !important; /* Original: 8px */ + } + .notification-message { + padding-block: var(--infobar-vertical-margin, 8px) !important; /* Original: 8px */ + } + .notification-button-container > .notification-button { + margin-block: var(--infobar-button-vertical-margin, 4px) !important; /* Original: 4px */ + } + .notification-close { + margin: var(--infobar-button-vertical-margin, 4px) 8px !important; /* Original: 4px 8px */ + } + + /* Hard coded for compatibility - Disappearing phenomenon */ + .container.infobar::before { + content: ""; + display: block; + width: 2px; + position: absolute; + background-image: linear-gradient(0, #9059ff 0%, #ff4aa2 52.08%, #ffbd4f 100%); + top: 0; + inset-inline-start: 0; + height: 100%; + border-start-start-radius: 4px; + border-end-start-radius: 4px; + } + /*= Menu - Reduce Padding ==================================================*/ :root { --menu-padding: 0.35em; From 43fa950090af145d5d19b2e26d882c8672f262e9 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 9 Jul 2021 10:20:05 +0900 Subject: [PATCH 07/75] Add: URL Bar - Reduce padding --- userChrome.css | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/userChrome.css b/userChrome.css index 46aac01..56c896f 100644 --- a/userChrome.css +++ b/userChrome.css @@ -311,11 +311,18 @@ } /* spread menu */ - :root[uidensity=compact] .urlbarView-row:not([type=tip], [type=dynamic]) { - padding-block: 1px; /* [Compact, General]: 2px, Touch: 11px */ + :root:not([uidensity]) .urlbarView-row { + padding-block: 1px; /* Original: 2px */ + } + :root[uidensity=compact] .urlbarView-row { + padding-block: 0px; + } + + :root:not([uidensity]) #urlbar .search-one-offs:not([hidden]) { + padding-block: 8px; /* Original: 10px */ } :root[uidensity=compact] #urlbar .search-one-offs:not([hidden]) { - padding-block: 2px; /* [Compact, General]: 4px, Touch 11px */ + padding-block: 2px; } /*= BookMark Bar - Reduce Height ===========================================*/ From 10f349b44b8f434ad4a03c9fe61aa078c93d3290 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 9 Jul 2021 12:03:31 +0900 Subject: [PATCH 08/75] Add: Installer - Proton-Style --- install.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 8651934..3614c89 100755 --- a/install.sh +++ b/install.sh @@ -439,10 +439,11 @@ select_profile() { #== Install Types ============================================================== leptonBranch="master" select_distribution() { - select distribution in "Original(default)" "Photon-Style"; do + select distribution in "Original(default)" "Photon-Style" "Proton Style"; do case "${distribution}" in "Original") leptonBranch="master" ;; "Photon-Style") leptonBranch="photon-style" ;; + "Proton-Style") leptonBranch="proton-style" ;; esac lepton_ok_message "Selected ${distribution}" break @@ -581,13 +582,13 @@ install_profile() { ## `LEPTON` file format # If this file exist in same directory as the `userChrome.css` file, # it is recognized as the "Lepton" installation directory. -# Branch=master | photon-style +# Branch=master | photon-style | proton-style # Ver= | | [NULL] ## `lepton.ini` file Format # [Profile Name] # Type=Local | Release | Git -# Branch=master | photon-style +# Branch=master | photon-style | proton-style # Ver= | | [NULL] # Path= From 6dc4faf386c3064b83743290dbeaf888bdd7cc39 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 9 Jul 2021 12:21:54 +0900 Subject: [PATCH 09/75] Fix: Installer - invalid option check --- install.sh | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/install.sh b/install.sh index 3614c89..4bdbe21 100755 --- a/install.sh +++ b/install.sh @@ -439,15 +439,17 @@ select_profile() { #== Install Types ============================================================== leptonBranch="master" select_distribution() { + local selectedDistribution="" select distribution in "Original(default)" "Photon-Style" "Proton Style"; do + selectedDistribution="${distribution}" case "${distribution}" in - "Original") leptonBranch="master" ;; - "Photon-Style") leptonBranch="photon-style" ;; - "Proton-Style") leptonBranch="proton-style" ;; + "Original") leptonBranch="master"; break;; + "Photon-Style") leptonBranch="photon-style"; break;; + "Proton-Style") leptonBranch="proton-style"; break;; + *) echo "Invalid option, reselect please.";; esac - lepton_ok_message "Selected ${distribution}" - break done + lepton_ok_message "Selected ${selectedDistribution}" } leptonInstallType="Network" # Other types: Local, Release @@ -710,6 +712,7 @@ update_profile() { local Ver=$(git --git-dir "${LEPTONINFOFILE}" describe --tags --abbrev=0) git --git-dir "${LEPTONGITPATH}" checkout "tags/${Ver}" fi + check_chrome_restore else lepton_error_message "Unable to find update type, ${Type}" fi From 0690a7a936de8fa76a8003bf4ad71fe7787d7e54 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 9 Jul 2021 16:53:09 +0900 Subject: [PATCH 10/75] Add: Dark Mode - addons.mozilla.org's first page --- userContent.css | 283 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 283 insertions(+) diff --git a/userContent.css b/userContent.css index a759b2c..e521df9 100644 --- a/userContent.css +++ b/userContent.css @@ -117,4 +117,287 @@ } } } + + /** Dark Mode Colors ********************************************************/ + :host, + :root { + --in-content-page-color: rgb(21, 20, 26); + --in-content-page-background: #fff; + --in-content-text-color: var(--in-content-page-color); + --in-content-deemphasized-text: rgb(91, 91, 102); + --in-content-box-background: #fff; + --in-content-box-background-odd: rgba(12, 12, 13, 0.05); /* grey 90 a05 */ + --in-content-box-border-color: color-mix(in srgb, currentColor 41%, transparent); + --in-content-box-info-background: #f0f0f4; + --in-content-item-hover: color-mix(in srgb, var(--in-content-primary-button-background) 20%, transparent); + --in-content-item-hover-text: var(--in-content-page-color); + --in-content-item-selected: var(--in-content-primary-button-background); + --in-content-item-selected-text: var(--in-content-primary-button-text-color); + --in-content-icon-color: rgb(91,91,102); + --in-content-accent-color: #0a84ff; + --in-content-accent-color-active: #0060df; + --in-content-border-hover: var(--grey-90-a50); + --in-content-border-invalid: var(--red-50); + --in-content-border-color: #d7d7db; + --in-content-error-text-color: #c50042; + --in-content-link-color: var(--blue-60); + --in-content-link-color-hover: var(--blue-70); + --in-content-link-color-active: var(--blue-80); + --in-content-link-color-visited: var(--blue-60); + /* button background states are also used for checkboxes and radiobuttons */ + --in-content-button-text-color: var(--in-content-text-color); + --in-content-button-text-color-hover: var(--in-content-text-color); + --in-content-button-background: rgba(207,207,216,.33); + --in-content-button-background-hover: rgba(207,207,216,.66); + --in-content-button-background-active: rgb(207,207,216); + --in-content-primary-button-text-color: rgb(251,251,254); + --in-content-primary-button-text-color-hover: var(--in-content-primary-button-text-color); + --in-content-primary-button-background: #0061e0; + --in-content-primary-button-background-hover: #0250bb; + --in-content-primary-button-background-active: #053e94; + --in-content-danger-button-background: #e22850; + --in-content-danger-button-background-hover: #c50042; + --in-content-danger-button-background-active: #810220; + --in-content-focus-outline-color: var(--in-content-primary-button-background); + + /* Note: 1px smaller than we want because we have a 1px transparent border. */ + /* Once proton ships, these can probably stop being variables. */ + --in-content-button-border-radius: 4px; + --in-content-button-horizontal-padding: 15px; + --in-content-button-vertical-padding: 7px; + + --in-content-table-background: #f8f8fa; + --in-content-table-border-dark-color: #d1d1d1; + --in-content-table-header-background: #0a84ff; + --in-content-table-header-color: #ffffff; + --in-content-sidebar-width: 240px; + + --dialog-warning-text-color: var(--red-60); + + --checkbox-border-color: var(--in-content-box-border-color); + --checkbox-unchecked-bgcolor: var(--in-content-button-background); + --checkbox-unchecked-hover-bgcolor: var(--in-content-button-background-hover); + --checkbox-unchecked-active-bgcolor: var(--in-content-button-background-active); + --checkbox-checked-bgcolor: var(--in-content-primary-button-background); + --checkbox-checked-color: var(--in-content-primary-button-text-color); + --checkbox-checked-border-color: transparent; + --checkbox-checked-hover-bgcolor: var(--in-content-primary-button-background-hover); + --checkbox-checked-active-bgcolor: var(--in-content-primary-button-background-active); + + --blue-40: #45a1ff; + --blue-50: #0a84ff; + --blue-60: #0060df; + --blue-70: #003eaa; + --blue-80: #002275; + --grey-30: #d7d7db; + --grey-60: #4a4a4f; + --grey-90-a10: rgba(12, 12, 13, 0.1); + --grey-90-a20: rgba(12, 12, 13, 0.2); + --grey-90-a30: rgba(12, 12, 13, 0.3); + --grey-90-a50: rgba(12, 12, 13, 0.5); + --grey-90-a60: rgba(12, 12, 13, 0.6); + --green-50: #30e60b; + --green-60: #12bc00; + --green-70: #058b00; + --green-80: #006504; + --green-90: #003706; + --orange-50: #ff9400; + --red-40: #ff4f5e; + --red-50: #ff0039; + --red-60: #d70022; + --red-70: #a4000f; + --red-80: #5a0002; + --red-90: #3e0200; + --yellow-50: #ffe900; + --yellow-60: #d7b600; + --yellow-60-a30: rgba(215, 182, 0, 0.3); + --yellow-70: #a47f00; + --yellow-80: #715100; + --yellow-90: #3e2800; + + --shadow-10: 0 1px 4px var(--grey-90-a10); + --shadow-30: 0 4px 16px var(--grey-90-a10); + + --card-padding: 16px; + --card-shadow: var(--shadow-10); + --card-outline-color: var(--grey-30); + --card-shadow-hover: var(--card-shadow), 0 0 0 5px var(--card-outline-color); + } + + @media (-moz-toolbar-prefers-color-scheme: dark) { + :host, + :root { + /* Keep these in sync with layout/base/PresShell.cpp, and plaintext.css */ + --in-content-page-background: rgb(28,27,34); + --in-content-page-color: rgb(251,251,254); + --in-content-deemphasized-text: rgb(191,191,201); + + --in-content-box-background: rgb(35, 34, 43); + --in-content-box-background-odd: rgba(249,249,250,0.05); + --in-content-box-info-background: rgba(249,249,250,0.15); + + --in-content-border-color: rgba(249,249,250,0.2); + --in-content-border-hover: rgba(249,249,250,0.3); + --in-content-border-invalid: rgb(255,132,139); + + --in-content-error-text-color: #FF9AA2; + + --in-content-button-background: rgb(43,42,51); + --in-content-button-background-hover: rgb(82,82,94); + --in-content-button-background-active: rgb(91,91,102); + --in-content-icon-color: rgb(251,251,254); + + --in-content-primary-button-text-color: rgb(43,42,51); + --in-content-primary-button-background: rgb(0,221,255); + --in-content-primary-button-background-hover: rgb(128,235,255); + --in-content-primary-button-background-active: rgb(170,242,255); + + --in-content-danger-button-background: #ff848b; + --in-content-danger-button-background-hover: #ffbdc5; + --in-content-danger-button-background-active: #ffdfe7; + + --in-content-table-background: rgb(35, 34, 43); + --in-content-table-border-dark-color: rgba(249,249,250,0.2); + --in-content-table-header-background: rgb(5, 64, 150); + --in-content-table-header-color: var(--in-content-page-color); + + --in-content-accent-color: var(--in-content-primary-button-background); + --in-content-accent-color-active: var(--in-content-primary-button-background-hover); + --in-content-link-color: var(--in-content-primary-button-background); + --in-content-link-color-hover: var(--in-content-primary-button-background-hover); + --in-content-link-color-active: var(--in-content-primary-button-background-active); + --in-content-link-color-visited: var(--in-content-link-color); + + --card-outline-color: var(--grey-60); + + --dialog-warning-text-color: var(--red-40); + + scrollbar-color: rgba(249,249,250,.4) rgba(20,20,25,.3); + } + + /* For dialogs, use a different background colour. We don't do + * this in High Contrast mode, as we should be using system colours then. + */ + @media not (prefers-contrast) { + :root[dialogroot], + /* Also need this on dialog :hosts, or the rule above will override the + * value for this custom property again in the shadow DOM. */ + :host(dialog) { + --in-content-page-background: #42414d; + } + } + } + + @media (prefers-contrast) { + :host, + :root { + --in-content-page-color: WindowText; + --in-content-page-background: Window; + --in-content-deemphasized-text: GrayText; + + --in-content-box-background: -moz-Dialog; + --in-content-box-background-odd: -moz-Dialog; + --in-content-box-border-color: ThreeDShadow; + --in-content-box-info-background: -moz-Dialog; + + --in-content-item-hover: Highlight; + --in-content-item-hover-text: HighlightText; + --in-content-item-selected: Highlight; + --in-content-item-selected-text: HighlightText; + --in-content-icon-color: -moz-DialogText; + + --in-content-accent-color: -moz-DialogText; + --in-content-accent-color-active: -moz-DialogText; + + --in-content-border-hover: ThreeDShadow; + /* This is not great, but there is no suitable keyword for this. + * In theory, we shouldn't be conveying invalid state just with a colour + * change... */ + --in-content-border-invalid: ThreeDShadow; + --in-content-border-color: ThreeDShadow; + + --in-content-link-color: -moz-nativehyperlinktext; + --in-content-link-color-hover: -moz-nativehyperlinktext; + --in-content-link-color-active: -moz-nativehyperlinktext; + --in-content-link-color-visited: -moz-nativehyperlinktext; + + --in-content-button-text-color-hover: HighlightText; + --in-content-button-background: ButtonFace; + --in-content-button-text-color: ButtonText; + --in-content-button-background-hover: Highlight; + --in-content-button-background-active: Highlight; + + --in-content-primary-button-text-color: HighlightText; + --in-content-primary-button-text-color-hover: ButtonText; + --in-content-primary-button-background: Highlight; + --in-content-primary-button-background-hover: ButtonFace; + --in-content-primary-button-background-active: ButtonFace; + + --in-content-danger-button-background: var(--in-content-primary-button-background); + --in-content-danger-button-background-hover: var(--in-content-primary-button-background-hover); + --in-content-danger-button-background-active: var(--in-content-primary-button-background-active); + + --in-content-table-border-dark-color: ThreeDDarkShadow; + --in-content-table-background: -moz-Dialog; + --in-content-table-header-background: -moz-Dialog; + --in-content-table-header-color: -moz-DialogText; + + --dialog-warning-text-color: -moz-FieldText; + + --checkbox-border-color: ThreeDShadow; + --checkbox-unchecked-bgcolor: -moz-Field; + --checkbox-unchecked-hover-bgcolor: -moz-Field; + --checkbox-unchecked-active-bgcolor: -moz-Field; + --checkbox-checked-bgcolor: Highlight; + --checkbox-checked-color: HighlightText; + --checkbox-checked-border-color: Highlight; + --checkbox-checked-border-color-hover: Highlight; + --checkbox-checked-hover-bgcolor: -moz-Field; + --checkbox-checked-active-bgcolor: -moz-Field; + + } + + @-moz-document url-prefix("https://addons.mozilla.org") { + .Page-content, + .SecondaryHero { + color: var(--in-content-page-color) !important; + background: var(--in-content-page-background) !important; + } + + .Page-content h1, + .Page-content h2, + .SearchResult-link, + .Home-SubjectShelf-link:link, + .Home-SubjectShelf-link:visited{ + color: var(--in-content-text-color)!important + } + .SecondaryHero-module, + .Card-header, + .Card-contents, + .CardList ul > li, + .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:focus, .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:hover{ + background: var(--in-content-table-background) !important; + } + + .SecondaryHero-module-icon { + -moz-context-properties: fill, fill-opacity !important; + fill: currentColor !important; + } + + .SecondaryHero-message-link, + .SecondaryHero-module-link, + .Card-footer-link a, + .SearchResult-link:focus, + .SearchResult-link:hover, + .SearchResult:hover .SearchResult-link, + .Home-SubjectShelf-link:active, + .Home-SubjectShelf-link:focus, + .Home-SubjectShelf-link:hover { + color: var(--in-content-link-color) !important; + } + .SearchResult--meta-section { + color: var(--in-content-deemphasized-text) !important; + } + } + } } From 96cae6f4c721cbdaff8938d0a5dde12b835eefd6 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Sat, 10 Jul 2021 12:07:46 +0900 Subject: [PATCH 11/75] Fix: Menu - Background color fallback --- userChrome.css | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/userChrome.css b/userChrome.css index 50b925f..9a1f6b7 100644 --- a/userChrome.css +++ b/userChrome.css @@ -98,6 +98,12 @@ --menuitem-disabled-hover-background-color: color-mix(in srgb, var(--menuitem-hover-background-color) 40%, transparent) !important; } + /* Fallback background */ + menupopup { + background-color: var(--lwt-accent-color) !important; + } + + /* Fully Dark Mode **********************************************************/ /*= Notification ===========================================================*/ @-moz-document url("chrome://global/content/alerts/alert.xhtml") { /* line below removes background from the notification "window" on linux */ From 78a013df560c3f9d68f1181d4ad6aefaa4a2407d Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 12 Jul 2021 09:13:48 +0900 Subject: [PATCH 12/75] Fix: Fully DarkMode - Addons.org change order --- userContent.css | 77 ++++++++++++++++++++++++------------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/userContent.css b/userContent.css index e521df9..9360256 100644 --- a/userContent.css +++ b/userContent.css @@ -356,48 +356,47 @@ --checkbox-checked-active-bgcolor: -moz-Field; } + } + @-moz-document url-prefix("https://addons.mozilla.org") { + .Page-content, + .SecondaryHero { + color: var(--in-content-page-color) !important; + background: var(--in-content-page-background) !important; + } - @-moz-document url-prefix("https://addons.mozilla.org") { - .Page-content, - .SecondaryHero { - color: var(--in-content-page-color) !important; - background: var(--in-content-page-background) !important; - } + .Page-content h1, + .Page-content h2, + .SearchResult-link, + .Home-SubjectShelf-link:link, + .Home-SubjectShelf-link:visited{ + color: var(--in-content-text-color)!important + } + .SecondaryHero-module, + .Card-header, + .Card-contents, + .CardList ul > li, + .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:focus, .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:hover{ + background: var(--in-content-table-background) !important; + } - .Page-content h1, - .Page-content h2, - .SearchResult-link, - .Home-SubjectShelf-link:link, - .Home-SubjectShelf-link:visited{ - color: var(--in-content-text-color)!important - } - .SecondaryHero-module, - .Card-header, - .Card-contents, - .CardList ul > li, - .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:focus, .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:hover{ - background: var(--in-content-table-background) !important; - } + .SecondaryHero-module-icon { + -moz-context-properties: fill, fill-opacity !important; + fill: currentColor !important; + } - .SecondaryHero-module-icon { - -moz-context-properties: fill, fill-opacity !important; - fill: currentColor !important; - } - - .SecondaryHero-message-link, - .SecondaryHero-module-link, - .Card-footer-link a, - .SearchResult-link:focus, - .SearchResult-link:hover, - .SearchResult:hover .SearchResult-link, - .Home-SubjectShelf-link:active, - .Home-SubjectShelf-link:focus, - .Home-SubjectShelf-link:hover { - color: var(--in-content-link-color) !important; - } - .SearchResult--meta-section { - color: var(--in-content-deemphasized-text) !important; - } + .SecondaryHero-message-link, + .SecondaryHero-module-link, + .Card-footer-link a, + .SearchResult-link:focus, + .SearchResult-link:hover, + .SearchResult:hover .SearchResult-link, + .Home-SubjectShelf-link:active, + .Home-SubjectShelf-link:focus, + .Home-SubjectShelf-link:hover { + color: var(--in-content-link-color) !important; + } + .SearchResult--meta-section { + color: var(--in-content-deemphasized-text) !important; } } } From ba00e7e87930e7471eb1cb9d5d1d08e2c1528751 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 12 Jul 2021 09:18:10 +0900 Subject: [PATCH 13/75] Fix: Fully Dark Mode - only works prefer dark --- userContent.css | 165 +++++++++++++----------------------------------- 1 file changed, 43 insertions(+), 122 deletions(-) diff --git a/userContent.css b/userContent.css index 9360256..9a71ca3 100644 --- a/userContent.css +++ b/userContent.css @@ -118,7 +118,8 @@ } } - /** Dark Mode Colors ********************************************************/ + /** Fully Dark Mode *********************************************************/ + /*= Fully Dark Mode - Dark Mode Colors =====================================*/ :host, :root { --in-content-page-color: rgb(21, 20, 26); @@ -275,128 +276,48 @@ scrollbar-color: rgba(249,249,250,.4) rgba(20,20,25,.3); } - /* For dialogs, use a different background colour. We don't do - * this in High Contrast mode, as we should be using system colours then. - */ - @media not (prefers-contrast) { - :root[dialogroot], - /* Also need this on dialog :hosts, or the rule above will override the - * value for this custom property again in the shadow DOM. */ - :host(dialog) { - --in-content-page-background: #42414d; + /*= Fully Dark Mode - Addons.org ===========================================*/ + @-moz-document url-prefix("https://addons.mozilla.org") { + .Page-content, + .SecondaryHero { + color: var(--in-content-page-color) !important; + background: var(--in-content-page-background) !important; + } + + .Page-content h1, + .Page-content h2, + .SearchResult-link, + .Home-SubjectShelf-link:link, + .Home-SubjectShelf-link:visited{ + color: var(--in-content-text-color)!important + } + .SecondaryHero-module, + .Card-header, + .Card-contents, + .CardList ul > li, + .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:focus, .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:hover{ + background: var(--in-content-table-background) !important; + } + + .SecondaryHero-module-icon { + -moz-context-properties: fill, fill-opacity !important; + fill: currentColor !important; + } + + .SecondaryHero-message-link, + .SecondaryHero-module-link, + .Card-footer-link a, + .SearchResult-link:focus, + .SearchResult-link:hover, + .SearchResult:hover .SearchResult-link, + .Home-SubjectShelf-link:active, + .Home-SubjectShelf-link:focus, + .Home-SubjectShelf-link:hover { + color: var(--in-content-link-color) !important; + } + .SearchResult--meta-section { + color: var(--in-content-deemphasized-text) !important; } } } - - @media (prefers-contrast) { - :host, - :root { - --in-content-page-color: WindowText; - --in-content-page-background: Window; - --in-content-deemphasized-text: GrayText; - - --in-content-box-background: -moz-Dialog; - --in-content-box-background-odd: -moz-Dialog; - --in-content-box-border-color: ThreeDShadow; - --in-content-box-info-background: -moz-Dialog; - - --in-content-item-hover: Highlight; - --in-content-item-hover-text: HighlightText; - --in-content-item-selected: Highlight; - --in-content-item-selected-text: HighlightText; - --in-content-icon-color: -moz-DialogText; - - --in-content-accent-color: -moz-DialogText; - --in-content-accent-color-active: -moz-DialogText; - - --in-content-border-hover: ThreeDShadow; - /* This is not great, but there is no suitable keyword for this. - * In theory, we shouldn't be conveying invalid state just with a colour - * change... */ - --in-content-border-invalid: ThreeDShadow; - --in-content-border-color: ThreeDShadow; - - --in-content-link-color: -moz-nativehyperlinktext; - --in-content-link-color-hover: -moz-nativehyperlinktext; - --in-content-link-color-active: -moz-nativehyperlinktext; - --in-content-link-color-visited: -moz-nativehyperlinktext; - - --in-content-button-text-color-hover: HighlightText; - --in-content-button-background: ButtonFace; - --in-content-button-text-color: ButtonText; - --in-content-button-background-hover: Highlight; - --in-content-button-background-active: Highlight; - - --in-content-primary-button-text-color: HighlightText; - --in-content-primary-button-text-color-hover: ButtonText; - --in-content-primary-button-background: Highlight; - --in-content-primary-button-background-hover: ButtonFace; - --in-content-primary-button-background-active: ButtonFace; - - --in-content-danger-button-background: var(--in-content-primary-button-background); - --in-content-danger-button-background-hover: var(--in-content-primary-button-background-hover); - --in-content-danger-button-background-active: var(--in-content-primary-button-background-active); - - --in-content-table-border-dark-color: ThreeDDarkShadow; - --in-content-table-background: -moz-Dialog; - --in-content-table-header-background: -moz-Dialog; - --in-content-table-header-color: -moz-DialogText; - - --dialog-warning-text-color: -moz-FieldText; - - --checkbox-border-color: ThreeDShadow; - --checkbox-unchecked-bgcolor: -moz-Field; - --checkbox-unchecked-hover-bgcolor: -moz-Field; - --checkbox-unchecked-active-bgcolor: -moz-Field; - --checkbox-checked-bgcolor: Highlight; - --checkbox-checked-color: HighlightText; - --checkbox-checked-border-color: Highlight; - --checkbox-checked-border-color-hover: Highlight; - --checkbox-checked-hover-bgcolor: -moz-Field; - --checkbox-checked-active-bgcolor: -moz-Field; - - } - } - @-moz-document url-prefix("https://addons.mozilla.org") { - .Page-content, - .SecondaryHero { - color: var(--in-content-page-color) !important; - background: var(--in-content-page-background) !important; - } - - .Page-content h1, - .Page-content h2, - .SearchResult-link, - .Home-SubjectShelf-link:link, - .Home-SubjectShelf-link:visited{ - color: var(--in-content-text-color)!important - } - .SecondaryHero-module, - .Card-header, - .Card-contents, - .CardList ul > li, - .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:focus, .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:hover{ - background: var(--in-content-table-background) !important; - } - - .SecondaryHero-module-icon { - -moz-context-properties: fill, fill-opacity !important; - fill: currentColor !important; - } - - .SecondaryHero-message-link, - .SecondaryHero-module-link, - .Card-footer-link a, - .SearchResult-link:focus, - .SearchResult-link:hover, - .SearchResult:hover .SearchResult-link, - .Home-SubjectShelf-link:active, - .Home-SubjectShelf-link:focus, - .Home-SubjectShelf-link:hover { - color: var(--in-content-link-color) !important; - } - .SearchResult--meta-section { - color: var(--in-content-deemphasized-text) !important; - } - } } From 132fad8e6ef24e71bfcd8ab650cc2cbac97a9182 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 12 Jul 2021 11:48:59 +0900 Subject: [PATCH 14/75] Add: Fully Dark Mode - Addon.org more pages --- userContent.css | 82 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 74 insertions(+), 8 deletions(-) diff --git a/userContent.css b/userContent.css index 9a71ca3..e2f261e 100644 --- a/userContent.css +++ b/userContent.css @@ -288,17 +288,34 @@ .Page-content h2, .SearchResult-link, .Home-SubjectShelf-link:link, - .Home-SubjectShelf-link:visited{ + .Home-SubjectShelf-link:visited, + .DropdownMenuItem-link a, + .Select, + .Button--neutral { color: var(--in-content-text-color)!important } .SecondaryHero-module, .Card-header, .Card-contents, .CardList ul > li, - .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:focus, .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:hover{ + .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:is(:focus, :hover), + .LandingPage-header, + .DropdownMenu-items, + .DropdownMenu-items::after, + .MetadataCard, + .AddonsCard-list, + .Card-footer { background: var(--in-content-table-background) !important; } + .DropdownMenu-items { + box-shadow: 0 0 2px var(--in-content-border-color) !important; + } + .Select, + .Button--neutral, .Button--neutral:link { + background-color: var(--in-content-button-background) !important; + } + .SecondaryHero-module-icon { -moz-context-properties: fill, fill-opacity !important; fill: currentColor !important; @@ -307,17 +324,66 @@ .SecondaryHero-message-link, .SecondaryHero-module-link, .Card-footer-link a, - .SearchResult-link:focus, - .SearchResult-link:hover, + .SearchResult-link:is(:active, :focus, :hover), .SearchResult:hover .SearchResult-link, - .Home-SubjectShelf-link:active, - .Home-SubjectShelf-link:focus, - .Home-SubjectShelf-link:hover { + .Home-SubjectShelf-link:is(:active, :focus, :hover), + .DropdownMenuItem-link a:is(:active, :focus, :hover), + .AddonMeta .MetadataCard-title a:is(:active, :hover), + .AddonMeta .MetadataCard-title a.AddonMeta-reviews-content-link:is(:active, :hover), + .AddonMeta .MetadataCard-content a:is(:active, :hover), + .AddonMeta .MetadataCard-content a.AddonMeta-reviews-content-link:is(:active, :hover), + .RatingsByStar-count a:hover, + .RatingsByStar-star a:hover, + .AddonTitle-author a, + .PermissionsCard-learn-more, + .DefinitionList a, + .ShowMoreCard-contents a, + .AddonDescription-contents a { color: var(--in-content-link-color) !important; } - .SearchResult--meta-section { + .SearchResult--meta-section, + .MetadataCard-title, + .MetadataCard-title a, + .MetadataCard-content a, + .CollectionSort-label, + .SearchResult-summary, + .AddonMeta .MetadataCard-content a.AddonMeta-reviews-content-link, + .AddonMeta .MetadataCard-title a.AddonMeta-reviews-content-link, + .PermissionsCard-subhead--optional, + .PermissionsCard-subhead--required, + .Definition-dt, + .RatingsByStar-count a, + .RatingsByStar-star a { color: var(--in-content-deemphasized-text) !important; } + .PromotedBadge-label--recommended { + color: color-mix(in srgb, #712b00 15%, #ff9400) !important; + } + + .Button--action { + color: var(--in-content-primary-button-text-color) !important; + background: var(--in-content-primary-button-background) !important; + } + .Button--action.Button--micro:not(.Button--disabled):hover, + .Button--action:not(.Button--disabled):hover { + background: var(--in-content-primary-button-background-hover) !important; + } + .Button--neutral { + } + .Button--neutral.Button--micro:not(.Button--disabled):hover, + .Button--neutral:not(.Button--disabled):hover { + background: var(--in-content-button-background-hover) !important; + } + + .ShowMoreCard-contents::after { + background: linear-gradient(hsla(0,0%,100%,0), var(--in-content-table-background)) !important; + } + .Icon-heart { + filter: brightness(0) !important;; + } + .Permission .Icon { + filter: grayscale(100%) brightness(30) !important;; + } } } } From 235d30d81ec27c3c299b480a64ed75ee765a4019 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 12 Jul 2021 11:54:30 +0900 Subject: [PATCH 15/75] Clean: Addon.org order --- userContent.css | 67 +++++++++++++++++++++++++------------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/userContent.css b/userContent.css index e2f261e..5a71493 100644 --- a/userContent.css +++ b/userContent.css @@ -278,12 +278,14 @@ /*= Fully Dark Mode - Addons.org ===========================================*/ @-moz-document url-prefix("https://addons.mozilla.org") { + /* Basic */ .Page-content, .SecondaryHero { color: var(--in-content-page-color) !important; background: var(--in-content-page-background) !important; } + /* Text */ .Page-content h1, .Page-content h2, .SearchResult-link, @@ -294,33 +296,6 @@ .Button--neutral { color: var(--in-content-text-color)!important } - .SecondaryHero-module, - .Card-header, - .Card-contents, - .CardList ul > li, - .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:is(:focus, :hover), - .LandingPage-header, - .DropdownMenu-items, - .DropdownMenu-items::after, - .MetadataCard, - .AddonsCard-list, - .Card-footer { - background: var(--in-content-table-background) !important; - } - - .DropdownMenu-items { - box-shadow: 0 0 2px var(--in-content-border-color) !important; - } - .Select, - .Button--neutral, .Button--neutral:link { - background-color: var(--in-content-button-background) !important; - } - - .SecondaryHero-module-icon { - -moz-context-properties: fill, fill-opacity !important; - fill: currentColor !important; - } - .SecondaryHero-message-link, .SecondaryHero-module-link, .Card-footer-link a, @@ -360,30 +335,56 @@ color: color-mix(in srgb, #712b00 15%, #ff9400) !important; } + /* Background */ .Button--action { color: var(--in-content-primary-button-text-color) !important; background: var(--in-content-primary-button-background) !important; } - .Button--action.Button--micro:not(.Button--disabled):hover, - .Button--action:not(.Button--disabled):hover { - background: var(--in-content-primary-button-background-hover) !important; - } - .Button--neutral { + .Select, + .Button--neutral, .Button--neutral:link { + background-color: var(--in-content-button-background) !important; } .Button--neutral.Button--micro:not(.Button--disabled):hover, .Button--neutral:not(.Button--disabled):hover { background: var(--in-content-button-background-hover) !important; } - + .Button--action.Button--micro:not(.Button--disabled):hover, + .Button--action:not(.Button--disabled):hover { + background: var(--in-content-primary-button-background-hover) !important; + } .ShowMoreCard-contents::after { background: linear-gradient(hsla(0,0%,100%,0), var(--in-content-table-background)) !important; } + .SecondaryHero-module, + .Card-header, + .Card-contents, + .CardList ul > li, + .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:is(:focus, :hover), + .LandingPage-header, + .DropdownMenu-items, + .DropdownMenu-items::after, + .MetadataCard, + .AddonsCard-list, + .Card-footer { + background: var(--in-content-table-background) !important; + } + + /* Fill */ + .SecondaryHero-module-icon { + -moz-context-properties: fill, fill-opacity !important; + fill: currentColor !important; + } .Icon-heart { filter: brightness(0) !important;; } .Permission .Icon { filter: grayscale(100%) brightness(30) !important;; } + + /* Others */ + .DropdownMenu-items { + box-shadow: 0 0 2px var(--in-content-border-color) !important; + } } } } From 3d310fd1b66e333507e52d68e54ceec9c46b6f47 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 12 Jul 2021 15:25:25 +0900 Subject: [PATCH 16/75] Fix: Fully Dark Mode - Addons.org complete --- userContent.css | 66 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 6 deletions(-) diff --git a/userContent.css b/userContent.css index 5a71493..74eda4f 100644 --- a/userContent.css +++ b/userContent.css @@ -280,12 +280,15 @@ @-moz-document url-prefix("https://addons.mozilla.org") { /* Basic */ .Page-content, - .SecondaryHero { + .SecondaryHero, + main[aria-label="Content"] { color: var(--in-content-page-color) !important; background: var(--in-content-page-background) !important; } /* Text */ + .AutoSearchInput-query, + .AutoSearchInput-suggestions-list, .Page-content h1, .Page-content h2, .SearchResult-link, @@ -293,9 +296,12 @@ .Home-SubjectShelf-link:visited, .DropdownMenuItem-link a, .Select, - .Button--neutral { - color: var(--in-content-text-color)!important + .Button--neutral, + .blog-entry-title, + .blogpost-nav * { + color: var(--in-content-text-color)!important; } + .AutoSearchInput-suggestions-item:is(:active, :focus, :hover), .SecondaryHero-message-link, .SecondaryHero-module-link, .Card-footer-link a, @@ -313,7 +319,15 @@ .PermissionsCard-learn-more, .DefinitionList a, .ShowMoreCard-contents a, - .AddonDescription-contents a { + .AddonDescription-contents a, + .AddonTitle a, + .TooltipMenu-opener, + .LanguageTools .Card-contents a, + .blog-entry-read-more-link, + .blogpost-nav-next.blogpost-nav-no-prev:hover p, + .blogpost-content-wrapper p a, + .blogpost-nav-prev:hover p, + .blogpost-nav-next:hover p { color: var(--in-content-link-color) !important; } .SearchResult--meta-section, @@ -328,7 +342,13 @@ .PermissionsCard-subhead--required, .Definition-dt, .RatingsByStar-count a, - .RatingsByStar-star a { + .RatingsByStar-star a, + .AddonSummaryCard-addonAverage, + .AddonReviewCard-authorByLine, + .Home-heroHeader-subtitle, + .blog-entry-date, + .blogpost-breadcrumb *, + .AddonTitle-author { color: var(--in-content-deemphasized-text) !important; } .PromotedBadge-label--recommended { @@ -355,6 +375,8 @@ .ShowMoreCard-contents::after { background: linear-gradient(hsla(0,0%,100%,0), var(--in-content-table-background)) !important; } + .AutoSearchInput-query, + .AutoSearchInput-suggestions-list, .SecondaryHero-module, .Card-header, .Card-contents, @@ -365,15 +387,31 @@ .DropdownMenu-items::after, .MetadataCard, .AddonsCard-list, - .Card-footer { + .Card-footer, + .StaticAddonCard, + .blogpost-nav * { background: var(--in-content-table-background) !important; } + .LanguageTools-header-row { + color: var(--in-content-table-header-color) !important; + background: var(--in-content-table-header-background) !important; + } + .LanguageTools-table.responsiveTable tbody tr:nth-child(2n) { + background-color: var(--in-content-box-background-odd) !important;; + } + /* Fill */ + .Icon-arrow-blue.SearchSuggestion-icon-arrow { + filter: hue-rotate(330deg) brightness(1.3) !important; + } .SecondaryHero-module-icon { -moz-context-properties: fill, fill-opacity !important; fill: currentColor !important; } + .Icon-magnifying-glass { + filter: invert(65%) !important; + } .Icon-heart { filter: brightness(0) !important;; } @@ -385,6 +423,22 @@ .DropdownMenu-items { box-shadow: 0 0 2px var(--in-content-border-color) !important; } + + .AutoSearchInput-query { + border: 1px solid var(--in-content-table-background) !important; + } + .AutoSearchInput-query:is(:hover, :focus) { + border-color: var(--in-content-primary-button-background) !important; + } + + .blog-entry-read-more-link { + border-color: var(--in-content-link-color) !important; + } + + .blogpost-nav-arrow-left .cls-1, + .blogpost-nav-arrow-right .cls-1 { + stroke: var(--in-content-text-color) !important; + } } } } From c9af167fbfde31025d8ffeb370cc2749f60858a1 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 12 Jul 2021 16:32:35 +0900 Subject: [PATCH 17/75] Add: Fully Dark Mode - about:plugins --- userContent.css | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/userContent.css b/userContent.css index 9d2bb80..b43f334 100644 --- a/userContent.css +++ b/userContent.css @@ -276,6 +276,29 @@ scrollbar-color: rgba(249,249,250,.4) rgba(20,20,25,.3); } + /*= Fully Dark Mode - about:plugins ========================================*/ + @-moz-document url-prefix("about:plugins") { + :root, + body { + background-color: var(--in-content-page-background) !important; + color: var(--in-content-page-color) !important; + } + + body { + font-size: 15px !important; + font-weight: normal !important; + margin: 0 !important; + } + + .notice { + background: var(--in-content-box-background) !important; + border: 1px solid var(--in-content-border-color) !important; + } + .notice a { + color: var(--in-content-link-color) !important; + } + } + /*= Fully Dark Mode - Addons.org ===========================================*/ @-moz-document url-prefix("https://addons.mozilla.org") { /* Basic */ From 5b189167711e3c8d3961a17670d2344587f6a31c Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 12 Jul 2021 17:07:35 +0900 Subject: [PATCH 18/75] Add: Fully Dark Mode - about:cache --- userContent.css | 44 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/userContent.css b/userContent.css index b43f334..21be914 100644 --- a/userContent.css +++ b/userContent.css @@ -276,8 +276,9 @@ scrollbar-color: rgba(249,249,250,.4) rgba(20,20,25,.3); } - /*= Fully Dark Mode - about:plugins ========================================*/ - @-moz-document url-prefix("about:plugins") { + /*= Fully Dark Mode - abouts' common =======================================*/ + @-moz-document url-prefix("about:plugins"), + url-prefix("about:cache") { :root, body { background-color: var(--in-content-page-background) !important; @@ -290,12 +291,47 @@ margin: 0 !important; } + h1 { + line-height: 1.2 !important; + } + h2 { + line-height: 1.4em !important; + } + + a { + color: var(--in-content-link-color) !important; + } + + table { + width: 100% !important; + border: 1px solid var(--in-content-border-color) !important; + border-radius: 0 !important; + } + } + + /*= Fully Dark Mode - about:plugins ========================================*/ + @-moz-document url-prefix("about:plugins") { .notice { background: var(--in-content-box-background) !important; border: 1px solid var(--in-content-border-color) !important; } - .notice a { - color: var(--in-content-link-color) !important; + } + + /*= Fully Dark Mode - about:cache ==========================================*/ + @-moz-document url-prefix("about:cache") { + table { + padding: 0 !important; + } + + th, td { + border: 1px solid var(--in-content-border-color); + padding: 4px; + text-align: match-parent; + } + + th { + background-color: var(--in-content-table-header-background) !important; + color: var(--in-content-table-header-color) !important; } } From 0aedbf248dc48beac8977dc676f5c880c5ac7d27 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 14:45:59 +1200 Subject: [PATCH 19/75] feat(installer-pwsh): create boilerplate powershell install file --- Install.ps1 | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 Install.ps1 diff --git a/Install.ps1 b/Install.ps1 new file mode 100644 index 0000000..f9d5974 --- /dev/null +++ b/Install.ps1 @@ -0,0 +1,75 @@ +<# + +.SYNOPSIS +Installer for Lepton + +.DESCRIPTION +Installs Lepton onto selected Firefox profiles + +.INPUTS +TODO: input directories for installation? +Would need to discuss a non-interactive install system + +.OUTPUTS +TODO: output directories that Lepton has been installed to? + +.PARAMETER u +Specifies whether to update a current installation +Defaults to false + +.PARAMETER f +Specifies a custom path to look for Firefox profiles in + +.PARAMETER p +Specifies a custom name to use when creating a profile + +.PARAMETER h +Shows this help message + +.PARAMETER ? +Shows this help message + +.PARAMETER WhatIf +Runs the installer without actioning any file copies/moves +Equivelant to a dry-run + +.EXAMPLE +PS> .\Install.ps1 -u -f C:\Users\someone\ff-profiles +Updates current installations in the profile directory 'C:\Users\someone\ff-profiles' + +.LINK +https://github.com/black7375/Firefox-UI-Fix#readme + +#> + +[CmdletBinding( + SupportsShouldProcess = $true, + PositionalBinding = $false +)] + +param( + [Alias("u")] + [Switch]$Update=$false, + [Alias("f")] + [string]$ProfilePath, + [Alias("p")] + [string]$ProfileName, + [Alias("h")] + [Switch]$Help=$false +) + +function Install-Lepton { + # TODO: implement +} + +function Check-Help { + # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' + if ($Help) { + Get-Help "$PSCommandPath" + exit 0 + } +} + +Check-Help +Install-Lepton + From 0eee712cc5297a45bed079eda8fa38608fcc4b76 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 14:46:56 +1200 Subject: [PATCH 20/75] feat(installer-pwsh): verify ps version is at least 5 --- Install.ps1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index f9d5974..095d81d 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -58,8 +58,21 @@ param( [Switch]$Help=$false ) +$PSMinSupportedVersion = 10 + +function Verify-PowerShellVersion { + $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion | echo) + + Write-Host "[$PSVersion]" + if ($PSVersion -lt $PSMinSupportedVersion) { + Write-Error -Category NotInstalled "You need a minimum PowerShell version of [$PSMinSupportedVersion] to use this installer. Exiting." + exit -1 + } +} + function Install-Lepton { - # TODO: implement + Write-Host -NoNewline "Checking PowerShell version... " + Verify-PowerShellVersion # Check installed version meets minimum } function Check-Help { From 879af2107bc273f881280ac06255284d144958d6 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 14:48:52 +1200 Subject: [PATCH 21/75] chore(installer-pwsh): adjust wording of incompatible ps error message --- Install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index 095d81d..9b06b61 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -65,7 +65,7 @@ function Verify-PowerShellVersion { Write-Host "[$PSVersion]" if ($PSVersion -lt $PSMinSupportedVersion) { - Write-Error -Category NotInstalled "You need a minimum PowerShell version of [$PSMinSupportedVersion] to use this installer. Exiting." + Write-Error -Category NotInstalled "You need a minimum PowerShell version of [$PSMinSupportedVersion] to use this installer" exit -1 } } From 0a505ae651a9f60a59937621538b0073f2b5e0f4 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 14:57:35 +1200 Subject: [PATCH 22/75] fix(installer-pwsh): replace debug powershell version with v5 --- Install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index 9b06b61..2985a22 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -58,7 +58,7 @@ param( [Switch]$Help=$false ) -$PSMinSupportedVersion = 10 +$PSMinSupportedVersion = 5 function Verify-PowerShellVersion { $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion | echo) From 6d32e1b613586247a4f6429313e3d3176f58889d Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 14:58:46 +1200 Subject: [PATCH 23/75] chore(installer-pwsh): remove redundant echo call --- Install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index 2985a22..17950af 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -61,7 +61,7 @@ param( $PSMinSupportedVersion = 5 function Verify-PowerShellVersion { - $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion | echo) + $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion) Write-Host "[$PSVersion]" if ($PSVersion -lt $PSMinSupportedVersion) { From 61ea03219532f95d81555bd61838272b352933be Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 15:30:14 +1200 Subject: [PATCH 24/75] feat(installer-pwsh): create rough outline of installer functions --- Install.ps1 | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Install.ps1 b/Install.ps1 index 17950af..c39aca3 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -70,9 +70,48 @@ function Verify-PowerShellVersion { } } +function Select-LeptonDistribution { + param ([string]$CustomProfileDir) + # TODO: stub +} + +function Check-FirefoxProfileDirectories { + param ([string]$CustomProfilePath) + # TODO: stub +} + +function Check-FirefoxProfileConfigurations { + param ([string[]]$InstallDirectories) + # TODO: stub +} + +function Get-FirefoxProfilePaths { + # TODO: stub +} + +function Install-LeptonToProfiles { + param ([string[]]$PathsToInstall) + # TODO: stub +} + function Install-Lepton { Write-Host -NoNewline "Checking PowerShell version... " Verify-PowerShellVersion # Check installed version meets minimum + + # TODO: select style distribution (Photon or Proton) + Select-LeptonDistribution + + # TODO: check profile director{y,ies} (including custom) + $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath + + # TODO: check profile ini files exists + Check-FirefoxProfileConfigurations $InstallationDirectories + + # TODO: read profile paths in from profiles.ini files + $AsboluteProfilePaths = Get-FirefoxProfilePaths + + # TODO: install if in install mode + Install-LeptonToProfiles $AbsoluteProfilePaths } function Check-Help { From b90ad230329d939071f24dea5afe7ebbb6af7933 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 15:31:00 +1200 Subject: [PATCH 25/75] chore(installer-pwsh): add comment to declare constants section --- Install.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/Install.ps1 b/Install.ps1 index c39aca3..1d3f65f 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -58,6 +58,7 @@ param( [Switch]$Help=$false ) +# Constants $PSMinSupportedVersion = 5 function Verify-PowerShellVersion { From f82fdb0e7261d7a8a500d5f381f4533201fab3e6 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 15:31:30 +1200 Subject: [PATCH 26/75] chore(installer-pwsh): shift Check-Help method above install methods --- Install.ps1 | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 1d3f65f..dcb5968 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -61,6 +61,14 @@ param( # Constants $PSMinSupportedVersion = 5 +function Check-Help { + # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' + if ($Help) { + Get-Help "$PSCommandPath" + exit 0 + } +} + function Verify-PowerShellVersion { $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion) @@ -115,14 +123,6 @@ function Install-Lepton { Install-LeptonToProfiles $AbsoluteProfilePaths } -function Check-Help { - # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' - if ($Help) { - Get-Help "$PSCommandPath" - exit 0 - } -} - Check-Help Install-Lepton From 5ca27febb3deda576aa070b36055c2b3fa05880b Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 13 Jul 2021 13:43:03 +0900 Subject: [PATCH 27/75] Add: Fully Dark Mode - about:checkerboard --- userContent.css | 211 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 203 insertions(+), 8 deletions(-) diff --git a/userContent.css b/userContent.css index 21be914..376e66b 100644 --- a/userContent.css +++ b/userContent.css @@ -120,6 +120,7 @@ /** Fully Dark Mode *********************************************************/ /*= Fully Dark Mode - Dark Mode Colors =====================================*/ + /* Based on chrome://global/skin/in-content/common.css */ :host, :root { --in-content-page-color: rgb(21, 20, 26); @@ -278,13 +279,18 @@ /*= Fully Dark Mode - abouts' common =======================================*/ @-moz-document url-prefix("about:plugins"), - url-prefix("about:cache") { + url-prefix("about:cache"), + url-prefix("about:checkerboard") { + /* Base */ + :root { + font: message-box !important; + appearance: none !important; + } :root, body { background-color: var(--in-content-page-background) !important; color: var(--in-content-page-color) !important; } - body { font-size: 15px !important; font-weight: normal !important; @@ -298,10 +304,186 @@ line-height: 1.4em !important; } + /* Link */ a { color: var(--in-content-link-color) !important; } + a:hover, + .text-link:hover { + color: var(--in-content-link-color-hover) !important; + text-decoration: underline !important; + } + a:visited { + color: var(--in-content-link-color-visited) !important; + } + a:hover:active, + .text-link:hover:active { + color: var(--in-content-link-color-active) !important; + } + a:-moz-focusring, + .text-link:-moz-focusring { + outline: 2px solid var(--in-content-focus-outline-color) !important; + outline-offset: 1px !important; + border-radius: 4px !important; + } + /* Button */ + button { + font: inherit; + } + button, + select, + input[type="color"] { + appearance: none !important; + min-height: 32px !important; + color: var(--in-content-button-text-color, inherit) !important; + border: 1px solid transparent !important; /* shows up in high-contrast mode */ + border-radius: var(--in-content-button-border-radius) !important; + background-color: var(--in-content-button-background) !important; + font-weight: 400 !important; + padding: var(--in-content-button-vertical-padding) var(--in-content-button-horizontal-padding) !important; + text-decoration: none !important; + margin: 4px 8px !important; + /* Ensure font-size isn't overridden by widget styling (e.g. in forms.css) */ + font-size: 1em !important; + } + button { + font-weight: 600 !important; + /* Use the same margin of other elements for the alignment */ + margin-inline: 4px !important; + min-width: 6.3em !important; + } + /* Medium and small buttons get sized to 7/14 and 6/12px padding (when adding + * the 1px border): */ + button.medium { + --in-content-button-vertical-padding: 6px; + --in-content-button-horizontal-padding: 13px; + min-height: 28px !important; + font-size: 0.95em !important; + } + button.small { + --in-content-button-vertical-padding: 5px; + --in-content-button-horizontal-padding: 11px; + min-height: 24px !important; + font-size: 0.9em !important; + } + ::-moz-focus-inner { + border: none !important; + } + button:-moz-focusring { + box-shadow: none !important; + outline: 2px solid var(--in-content-focus-outline-color) !important; + outline-offset: 2px !important; + } + button:enabled:hover, + input[type="color"]:hover { + background-color: var(--in-content-button-background-hover) !important; + color: var(--in-content-button-text-color-hover) !important; + border-color: transparent !important; + } + button:enabled:hover:active, + input[type="color"]:enabled:hover:active { + background-color: var(--in-content-button-background-active) !important; + } + button:disabled, + input[type="color"]:disabled { + opacity: 0.4 !important; + } + button[autofocus], + button[type="submit"], + button.primary { + background-color: var(--in-content-primary-button-background) !important; + color: var(--in-content-primary-button-text-color) !important; + } + button[autofocus]:enabled:hover, + button[type="submit"]:enabled:hover, + button.primary:enabled:hover { + background-color: var(--in-content-primary-button-background-hover) !important; + color: var(--in-content-primary-button-text-color-hover) !important; + } + button[autofocus]:enabled:hover:active, + button[type="submit"]:enabled:hover:active, + button.primary:enabled:hover:active { + background-color: var(--in-content-primary-button-background-active) !important; + } + + /* Checkbox */ + input[type="checkbox"] { + margin-block: 2px !important; + } + input[type="checkbox"] { + appearance: none !important; + height: 16px !important; + width: 16px !important; + border: 1px solid var(--checkbox-border-color) !important; + background-color: var(--checkbox-unchecked-bgcolor) !important; + border-radius: 2px !important; + margin-inline: 0 6px !important; + flex-shrink: 0 !important; /* avoid shrinking inside flex container */ + } + input[type="checkbox"]:enabled:hover { + background-color: var(--checkbox-unchecked-hover-bgcolor) !important; + } + input[type="checkbox"]:enabled:hover:active { + background-color: var(--checkbox-unchecked-active-bgcolor) !important; + } + input[type="checkbox"]:checked { + border-color: var(--checkbox-checked-border-color) !important; + background-color: var(--checkbox-checked-bgcolor) !important; + background-image: url("chrome://global/skin/icons/check.svg") !important; + background-position: center !important; + background-repeat: no-repeat !important; + -moz-context-properties: fill !important; + fill: currentColor !important; + color: var(--checkbox-checked-color) !important; + /* Style the button also when printing with "Print Backgrounds" unchecked */ + color-adjust: exact !important; + } + input[type="checkbox"]:enabled:checked:hover { + background-color: var(--checkbox-checked-hover-bgcolor) !important; + } + input[type="checkbox"]:enabled:checked:hover:active { + background-color: var(--checkbox-checked-active-bgcolor) !important; + } + + /* Textarea */ + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]), + textarea { + appearance: none !important; + border: 1px solid var(--in-content-box-border-color) !important; + border-radius: 4px !important; + color: inherit !important; + background-color: var(--in-content-box-background) !important; + } + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]), + textarea { + font-family: inherit !important; + font-size: inherit !important; + padding: 8px !important; + margin: 2px 4px !important; + } + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):focus, + textarea:focus, + search-textbox[focused], + tree:focus-visible, + richlistbox:focus-visible { + border-color: transparent !important; + outline: 2px solid var(--in-content-focus-outline-color) !important; + outline-offset: -1px !important; /* Prevents antialising around the corners */ + } + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):-moz-ui-invalid, + textarea:-moz-ui-invalid { + border-color: transparent !important; + outline: 2px solid var(--in-content-border-invalid) !important; + outline-offset: -1px !important; /* Prevents antialising around the corners */ + } + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):disabled, + textarea:disabled, + search-textbox[disabled="true"] { + opacity: 0.4 !important; + } + + /* Table */ table { width: 100% !important; border: 1px solid var(--in-content-border-color) !important; @@ -309,6 +491,16 @@ } } + @-moz-document url-prefix("about:cache"), + url-prefix("about:checkerboard") { + th, td { + border: 1px solid var(--in-content-border-color) !important; + } + th { + background-color: var(--in-content-table-header-background) !important; + color: var(--in-content-table-header-color) !important; + } + } /*= Fully Dark Mode - about:plugins ========================================*/ @-moz-document url-prefix("about:plugins") { .notice { @@ -324,14 +516,17 @@ } th, td { - border: 1px solid var(--in-content-border-color); - padding: 4px; - text-align: match-parent; + padding: 4px !important; + text-align: match-parent !important; } + } - th { - background-color: var(--in-content-table-header-background) !important; - color: var(--in-content-table-header-color) !important; + @-moz-document url-prefix("about:checkerboard") { + #canvas { + border: 1px solid var(--in-content-border-color) !important; + } + #excludePageFromZoom { + vertical-align: bottom !important; } } From eefb7e3ad3a1dc38518bdde5909305413599890b Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 13 Jul 2021 14:09:27 +0900 Subject: [PATCH 28/75] Add: Fully Dark Mode - about:sync-log --- userContent.css | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/userContent.css b/userContent.css index 376e66b..f2aba3a 100644 --- a/userContent.css +++ b/userContent.css @@ -280,7 +280,8 @@ /*= Fully Dark Mode - abouts' common =======================================*/ @-moz-document url-prefix("about:plugins"), url-prefix("about:cache"), - url-prefix("about:checkerboard") { + url-prefix("about:checkerboard"), + url-prefix("about:sync-log") { /* Base */ :root { font: message-box !important; @@ -486,11 +487,17 @@ /* Table */ table { width: 100% !important; + } + } + + @-moz-document url-prefix("about:plugins"), + url-prefix("about:cache"), + url-prefix("about:checkerboard") { + table { border: 1px solid var(--in-content-border-color) !important; border-radius: 0 !important; } } - @-moz-document url-prefix("about:cache"), url-prefix("about:checkerboard") { th, td { @@ -521,6 +528,7 @@ } } + /*= Fully Dark Mode - about:checkerboard ===================================*/ @-moz-document url-prefix("about:checkerboard") { #canvas { border: 1px solid var(--in-content-border-color) !important; @@ -530,6 +538,16 @@ } } + /*= Fully Dark Mode - about:sync-log =======================================*/ + @-moz-document url-prefix("about:sync-log") { + body { + background-color: var(--in-content-box-background) !important; + } + thead a { + color: var(--in-content-page-color) !important; + } + } + /*= Fully Dark Mode - Addons.org ===========================================*/ @-moz-document url-prefix("https://addons.mozilla.org") { /* Basic */ From 22ee917caa6082521e7e99a3b7a136c2578d05e6 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 13 Jul 2021 14:28:44 +0900 Subject: [PATCH 29/75] Add: Fully Dark Mode - about:memory --- userContent.css | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/userContent.css b/userContent.css index f2aba3a..bd16cea 100644 --- a/userContent.css +++ b/userContent.css @@ -281,7 +281,8 @@ @-moz-document url-prefix("about:plugins"), url-prefix("about:cache"), url-prefix("about:checkerboard"), - url-prefix("about:sync-log") { + url-prefix("about:sync-log"), + url-prefix("about:memory") { /* Base */ :root { font: message-box !important; @@ -548,6 +549,18 @@ } } + /*= Fully Dark Mode - about:memory =========================================*/ + @-moz-document url-prefix("about:memory") { + .opsRow, + .section { + background-color: var(--in-content-box-background) !important; + color: var(--in-content-page-color) !important; + } + .opsRowLabel input { + vertical-align: bottom !important; + } + } + /*= Fully Dark Mode - Addons.org ===========================================*/ @-moz-document url-prefix("https://addons.mozilla.org") { /* Basic */ From 3c59c9f7b2e75c7b8b6bb008a45aff313e4b46b5 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 13 Jul 2021 14:55:51 +0900 Subject: [PATCH 30/75] Fix: Fully Dark Mode - addon.org --- userContent.css | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/userContent.css b/userContent.css index bd16cea..be2af2b 100644 --- a/userContent.css +++ b/userContent.css @@ -633,7 +633,10 @@ .Home-heroHeader-subtitle, .blog-entry-date, .blogpost-breadcrumb *, - .AddonTitle-author { + .AddonTitle-author, + .ExpandableCard-ToggleLink, + .SearchFilters-label, + .PromotedBadge-label--line { color: var(--in-content-deemphasized-text) !important; } .PromotedBadge-label--recommended { @@ -716,6 +719,13 @@ border-color: var(--in-content-primary-button-background) !important; } + .PromotedBadge-link--line { + border-color: var(--in-content-deemphasized-text) !important; + } + .PromotedBadge-link--line:hover { + border-color: var(--in-content-button-background-hover) !important; + } + .blog-entry-read-more-link { border-color: var(--in-content-link-color) !important; } From 1e606773f6da9b4eade8078971b9a59b69090b93 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 13 Jul 2021 15:16:04 +0900 Subject: [PATCH 31/75] Add: Fully Dark Mode - Directory View --- userContent.css | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/userContent.css b/userContent.css index be2af2b..6a4eb1e 100644 --- a/userContent.css +++ b/userContent.css @@ -282,7 +282,9 @@ url-prefix("about:cache"), url-prefix("about:checkerboard"), url-prefix("about:sync-log"), - url-prefix("about:memory") { + url-prefix("about:memory"), + url-prefix("resource://"), + url-prefix("file://") { /* Base */ :root { font: message-box !important; @@ -509,6 +511,22 @@ color: var(--in-content-table-header-color) !important; } } + + /*= Fully Dark Mode - Directory View =======================================*/ + @-moz-document url-prefix("about:sync-log"), + url-prefix("resource://"), + url-prefix("file://") { + body { + background-color: var(--in-content-box-background) !important; + } + thead a { + color: var(--in-content-page-color) !important; + } + td ::before { + vertical-align: top !important; + } + } + /*= Fully Dark Mode - about:plugins ========================================*/ @-moz-document url-prefix("about:plugins") { .notice { @@ -539,16 +557,6 @@ } } - /*= Fully Dark Mode - about:sync-log =======================================*/ - @-moz-document url-prefix("about:sync-log") { - body { - background-color: var(--in-content-box-background) !important; - } - thead a { - color: var(--in-content-page-color) !important; - } - } - /*= Fully Dark Mode - about:memory =========================================*/ @-moz-document url-prefix("about:memory") { .opsRow, From 20207a9b9221c04a9506d32be279407c49c2107e Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 13 Jul 2021 16:31:22 +0900 Subject: [PATCH 32/75] Fix: remove resouce:// file:// color (devtools compatibility) --- userContent.css | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/userContent.css b/userContent.css index 6a4eb1e..d7518e6 100644 --- a/userContent.css +++ b/userContent.css @@ -283,15 +283,12 @@ url-prefix("about:checkerboard"), url-prefix("about:sync-log"), url-prefix("about:memory"), - url-prefix("resource://"), url-prefix("file://") { /* Base */ - :root { + html, + body { font: message-box !important; appearance: none !important; - } - :root, - body { background-color: var(--in-content-page-background) !important; color: var(--in-content-page-color) !important; } @@ -514,7 +511,6 @@ /*= Fully Dark Mode - Directory View =======================================*/ @-moz-document url-prefix("about:sync-log"), - url-prefix("resource://"), url-prefix("file://") { body { background-color: var(--in-content-box-background) !important; From fa5a058557f66548c15e3a3dfe15dfebb67ef50c Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 20:37:06 +1200 Subject: [PATCH 33/75] feat(installer-pwsh): drop minimum ps version to 2 --- Install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index dcb5968..0d23bca 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -59,7 +59,7 @@ param( ) # Constants -$PSMinSupportedVersion = 5 +$PSMinSupportedVersion = 2 function Check-Help { # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' From 62581efe0b7e8586bcb6d87fb31294afef8243fd Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 21:59:18 +1200 Subject: [PATCH 34/75] feat(installer-pwsh): save output of SelectLeptonDistribution to var --- Install.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index 0d23bca..bff21c7 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -108,7 +108,7 @@ function Install-Lepton { Verify-PowerShellVersion # Check installed version meets minimum # TODO: select style distribution (Photon or Proton) - Select-LeptonDistribution + $SelectedDistribution = Select-LeptonDistribution # TODO: check profile director{y,ies} (including custom) $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath From bfb4f51cb4437ab665765859ace3182ae54c7b36 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Tue, 13 Jul 2021 22:00:38 +1200 Subject: [PATCH 35/75] feat(installer-pwsh): implement Select-LeptonDistribution --- Install.ps1 | 91 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 85 insertions(+), 6 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index bff21c7..9730f27 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -79,9 +79,88 @@ function Verify-PowerShellVersion { } } +function Check-LeptonInstallFiles { + param ([string[]]$Files) + + foreach ($item in $Files) { + if (-not (Test-Path $item)) { + return $false + } + } + + return $true +} + +$InstallType = @{ + Local = 0; + Release = 1; + Network = 2; +} + +function Get-LeptonInstallType { + $LocalFiles = "userChrome.css", "userContent.css", "icons" + $ReleaseFiles = "user.js", "chrome/userChrome.css", "chrome/userContent.css", "chrome/icons" + + $IsTypeLocal = Check-LeptonInstallFiles $LocalFiles + $IsTypeRelease = Check-LeptonInstallFiles $ReleaseFiles + + if ($IsTypeLocal) { + return $InstallType.Local + } elseif ($IsTypeRelease) { + return $InstallType.Release + } + + return $InstallType.Network +} + +function Select-LeptonDistributionPrompt { + # TODO: make it act like the bash installer with arrow keys + space + Write-Host "Select a distrubution:" + Write-Host " (1) Original" + Write-Host " (2) Photon-Style" + Write-Host " (3) Photon-Style" + Write-Host "" + + $SelectedBranch = "" + while ($SelectedBranch -eq "") { + $SelectedInput = Read-Host "Enter a distribution number (1, 2, 3)" + + switch ($SelectedInput) { + "1" { $SelectedBranch = "master"; break } + "2" { $SelectedBranch = "photon-style"; break } + "3" { $SelectedBranch = "proton-style"; break } + default { Write-Host "Invalid option, reselect please." } + } + } + + Write-Host "" + Write-Host "Selected '$SelectedBranch'!" + + return $SelectedBranch +} + function Select-LeptonDistribution { - param ([string]$CustomProfileDir) - # TODO: stub + Write-Host "" + + $FoundInstallType = Get-LeptonInstallType + switch ($FoundInstallType) { + $InstallType.Release { break } + $InstallType.Network { $SelectedDistribution = Select-LeptonDistributionPrompt; break } + $InstallType.Local { + $SelectedDistribution = Select-LeptonDistributionPrompt + $GitInstalled=$((Get-Command -ErrorAction SilentlyContinue "git").Length -eq 0) + if ($GitInstalled && Test-Path ".git" && $PSCmdlet.ShouldProcess(".git")) { + git checkout $LeptonBranchName + } + break + } + default { throw } + } + + return @{ + Type = $InstallType.Network; + Dist = $SelectedDistribution; + } } function Check-FirefoxProfileDirectories { @@ -111,16 +190,16 @@ function Install-Lepton { $SelectedDistribution = Select-LeptonDistribution # TODO: check profile director{y,ies} (including custom) - $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath + #$InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath # TODO: check profile ini files exists - Check-FirefoxProfileConfigurations $InstallationDirectories + #Check-FirefoxProfileConfigurations $InstallationDirectories # TODO: read profile paths in from profiles.ini files - $AsboluteProfilePaths = Get-FirefoxProfilePaths + #$AsboluteProfilePaths = Get-FirefoxProfilePaths # TODO: install if in install mode - Install-LeptonToProfiles $AbsoluteProfilePaths + #Install-LeptonToProfiles $AbsoluteProfilePaths } Check-Help From 91f80843e8431e4bf7b654c727119b668dbfb99d Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Wed, 14 Jul 2021 10:20:52 +0900 Subject: [PATCH 36/75] Add: Fully Dark Mode - Remove white flash at @overdodactyl 's ShadowFox --- userChrome.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/userChrome.css b/userChrome.css index 5fc67c0..d8948e2 100644 --- a/userChrome.css +++ b/userChrome.css @@ -104,6 +104,14 @@ } /* Fully Dark Mode **********************************************************/ + /*= Remove White Flash =====================================================*/ + #tabbrowser-tabbox, + #tabbrowser-tabpanels, + browser[type=content-primary], + browser[type=content] > html { + background: var(--lwt-accent-color) !important; + } + /*= Notification ===========================================================*/ @-moz-document url("chrome://global/content/alerts/alert.xhtml") { /* line below removes background from the notification "window" on linux */ From 68a94765617fd68e59885635d0cc02076decd550 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Wed, 14 Jul 2021 14:50:11 +0900 Subject: [PATCH 37/75] Add: GTK System Default Theme - URL Bar focus color #120 --- userChrome.css | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/userChrome.css b/userChrome.css index d8948e2..dff0da5 100644 --- a/userChrome.css +++ b/userChrome.css @@ -1,15 +1,17 @@ @media (-moz-proton) { - /** Lightmode - Color darker ************************************************/ + /** Default Thme - Contrast *************************************************/ + /*= Lightmode - Color darker ===============================================*/ :root[lwtheme-mozlightdark][lwthemetextcolor="dark"] { --lwt-accent-color: rgb(229, 229, 235) !important; /* Original: rgb(240, 240, 244) */ } - /** Darkmode - Color lighter ************************************************/ + /*= Darkmode - Color lighter ===============================================*/ :root[lwtheme-mozlightdark][lwthemetextcolor="bright"] { --toolbar-bgcolor: rgba(43, 42, 51, 5) !important; /* Original: rgba(43, 42, 51, 1) */ } - /* Theme - Compatibility ****************************************************/ + /** Theme - Compatibility ***************************************************/ + /*= Light Weidght Theme ====================================================*/ /* Header Image */ :root[lwtheme-image] { background-image: var(--lwt-header-image) !important; /* Original: var(--lwt-header-image) */ @@ -34,7 +36,7 @@ border-radius: 4px; } - /** Windows 7 - Compatibility ***********************************************/ + /*= Windows 7 ==============================================================*/ @media (-moz-os-version: windows-win7) { /* Header Color */ :root:not([lwtheme-image]) #navigator-toolbox:-moz-lwtheme { @@ -49,7 +51,23 @@ } } - /** Windows System Default Theme - Use acccent color ************************/ + /** System Default Theme ****************************************************/ + /*= Common - URL Bar focus color ===========================================*/ + @media (-moz-windows-accent-color-in-titlebar), + (-moz-gtk-csd-available) { + /* URL Bar */ + :root[tabsintitlebar]:not(:-moz-window-inactive, :-moz-lwtheme), + :root[tabsintitlebar][lwt-default-theme-in-dark-mode]:not(:-moz-window-inactive) { + --focus-outline-color: -moz-accent-color !important; + } + + :root[tabsintitlebar]:not(:-moz-window-inactive, :-moz-lwtheme) #urlbar[open] > #urlbar-background, + :root[tabsintitlebar][lwt-default-theme-in-dark-mode]:not(:-moz-window-inactive) #urlbar[open] > #urlbar-background { + border-color: color-mix(in srgb, -moz-accent-color 50%, transparent) !important; /* Like: --toolbar-field-focus-border-color */ + } + } + + /*= Windows10 - Titlebar accent color ======================================*/ @media (-moz-windows-accent-color-in-titlebar) { /* Tab Bar */ :root[tabsintitlebar]:not(:-moz-window-inactive, :-moz-lwtheme) .titlebar-color, @@ -64,17 +82,6 @@ --toolbarbutton-hover-background: color-mix(in srgb, -moz-accent-color-foreground 10%, transparent); --toolbarbutton-active-background: color-mix(in srgb, -moz-accent-color-foreground 15%, transparent); } - - /* URL Bar */ - :root[tabsintitlebar]:not(:-moz-window-inactive, :-moz-lwtheme), - :root[tabsintitlebar][lwt-default-theme-in-dark-mode]:not(:-moz-window-inactive) { - --focus-outline-color: -moz-accent-color !important; - } - - :root[tabsintitlebar]:not(:-moz-window-inactive, :-moz-lwtheme) #urlbar[open] > #urlbar-background, - :root[tabsintitlebar][lwt-default-theme-in-dark-mode]:not(:-moz-window-inactive) #urlbar[open] > #urlbar-background { - border-color: color-mix(in srgb, -moz-accent-color 50%, transparent) !important; /* Like: --toolbar-field-focus-border-color */ - } } /* Fully Theme Mode *********************************************************/ From c7145d44e41c84f6f5f3ba6b68ad3891ddcb9479 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Wed, 14 Jul 2021 15:26:25 +0900 Subject: [PATCH 38/75] Add: System Default Theme - GTK accent color at URL View url #120 --- userChrome.css | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/userChrome.css b/userChrome.css index dff0da5..8dde038 100644 --- a/userChrome.css +++ b/userChrome.css @@ -84,6 +84,13 @@ } } + /*= GTK - URL View url accent color ========================================*/ + @media (-moz-gtk-csd-available) { + :root:not(:-moz-lwtheme) .urlbarView-url { + --urlbar-popup-url-color: -moz-accent-color; + } + } + /* Fully Theme Mode *********************************************************/ /* Default Themes https://github.com/mozilla/gecko-dev/blob/master/toolkit/mozapps/extensions/default-theme/manifest.json From c09c839378804915dc188dd7053cf582c9cd4a73 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Wed, 14 Jul 2021 15:36:01 +0900 Subject: [PATCH 39/75] Clean: Theme - compatibility's code order --- userChrome.css | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/userChrome.css b/userChrome.css index 8dde038..c025c5b 100644 --- a/userChrome.css +++ b/userChrome.css @@ -11,7 +11,14 @@ } /** Theme - Compatibility ***************************************************/ - /*= Light Weidght Theme ====================================================*/ + /*= Hotfix #98 =============================================================*/ + /* Hidden Tab Panel Padding */ + #allTabsMenu-hiddenTabsView .all-tabs-item { + margin-inline: 8px; + border-radius: 4px; + } + + /*= Light Weight Theme =====================================================*/ /* Header Image */ :root[lwtheme-image] { background-image: var(--lwt-header-image) !important; /* Original: var(--lwt-header-image) */ @@ -30,12 +37,6 @@ --tabs-border-color: rgba(0,0,0,.3); } - /* Hidden Tab Panel Padding */ - #allTabsMenu-hiddenTabsView .all-tabs-item { - margin-inline: 8px; - border-radius: 4px; - } - /*= Windows 7 ==============================================================*/ @media (-moz-os-version: windows-win7) { /* Header Color */ From 9f4ba60736714e5e79a92c830bed548cc82cfa6b Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Thu, 15 Jul 2021 09:47:05 +0900 Subject: [PATCH 40/75] Fix: Fully Dark Mode - addon.org paginate, badge color --- userContent.css | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/userContent.css b/userContent.css index d7518e6..47fd77f 100644 --- a/userContent.css +++ b/userContent.css @@ -585,10 +585,14 @@ .Home-SubjectShelf-link:visited, .DropdownMenuItem-link a, .Select, + .Badge, + .Paginate .Button.Paginate-item:first-child, + .Paginate .Button.Paginate-item:last-child, + .Paginate .Button.Paginate-item--current-page, .Button--neutral, .blog-entry-title, .blogpost-nav * { - color: var(--in-content-text-color)!important; + color: var(--in-content-text-color) !important; } .AutoSearchInput-suggestions-item:is(:active, :focus, :hover), .SecondaryHero-message-link, @@ -604,6 +608,7 @@ .AddonMeta .MetadataCard-content a.AddonMeta-reviews-content-link:is(:active, :hover), .RatingsByStar-count a:hover, .RatingsByStar-star a:hover, + .Paginate .Button.Paginate-item:not(:first-child, :last-child, .Paginate-item--current-page), .AddonTitle-author a, .PermissionsCard-learn-more, .DefinitionList a, @@ -632,6 +637,7 @@ .Definition-dt, .RatingsByStar-count a, .RatingsByStar-star a, + .Paginate-page-number, .AddonSummaryCard-addonAverage, .AddonReviewCard-authorByLine, .Home-heroHeader-subtitle, @@ -674,6 +680,7 @@ .Card-contents, .CardList ul > li, .AddonsCard--horizontal ul.AddonsCard-list .SearchResult-wrapper:is(:focus, :hover), + .Paginate, .LandingPage-header, .DropdownMenu-items, .DropdownMenu-items::after, @@ -684,13 +691,16 @@ .blogpost-nav * { background: var(--in-content-table-background) !important; } + .Paginate .Button.Paginate-item:is(:active, :hover) { + background: var(--in-content-button-background-hover) !important; + } .LanguageTools-header-row { color: var(--in-content-table-header-color) !important; background: var(--in-content-table-header-background) !important; } .LanguageTools-table.responsiveTable tbody tr:nth-child(2n) { - background-color: var(--in-content-box-background-odd) !important;; + background-color: var(--in-content-box-background-odd) !important; } /* Fill */ @@ -705,10 +715,10 @@ filter: invert(65%) !important; } .Icon-heart { - filter: brightness(0) !important;; + filter: brightness(0) !important; } .Permission .Icon { - filter: grayscale(100%) brightness(30) !important;; + filter: grayscale(100%) brightness(30) !important; } /* Others */ From ab5cbd24d4cbdc136c146e991bb59d1b6b163ebd Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Thu, 15 Jul 2021 14:11:30 +0900 Subject: [PATCH 41/75] Add: Fully Dark Mode - Support.org --- userContent.css | 107 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) diff --git a/userContent.css b/userContent.css index 47fd77f..00f45cc 100644 --- a/userContent.css +++ b/userContent.css @@ -749,5 +749,112 @@ stroke: var(--in-content-text-color) !important; } } + + /*= Fully Dark Mode - Support.org ==========================================*/ + @-moz-document url-prefix("https://support.mozilla.org") { + /* Basic */ + :root { + --color-blue-06: var(--in-content-link-color) !important; + --color-blue-07: var(--in-content-link-color-hover) !important; + + --page-bg: var(--in-content-page-background) !important; + --color-white: var(--in-content-page-background) !important; + --color-shade-bg: var(--in-content-page-background) !important; + --color-marketing-gray-02: var(--card-outline-color) !important; + --color-inverse-bg: var(--in-content-page-color) !important; + --color-inverse: var(--in-content-page-background) !important; + --color-text: var(--in-content-page-color) !important; + --color-text-light: var(--in-content-deemphasized-text) !important; + --color-link: var(--in-content-link-color) !important; + --color-success: var(--green-60) !important; + --color-warning: var(--yellow-60) !important; + --color-error: var(--red-60) !important; + --color-error-hover: var(--red-50) !important; + --color-moz-heading: #fff; + --color-moz-inverse-bg: var(red) !important; + --focus-shadow: 0 0 0 4px color-mix(in srgb, var(--in-content-primary-button-background) 30%, transparent),0 0 0 2px var(--in-content-primary-button-background-active); + } + body, + #main-content, + #instant-search-content, + #mzp-c-menu-panel-help, + .mzp-c-navigation { + color: var(--in-content-page-color) !important; + background: var(--in-content-page-background) !important; + } + + /* Text */ + .mzp-c-menu-category .mzp-c-menu-title, + .mzp-c-menu-item .mzp-c-menu-item-link, + .mzp-c-menu-item .mzp-c-menu-item-link > *, + .mzp-c-menu-item .mzp-c-menu-item-list a, + #doc-content .menu, + .document--content .menu, + .forum--entry-content .menu{ + color: var(--in-content-page-color) !important; + } + + .ts-select-trigger, + input[type="date"], + input[type="email"], + input[type="number"], + input[type="password"], + input[type="search"], + input[type="tel"], + input[type="text"], + input[type="time"], + input[type="url"], + select, + textarea, + #doc-content .button, + #doc-content .key, + .document--content .button, + .document--content .key, + .forum--entry-content .button, + .forum--entry-content .key{ + color: var(--in-content-deemphasized-text) !important; + } + + /* Background */ + .sidebar-nav.topics, .sidebar-nav.topics > li { + background: var(--in-content-page-background) !important; + } + + /* Fill */ + .sumo-nav--logo, + .sumo-nav--search-button, + .sumo-nav--toggle-button, + .card--icon-sm, + .mzp-c-menu-item-icon, + .mzp-c-menu-button-close, + .topic-article--icon, + .card--topic > .card--icon { + filter: invert(95%) !important; + } + + /* Others */ + .sumo-button.secondary-button { + border-color: none !important; + } + .mzp-c-menu-panel { + border-color: var(--in-content-button-background-hover) !important; + } + .mzp-c-menu-item:is(:focus, :hover, :active) .mzp-c-menu-item-link .mzp-c-menu-item-title { + border-color: var(--in-content-page-color) !important; + } + + @media screen and (min-width: 768px) { + .mzp-c-menu-panel { + box-shadow: box-shadow: 0 16px 16px -16px rgba(255,255,255,.3) !important; + } + } + .card--product, + .card--topic, + .card--article { + box-shadow: 0 5px 10px -3px rgba(249, 249, 250, .12) , + 0 3px 16px 2px rgba(91, 91, 102, .12), + 0 8px 12px 1px rgba(82, 82, 94, .04) !important; + } + } } } From 6eb7a02309598a98bf1034dfce0a7e0837fa9797 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Thu, 15 Jul 2021 14:30:18 +0900 Subject: [PATCH 42/75] Fix: light theme's about pages looks like proton --- userContent.css | 581 ++++++++++++++++++++++++------------------------ 1 file changed, 291 insertions(+), 290 deletions(-) diff --git a/userContent.css b/userContent.css index 00f45cc..d52d930 100644 --- a/userContent.css +++ b/userContent.css @@ -277,295 +277,7 @@ scrollbar-color: rgba(249,249,250,.4) rgba(20,20,25,.3); } - /*= Fully Dark Mode - abouts' common =======================================*/ - @-moz-document url-prefix("about:plugins"), - url-prefix("about:cache"), - url-prefix("about:checkerboard"), - url-prefix("about:sync-log"), - url-prefix("about:memory"), - url-prefix("file://") { - /* Base */ - html, - body { - font: message-box !important; - appearance: none !important; - background-color: var(--in-content-page-background) !important; - color: var(--in-content-page-color) !important; - } - body { - font-size: 15px !important; - font-weight: normal !important; - margin: 0 !important; - } - - h1 { - line-height: 1.2 !important; - } - h2 { - line-height: 1.4em !important; - } - - /* Link */ - a { - color: var(--in-content-link-color) !important; - } - a:hover, - .text-link:hover { - color: var(--in-content-link-color-hover) !important; - text-decoration: underline !important; - } - a:visited { - color: var(--in-content-link-color-visited) !important; - } - a:hover:active, - .text-link:hover:active { - color: var(--in-content-link-color-active) !important; - } - a:-moz-focusring, - .text-link:-moz-focusring { - outline: 2px solid var(--in-content-focus-outline-color) !important; - outline-offset: 1px !important; - border-radius: 4px !important; - } - - /* Button */ - button { - font: inherit; - } - button, - select, - input[type="color"] { - appearance: none !important; - min-height: 32px !important; - color: var(--in-content-button-text-color, inherit) !important; - border: 1px solid transparent !important; /* shows up in high-contrast mode */ - border-radius: var(--in-content-button-border-radius) !important; - background-color: var(--in-content-button-background) !important; - font-weight: 400 !important; - padding: var(--in-content-button-vertical-padding) var(--in-content-button-horizontal-padding) !important; - text-decoration: none !important; - margin: 4px 8px !important; - /* Ensure font-size isn't overridden by widget styling (e.g. in forms.css) */ - font-size: 1em !important; - } - button { - font-weight: 600 !important; - /* Use the same margin of other elements for the alignment */ - margin-inline: 4px !important; - min-width: 6.3em !important; - } - /* Medium and small buttons get sized to 7/14 and 6/12px padding (when adding - * the 1px border): */ - button.medium { - --in-content-button-vertical-padding: 6px; - --in-content-button-horizontal-padding: 13px; - min-height: 28px !important; - font-size: 0.95em !important; - } - button.small { - --in-content-button-vertical-padding: 5px; - --in-content-button-horizontal-padding: 11px; - min-height: 24px !important; - font-size: 0.9em !important; - } - ::-moz-focus-inner { - border: none !important; - } - button:-moz-focusring { - box-shadow: none !important; - outline: 2px solid var(--in-content-focus-outline-color) !important; - outline-offset: 2px !important; - } - button:enabled:hover, - input[type="color"]:hover { - background-color: var(--in-content-button-background-hover) !important; - color: var(--in-content-button-text-color-hover) !important; - border-color: transparent !important; - } - button:enabled:hover:active, - input[type="color"]:enabled:hover:active { - background-color: var(--in-content-button-background-active) !important; - } - button:disabled, - input[type="color"]:disabled { - opacity: 0.4 !important; - } - button[autofocus], - button[type="submit"], - button.primary { - background-color: var(--in-content-primary-button-background) !important; - color: var(--in-content-primary-button-text-color) !important; - } - button[autofocus]:enabled:hover, - button[type="submit"]:enabled:hover, - button.primary:enabled:hover { - background-color: var(--in-content-primary-button-background-hover) !important; - color: var(--in-content-primary-button-text-color-hover) !important; - } - button[autofocus]:enabled:hover:active, - button[type="submit"]:enabled:hover:active, - button.primary:enabled:hover:active { - background-color: var(--in-content-primary-button-background-active) !important; - } - - /* Checkbox */ - input[type="checkbox"] { - margin-block: 2px !important; - } - input[type="checkbox"] { - appearance: none !important; - height: 16px !important; - width: 16px !important; - border: 1px solid var(--checkbox-border-color) !important; - background-color: var(--checkbox-unchecked-bgcolor) !important; - border-radius: 2px !important; - margin-inline: 0 6px !important; - flex-shrink: 0 !important; /* avoid shrinking inside flex container */ - } - input[type="checkbox"]:enabled:hover { - background-color: var(--checkbox-unchecked-hover-bgcolor) !important; - } - input[type="checkbox"]:enabled:hover:active { - background-color: var(--checkbox-unchecked-active-bgcolor) !important; - } - input[type="checkbox"]:checked { - border-color: var(--checkbox-checked-border-color) !important; - background-color: var(--checkbox-checked-bgcolor) !important; - background-image: url("chrome://global/skin/icons/check.svg") !important; - background-position: center !important; - background-repeat: no-repeat !important; - -moz-context-properties: fill !important; - fill: currentColor !important; - color: var(--checkbox-checked-color) !important; - /* Style the button also when printing with "Print Backgrounds" unchecked */ - color-adjust: exact !important; - } - input[type="checkbox"]:enabled:checked:hover { - background-color: var(--checkbox-checked-hover-bgcolor) !important; - } - input[type="checkbox"]:enabled:checked:hover:active { - background-color: var(--checkbox-checked-active-bgcolor) !important; - } - - /* Textarea */ - input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]), - textarea { - appearance: none !important; - border: 1px solid var(--in-content-box-border-color) !important; - border-radius: 4px !important; - color: inherit !important; - background-color: var(--in-content-box-background) !important; - } - input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]), - textarea { - font-family: inherit !important; - font-size: inherit !important; - padding: 8px !important; - margin: 2px 4px !important; - } - input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):focus, - textarea:focus, - search-textbox[focused], - tree:focus-visible, - richlistbox:focus-visible { - border-color: transparent !important; - outline: 2px solid var(--in-content-focus-outline-color) !important; - outline-offset: -1px !important; /* Prevents antialising around the corners */ - } - input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):-moz-ui-invalid, - textarea:-moz-ui-invalid { - border-color: transparent !important; - outline: 2px solid var(--in-content-border-invalid) !important; - outline-offset: -1px !important; /* Prevents antialising around the corners */ - } - input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):disabled, - textarea:disabled, - search-textbox[disabled="true"] { - opacity: 0.4 !important; - } - - /* Table */ - table { - width: 100% !important; - } - } - - @-moz-document url-prefix("about:plugins"), - url-prefix("about:cache"), - url-prefix("about:checkerboard") { - table { - border: 1px solid var(--in-content-border-color) !important; - border-radius: 0 !important; - } - } - @-moz-document url-prefix("about:cache"), - url-prefix("about:checkerboard") { - th, td { - border: 1px solid var(--in-content-border-color) !important; - } - th { - background-color: var(--in-content-table-header-background) !important; - color: var(--in-content-table-header-color) !important; - } - } - - /*= Fully Dark Mode - Directory View =======================================*/ - @-moz-document url-prefix("about:sync-log"), - url-prefix("file://") { - body { - background-color: var(--in-content-box-background) !important; - } - thead a { - color: var(--in-content-page-color) !important; - } - td ::before { - vertical-align: top !important; - } - } - - /*= Fully Dark Mode - about:plugins ========================================*/ - @-moz-document url-prefix("about:plugins") { - .notice { - background: var(--in-content-box-background) !important; - border: 1px solid var(--in-content-border-color) !important; - } - } - - /*= Fully Dark Mode - about:cache ==========================================*/ - @-moz-document url-prefix("about:cache") { - table { - padding: 0 !important; - } - - th, td { - padding: 4px !important; - text-align: match-parent !important; - } - } - - /*= Fully Dark Mode - about:checkerboard ===================================*/ - @-moz-document url-prefix("about:checkerboard") { - #canvas { - border: 1px solid var(--in-content-border-color) !important; - } - #excludePageFromZoom { - vertical-align: bottom !important; - } - } - - /*= Fully Dark Mode - about:memory =========================================*/ - @-moz-document url-prefix("about:memory") { - .opsRow, - .section { - background-color: var(--in-content-box-background) !important; - color: var(--in-content-page-color) !important; - } - .opsRowLabel input { - vertical-align: bottom !important; - } - } - - /*= Fully Dark Mode - Addons.org ===========================================*/ + /*= Addons.org =============================================================*/ @-moz-document url-prefix("https://addons.mozilla.org") { /* Basic */ .Page-content, @@ -750,7 +462,7 @@ } } - /*= Fully Dark Mode - Support.org ==========================================*/ + /*= Support.org ============================================================*/ @-moz-document url-prefix("https://support.mozilla.org") { /* Basic */ :root { @@ -857,4 +569,293 @@ } } } + + /** Fully Proton Mode *******************************************************/ + /*= abouts' common =========================================================*/ + @-moz-document url-prefix("about:plugins"), + url-prefix("about:cache"), + url-prefix("about:checkerboard"), + url-prefix("about:sync-log"), + url-prefix("about:memory"), + url-prefix("file://") { + /* Base */ + html, + body { + font: message-box !important; + appearance: none !important; + background-color: var(--in-content-page-background) !important; + color: var(--in-content-page-color) !important; + } + body { + font-size: 15px !important; + font-weight: normal !important; + margin: 0 !important; + } + + h1 { + line-height: 1.2 !important; + } + h2 { + line-height: 1.4em !important; + } + + /* Link */ + a { + color: var(--in-content-link-color) !important; + } + a:hover, + .text-link:hover { + color: var(--in-content-link-color-hover) !important; + text-decoration: underline !important; + } + a:visited { + color: var(--in-content-link-color-visited) !important; + } + a:hover:active, + .text-link:hover:active { + color: var(--in-content-link-color-active) !important; + } + a:-moz-focusring, + .text-link:-moz-focusring { + outline: 2px solid var(--in-content-focus-outline-color) !important; + outline-offset: 1px !important; + border-radius: 4px !important; + } + + /* Button */ + button { + font: inherit; + } + button, + select, + input[type="color"] { + appearance: none !important; + min-height: 32px !important; + color: var(--in-content-button-text-color, inherit) !important; + border: 1px solid transparent !important; /* shows up in high-contrast mode */ + border-radius: var(--in-content-button-border-radius) !important; + background-color: var(--in-content-button-background) !important; + font-weight: 400 !important; + padding: var(--in-content-button-vertical-padding) var(--in-content-button-horizontal-padding) !important; + text-decoration: none !important; + margin: 4px 8px !important; + /* Ensure font-size isn't overridden by widget styling (e.g. in forms.css) */ + font-size: 1em !important; + } + button { + font-weight: 600 !important; + /* Use the same margin of other elements for the alignment */ + margin-inline: 4px !important; + min-width: 6.3em !important; + } + /* Medium and small buttons get sized to 7/14 and 6/12px padding (when adding + * the 1px border): */ + button.medium { + --in-content-button-vertical-padding: 6px; + --in-content-button-horizontal-padding: 13px; + min-height: 28px !important; + font-size: 0.95em !important; + } + button.small { + --in-content-button-vertical-padding: 5px; + --in-content-button-horizontal-padding: 11px; + min-height: 24px !important; + font-size: 0.9em !important; + } + ::-moz-focus-inner { + border: none !important; + } + button:-moz-focusring { + box-shadow: none !important; + outline: 2px solid var(--in-content-focus-outline-color) !important; + outline-offset: 2px !important; + } + button:enabled:hover, + input[type="color"]:hover { + background-color: var(--in-content-button-background-hover) !important; + color: var(--in-content-button-text-color-hover) !important; + border-color: transparent !important; + } + button:enabled:hover:active, + input[type="color"]:enabled:hover:active { + background-color: var(--in-content-button-background-active) !important; + } + button:disabled, + input[type="color"]:disabled { + opacity: 0.4 !important; + } + button[autofocus], + button[type="submit"], + button.primary { + background-color: var(--in-content-primary-button-background) !important; + color: var(--in-content-primary-button-text-color) !important; + } + button[autofocus]:enabled:hover, + button[type="submit"]:enabled:hover, + button.primary:enabled:hover { + background-color: var(--in-content-primary-button-background-hover) !important; + color: var(--in-content-primary-button-text-color-hover) !important; + } + button[autofocus]:enabled:hover:active, + button[type="submit"]:enabled:hover:active, + button.primary:enabled:hover:active { + background-color: var(--in-content-primary-button-background-active) !important; + } + + /* Checkbox */ + input[type="checkbox"] { + margin-block: 2px !important; + } + input[type="checkbox"] { + appearance: none !important; + height: 16px !important; + width: 16px !important; + border: 1px solid var(--checkbox-border-color) !important; + background-color: var(--checkbox-unchecked-bgcolor) !important; + border-radius: 2px !important; + margin-inline: 0 6px !important; + flex-shrink: 0 !important; /* avoid shrinking inside flex container */ + } + input[type="checkbox"]:enabled:hover { + background-color: var(--checkbox-unchecked-hover-bgcolor) !important; + } + input[type="checkbox"]:enabled:hover:active { + background-color: var(--checkbox-unchecked-active-bgcolor) !important; + } + input[type="checkbox"]:checked { + border-color: var(--checkbox-checked-border-color) !important; + background-color: var(--checkbox-checked-bgcolor) !important; + background-image: url("chrome://global/skin/icons/check.svg") !important; + background-position: center !important; + background-repeat: no-repeat !important; + -moz-context-properties: fill !important; + fill: currentColor !important; + color: var(--checkbox-checked-color) !important; + /* Style the button also when printing with "Print Backgrounds" unchecked */ + color-adjust: exact !important; + } + input[type="checkbox"]:enabled:checked:hover { + background-color: var(--checkbox-checked-hover-bgcolor) !important; + } + input[type="checkbox"]:enabled:checked:hover:active { + background-color: var(--checkbox-checked-active-bgcolor) !important; + } + + /* Textarea */ + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]), + textarea { + appearance: none !important; + border: 1px solid var(--in-content-box-border-color) !important; + border-radius: 4px !important; + color: inherit !important; + background-color: var(--in-content-box-background) !important; + } + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]), + textarea { + font-family: inherit !important; + font-size: inherit !important; + padding: 8px !important; + margin: 2px 4px !important; + } + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):focus, + textarea:focus, + search-textbox[focused], + tree:focus-visible, + richlistbox:focus-visible { + border-color: transparent !important; + outline: 2px solid var(--in-content-focus-outline-color) !important; + outline-offset: -1px !important; /* Prevents antialising around the corners */ + } + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):-moz-ui-invalid, + textarea:-moz-ui-invalid { + border-color: transparent !important; + outline: 2px solid var(--in-content-border-invalid) !important; + outline-offset: -1px !important; /* Prevents antialising around the corners */ + } + input:is([type="email"], [type="tel"], [type="text"], [type="password"], [type="url"], [type="number"]):disabled, + textarea:disabled, + search-textbox[disabled="true"] { + opacity: 0.4 !important; + } + + /* Table */ + table { + width: 100% !important; + } + } + + @-moz-document url-prefix("about:plugins"), + url-prefix("about:cache"), + url-prefix("about:checkerboard") { + table { + border: 1px solid var(--in-content-border-color) !important; + border-radius: 0 !important; + } + } + @-moz-document url-prefix("about:cache"), + url-prefix("about:checkerboard") { + th, td { + border: 1px solid var(--in-content-border-color) !important; + } + th { + background-color: var(--in-content-table-header-background) !important; + color: var(--in-content-table-header-color) !important; + } + } + + /*= Directory View =========================================================*/ + @-moz-document url-prefix("about:sync-log"), + url-prefix("file://") { + body { + background-color: var(--in-content-box-background) !important; + } + thead a { + color: var(--in-content-page-color) !important; + } + td ::before { + vertical-align: top !important; + } + } + + /*= about:plugins ==========================================================*/ + @-moz-document url-prefix("about:plugins") { + .notice { + background: var(--in-content-box-background) !important; + border: 1px solid var(--in-content-border-color) !important; + } + } + + /*= about:cache ============================================================*/ + @-moz-document url-prefix("about:cache") { + table { + padding: 0 !important; + } + + th, td { + padding: 4px !important; + text-align: match-parent !important; + } + } + + /*= about:checkerboard =====================================================*/ + @-moz-document url-prefix("about:checkerboard") { + #canvas { + border: 1px solid var(--in-content-border-color) !important; + } + #excludePageFromZoom { + vertical-align: bottom !important; + } + } + + /*= about:memory ===========================================================*/ + @-moz-document url-prefix("about:memory") { + .opsRow, + .section { + background-color: var(--in-content-box-background) !important; + color: var(--in-content-page-color) !important; + } + .opsRowLabel input { + vertical-align: bottom !important; + } + } } From 33752d99f9eb9c60958c8cc2e330cbe2d0675d14 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Thu, 15 Jul 2021 21:41:23 +1200 Subject: [PATCH 43/75] chore(installer-pwsh): replace tabs with spaces --- Install.ps1 | 52 ++++++++++++++++++++++++++-------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 9730f27..a7eb91f 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -83,9 +83,9 @@ function Check-LeptonInstallFiles { param ([string[]]$Files) foreach ($item in $Files) { - if (-not (Test-Path $item)) { - return $false - } + if (-not (Test-Path $item)) { + return $false + } } return $true @@ -105,9 +105,9 @@ function Get-LeptonInstallType { $IsTypeRelease = Check-LeptonInstallFiles $ReleaseFiles if ($IsTypeLocal) { - return $InstallType.Local + return $InstallType.Local } elseif ($IsTypeRelease) { - return $InstallType.Release + return $InstallType.Release } return $InstallType.Network @@ -123,14 +123,14 @@ function Select-LeptonDistributionPrompt { $SelectedBranch = "" while ($SelectedBranch -eq "") { - $SelectedInput = Read-Host "Enter a distribution number (1, 2, 3)" - - switch ($SelectedInput) { - "1" { $SelectedBranch = "master"; break } - "2" { $SelectedBranch = "photon-style"; break } - "3" { $SelectedBranch = "proton-style"; break } - default { Write-Host "Invalid option, reselect please." } - } + $SelectedInput = Read-Host "Enter a distribution number (1, 2, 3)" + + switch ($SelectedInput) { + "1" { $SelectedBranch = "master"; break } + "2" { $SelectedBranch = "photon-style"; break } + "3" { $SelectedBranch = "proton-style"; break } + default { Write-Host "Invalid option, reselect please." } + } } Write-Host "" @@ -144,22 +144,22 @@ function Select-LeptonDistribution { $FoundInstallType = Get-LeptonInstallType switch ($FoundInstallType) { - $InstallType.Release { break } - $InstallType.Network { $SelectedDistribution = Select-LeptonDistributionPrompt; break } - $InstallType.Local { - $SelectedDistribution = Select-LeptonDistributionPrompt - $GitInstalled=$((Get-Command -ErrorAction SilentlyContinue "git").Length -eq 0) - if ($GitInstalled && Test-Path ".git" && $PSCmdlet.ShouldProcess(".git")) { - git checkout $LeptonBranchName - } - break - } - default { throw } + $InstallType.Release { break } + $InstallType.Network { $SelectedDistribution = Select-LeptonDistributionPrompt; break } + $InstallType.Local { + $SelectedDistribution = Select-LeptonDistributionPrompt + $GitInstalled=$((Get-Command -ErrorAction SilentlyContinue "git").Length -eq 0) + if ($GitInstalled && Test-Path ".git" && $PSCmdlet.ShouldProcess(".git")) { + git checkout $LeptonBranchName + } + break + } + default { throw } } return @{ - Type = $InstallType.Network; - Dist = $SelectedDistribution; + Type = $InstallType.Network; + Dist = $SelectedDistribution; } } From 1cc4cdb2e845b155a60819f46f5ef1fc3f61a25b Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Thu, 15 Jul 2021 21:44:07 +1200 Subject: [PATCH 44/75] feat(installer-pwsh): check Firefox installation directories --- Install.ps1 | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index a7eb91f..bf9a958 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -60,6 +60,7 @@ param( # Constants $PSMinSupportedVersion = 2 +$DefaultFirefoxProfilePaths = @("~/AppData/Roaming/Mozilla/Firefox/") function Check-Help { # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' @@ -163,6 +164,38 @@ function Select-LeptonDistribution { } } +function Get-TestedPaths { + param ([string[]]$Paths) + + $FoundPaths = @() + foreach ($pathItem in $Paths) { + if ($Test-Path -Path $pathItem) { + $FoundPaths += $pathItem + } + } + + return $FoundPaths +} + +function Check-FirefoxProfileDirectories { + param ([string]$CustomProfilePath) + + Write-Host -Nonewline "Checking Firefox profile directories... " + + $FirefoxProfilePaths = $DefaultFirefoxProfilePaths + $FirefoxProfilePaths += $CustomProfilePath + + $FirefoxInstalls = Get-TestedPaths -Paths $FirefoxProfilePaths + if ($FirefoxInstalls.Length -eq 0) { + Write-Host "[not found]" + Write-Error "Unable to find Firefox installations" + exit -1 + } + + Write-Host "[found]" + return $FirefoxInstalls +} + function Check-FirefoxProfileDirectories { param ([string]$CustomProfilePath) # TODO: stub @@ -190,7 +223,7 @@ function Install-Lepton { $SelectedDistribution = Select-LeptonDistribution # TODO: check profile director{y,ies} (including custom) - #$InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath + $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath # TODO: check profile ini files exists #Check-FirefoxProfileConfigurations $InstallationDirectories From 34601bd7eb6f9fcffb51a520e895d644caba336b Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Thu, 15 Jul 2021 21:46:39 +1200 Subject: [PATCH 45/75] feat(installer-pwsh): validate profiles.ini files exist --- Install.ps1 | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index bf9a958..809ca3f 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -61,6 +61,7 @@ param( # Constants $PSMinSupportedVersion = 2 $DefaultFirefoxProfilePaths = @("~/AppData/Roaming/Mozilla/Firefox/") +$ProfileInfoFile = "profiles.ini" function Check-Help { # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' @@ -196,9 +197,18 @@ function Check-FirefoxProfileDirectories { return $FirefoxInstalls } -function Check-FirefoxProfileDirectories { - param ([string]$CustomProfilePath) - # TODO: stub +function Check-FirefoxProfileConfigurations { + param ([string[]]$InstallDirectories) + Write-Host -Nonewline "Checking profile info files... " + + foreach ($Install in $InstallDirectories) { + if (-not ($Test-Path -Path (-Join $Install, "\", $ProfileInfoFile))) { + Write-Error "Unable to find $ProfileInfoFile for install $Install" + exit -1 + } + } + + Write-Host "[found]" } function Check-FirefoxProfileConfigurations { @@ -226,7 +236,7 @@ function Install-Lepton { $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath # TODO: check profile ini files exists - #Check-FirefoxProfileConfigurations $InstallationDirectories + Check-FirefoxProfileConfigurations $InstallationDirectories # TODO: read profile paths in from profiles.ini files #$AsboluteProfilePaths = Get-FirefoxProfilePaths From 6cddce4dcf00debfbc6361399f1b50e4406111a3 Mon Sep 17 00:00:00 2001 From: James Upjohn Date: Thu, 15 Jul 2021 21:47:37 +1200 Subject: [PATCH 46/75] feat(installer-pwsh): extract profile paths from profiles.ini files --- Install.ps1 | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 809ca3f..7d0e07e 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -211,13 +211,23 @@ function Check-FirefoxProfileConfigurations { Write-Host "[found]" } -function Check-FirefoxProfileConfigurations { - param ([string[]]$InstallDirectories) - # TODO: stub -} - function Get-FirefoxProfilePaths { - # TODO: stub + param ([string[]]$InstallDirectories) + + Write-Host -Nonewline "Checking path information for profiles... " + + $AbsoluteProfiles = @() + + foreach ($Directory in $InstallDirectories) { + $InfoFileContents = (Get-Content -Path (-Join $Directory, "\", $ProfileInfoFile)) -Split "\n" + $PathNames = $InfoFileContents + .Where({$_ -Match "Path=.+"}) + .ForEach({$_ -Replace "Path=",""}) + .ForEach({$AbsoluteProfiles += (-Join $Directory, "\", $_)}) + } + + # TODO: error handling + return $AbsoluteProfiles } function Install-LeptonToProfiles { @@ -239,7 +249,7 @@ function Install-Lepton { Check-FirefoxProfileConfigurations $InstallationDirectories # TODO: read profile paths in from profiles.ini files - #$AsboluteProfilePaths = Get-FirefoxProfilePaths + $AsboluteProfilePaths = Get-FirefoxProfilePaths # TODO: install if in install mode #Install-LeptonToProfiles $AbsoluteProfilePaths From 729bc93bb4dd0c5f58ab8f6b34890a6b516ef4ac Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 16 Jul 2021 10:57:23 +0900 Subject: [PATCH 47/75] Fix: Fully Theme Mode - Default Colors --- userChrome.css | 174 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 166 insertions(+), 8 deletions(-) diff --git a/userChrome.css b/userChrome.css index 70e343e..3739c5b 100644 --- a/userChrome.css +++ b/userChrome.css @@ -92,30 +92,188 @@ } } - /* Fully Theme Mode *********************************************************/ + /** Fully Theme Mode ********************************************************/ /* Default Themes https://github.com/mozilla/gecko-dev/blob/master/toolkit/mozapps/extensions/default-theme/manifest.json https://github.com/mozilla/gecko-dev/blob/master/browser/themes/addons/light/manifest.json https://github.com/mozilla/gecko-dev/blob/master/browser/themes/addons/dark/manifest.json */ + /*= Default Colors - Hardcorded ============================================*/ + /* Based on chrome://global/skin/in-content/common.css */ + :host, + :root { + --in-content-page-color: rgb(21, 20, 26); + --in-content-page-background: #fff; + --in-content-text-color: var(--in-content-page-color); + --in-content-deemphasized-text: rgb(91, 91, 102); + --in-content-box-background: #fff; + --in-content-box-background-odd: rgba(12, 12, 13, 0.05); /* grey 90 a05 */ + --in-content-box-border-color: color-mix(in srgb, currentColor 41%, transparent); + --in-content-box-info-background: #f0f0f4; + --in-content-item-hover: color-mix(in srgb, var(--in-content-primary-button-background) 20%, transparent); + --in-content-item-hover-text: var(--in-content-page-color); + --in-content-item-selected: var(--in-content-primary-button-background); + --in-content-item-selected-text: var(--in-content-primary-button-text-color); + --in-content-icon-color: rgb(91,91,102); + --in-content-accent-color: #0a84ff; + --in-content-accent-color-active: #0060df; + --in-content-border-hover: var(--grey-90-a50); + --in-content-border-invalid: var(--red-50); + --in-content-border-color: #d7d7db; + --in-content-error-text-color: #c50042; + --in-content-link-color: var(--blue-60); + --in-content-link-color-hover: var(--blue-70); + --in-content-link-color-active: var(--blue-80); + --in-content-link-color-visited: var(--blue-60); + /* button background states are also used for checkboxes and radiobuttons */ + --in-content-button-text-color: var(--in-content-text-color); + --in-content-button-text-color-hover: var(--in-content-text-color); + --in-content-button-background: rgba(207,207,216,.33); + --in-content-button-background-hover: rgba(207,207,216,.66); + --in-content-button-background-active: rgb(207,207,216); + --in-content-primary-button-text-color: rgb(251,251,254); + --in-content-primary-button-text-color-hover: var(--in-content-primary-button-text-color); + --in-content-primary-button-background: #0061e0; + --in-content-primary-button-background-hover: #0250bb; + --in-content-primary-button-background-active: #053e94; + --in-content-danger-button-background: #e22850; + --in-content-danger-button-background-hover: #c50042; + --in-content-danger-button-background-active: #810220; + --in-content-focus-outline-color: var(--in-content-primary-button-background); + + /* Note: 1px smaller than we want because we have a 1px transparent border. */ + /* Once proton ships, these can probably stop being variables. */ + --in-content-button-border-radius: 4px; + --in-content-button-horizontal-padding: 15px; + --in-content-button-vertical-padding: 7px; + + --in-content-table-background: #f8f8fa; + --in-content-table-border-dark-color: #d1d1d1; + --in-content-table-header-background: #0a84ff; + --in-content-table-header-color: #ffffff; + --in-content-sidebar-width: 240px; + + --dialog-warning-text-color: var(--red-60); + + --checkbox-border-color: var(--in-content-box-border-color); + --checkbox-unchecked-bgcolor: var(--in-content-button-background); + --checkbox-unchecked-hover-bgcolor: var(--in-content-button-background-hover); + --checkbox-unchecked-active-bgcolor: var(--in-content-button-background-active); + --checkbox-checked-bgcolor: var(--in-content-primary-button-background); + --checkbox-checked-color: var(--in-content-primary-button-text-color); + --checkbox-checked-border-color: transparent; + --checkbox-checked-hover-bgcolor: var(--in-content-primary-button-background-hover); + --checkbox-checked-active-bgcolor: var(--in-content-primary-button-background-active); + --blue-40: #45a1ff; + --blue-50: #0a84ff; + --blue-60: #0060df; + --blue-70: #003eaa; + --blue-80: #002275; + --grey-30: #d7d7db; + --grey-60: #4a4a4f; + --grey-90-a10: rgba(12, 12, 13, 0.1); + --grey-90-a20: rgba(12, 12, 13, 0.2); + --grey-90-a30: rgba(12, 12, 13, 0.3); + --grey-90-a50: rgba(12, 12, 13, 0.5); + --grey-90-a60: rgba(12, 12, 13, 0.6); + --green-50: #30e60b; + --green-60: #12bc00; + --green-70: #058b00; + --green-80: #006504; + --green-90: #003706; + --orange-50: #ff9400; + --red-40: #ff4f5e; + --red-50: #ff0039; + --red-60: #d70022; + --red-70: #a4000f; + --red-80: #5a0002; + --red-90: #3e0200; + --yellow-50: #ffe900; + --yellow-60: #d7b600; + --yellow-60-a30: rgba(215, 182, 0, 0.3); + --yellow-70: #a47f00; + --yellow-80: #715100; + --yellow-90: #3e2800; + + --shadow-10: 0 1px 4px var(--grey-90-a10); + --shadow-30: 0 4px 16px var(--grey-90-a10); + + --card-padding: 16px; + --card-shadow: var(--shadow-10); + --card-outline-color: var(--grey-30); + --card-shadow-hover: var(--card-shadow), 0 0 0 5px var(--card-outline-color); + } + + @media (-moz-toolbar-prefers-color-scheme: dark) { + :host, + :root { + /* Keep these in sync with layout/base/PresShell.cpp, and plaintext.css */ + --in-content-page-background: rgb(28,27,34); + --in-content-page-color: rgb(251,251,254); + --in-content-deemphasized-text: rgb(191,191,201); + + --in-content-box-background: rgb(35, 34, 43); + --in-content-box-background-odd: rgba(249,249,250,0.05); + --in-content-box-info-background: rgba(249,249,250,0.15); + + --in-content-border-color: rgba(249,249,250,0.2); + --in-content-border-hover: rgba(249,249,250,0.3); + --in-content-border-invalid: rgb(255,132,139); + + --in-content-error-text-color: #FF9AA2; + + --in-content-button-background: rgb(43,42,51); + --in-content-button-background-hover: rgb(82,82,94); + --in-content-button-background-active: rgb(91,91,102); + --in-content-icon-color: rgb(251,251,254); + + --in-content-primary-button-text-color: rgb(43,42,51); + --in-content-primary-button-background: rgb(0,221,255); + --in-content-primary-button-background-hover: rgb(128,235,255); + --in-content-primary-button-background-active: rgb(170,242,255); + + --in-content-danger-button-background: #ff848b; + --in-content-danger-button-background-hover: #ffbdc5; + --in-content-danger-button-background-active: #ffdfe7; + + --in-content-table-background: rgb(35, 34, 43); + --in-content-table-border-dark-color: rgba(249,249,250,0.2); + --in-content-table-header-background: rgb(5, 64, 150); + --in-content-table-header-color: var(--in-content-page-color); + + --in-content-accent-color: var(--in-content-primary-button-background); + --in-content-accent-color-active: var(--in-content-primary-button-background-hover); + --in-content-link-color: var(--in-content-primary-button-background); + --in-content-link-color-hover: var(--in-content-primary-button-background-hover); + --in-content-link-color-active: var(--in-content-primary-button-background-active); + --in-content-link-color-visited: var(--in-content-link-color); + + --card-outline-color: var(--grey-60); + + --dialog-warning-text-color: var(--red-40); + + scrollbar-color: rgba(249,249,250,.4) rgba(20,20,25,.3); + } + } + /*== Menu color ===========================================================*/ :root, menupopup { /* is same as toolbar color https://github.com/mozilla/gecko-dev/blob/master/toolkit/themes/windows/global/global.css#L17-L67 */ - --menu-color: var(--toolbar-color) !important; - --menu-background-color: var(--toolbar-bgcolor) !important; + --menu-color: var(--toolbar-color, var(--in-content-page-color)) !important; + --menu-background-color: var(--toolbar-bgcolor, var(--in-content-button-background)) !important; - --menu-border-color: var(--toolbarbutton-active-background, var(--button-active-bgcolor)) !important; - --menuitem-hover-background-color: var(--toolbarbutton-hover-background, var(--button-hover-bgcolor)) !important; + --menu-border-color: var(--toolbarbutton-active-background, var(--button-active-bgcolor, var(--card-outline-color))) !important; + --menuitem-hover-background-color: var(--toolbarbutton-hover-background, var(--button-hover-bgcolor, var(--in-content-button-background-hover))) !important; - --menu-disabled-color: color-mix(in srgb, var(--toolbar-color) 40%, transparent) !important; + --menu-disabled-color: color-mix(in srgb, var(--menu-color) 40%, transparent) !important; --menuitem-disabled-hover-background-color: color-mix(in srgb, var(--menuitem-hover-background-color) 40%, transparent) !important; } /* Fallback background */ menupopup { - background-color: var(--lwt-accent-color) !important; + background-color: var(--lwt-accent-color, var(--in-content-page-background)) !important; } /* Fully Dark Mode **********************************************************/ @@ -124,7 +282,7 @@ #tabbrowser-tabpanels, browser[type=content-primary], browser[type=content] > html { - background: var(--lwt-accent-color) !important; + background: var(--in-content-page-background) !important; } /*= Notification ===========================================================*/ From bbfbbea45cebf48792d05d583f346b3787397f3d Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 16 Jul 2021 10:59:29 +0900 Subject: [PATCH 48/75] Add: Fully Dark Mode - Download Popup --- userChrome.css | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/userChrome.css b/userChrome.css index 3739c5b..b4163ee 100644 --- a/userChrome.css +++ b/userChrome.css @@ -349,6 +349,53 @@ } } + /*= Downloads ==============================================================*/ + @-moz-document url("chrome://mozapps/content/downloads/unknownContentType.xhtml") { + :root { + --in-content-page-background: #42414d; + } + #unknownContentType { + color: var(--in-content-page-color) !important; + background-color: var(--in-content-page-background) !important; + } + + button { + -moz-appearance: none !important; + color: var(--in-content-button-text-color) !important; + background-color: var(--in-content-button-background) !important; + font: inherit; + font-size: 1em !important; + font-weight: 600 !important; + min-height: 32px !important; + border: 1px solid transparent !important; /* shows up in high-contrast mode */ + border-radius: var(--in-content-button-border-radius) !important; + padding: var(--in-content-button-vertical-padding) var(--in-content-button-horizontal-padding) !important; + + min-height: 32px !important; + /* Use the same margin of other elements for the alignment */ + margin-inline: 4px !important; + min-width: 6.3em !important; + } + button:-moz-focusring { + box-shadow: none !important; + outline: 2px solid var(--in-content-focus-outline-color) !important; + outline-offset: 2px !important; + } + button:not([disabled="true"]):hover { + background-color: var(--in-content-button-background-hover) !important; + color: var(--in-content-button-text-color-hover) !important; + border-color: transparent !important; + } + button[open], + button[open]:hover { + background-color: var(--in-content-button-background-active); + } + button[disabled="true"], + menulist[disabled="true"] { + opacity: 0.4; + } + } + /** Reduce Padding **********************************************************/ /*= Root - Reduce Padding ==================================================*/ :root { From 8cebf58c75292259847bff7f3f65980b820698be Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Sun, 18 Jul 2021 02:13:55 +0900 Subject: [PATCH 49/75] Add: Fully Dark Mode - Accounts.com --- userContent.css | 137 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 1 deletion(-) diff --git a/userContent.css b/userContent.css index d52d930..c2dc139 100644 --- a/userContent.css +++ b/userContent.css @@ -563,11 +563,146 @@ .card--product, .card--topic, .card--article { - box-shadow: 0 5px 10px -3px rgba(249, 249, 250, .12) , + box-shadow: 0 5px 10px -3px rgba(249, 249, 250, .12), 0 3px 16px 2px rgba(91, 91, 102, .12), 0 8px 12px 1px rgba(82, 82, 94, .04) !important; } } + + /*= Accounts.com ===========================================================*/ + @-moz-document url-prefix("https://accounts.firefox.com") { + /* Basic */ + body { + color: var(--in-content-page-color) !important; + background: var(--in-content-page-background) !important; + } + .button.primary-button, + .button[type="submit"]:not(.secondary-button), + .settings-button.primary-button, + .settings-button[type="submit"]:not(.secondary-button), + button.primary-button, button[type="submit"]:not(.secondary-button) { + color: var(--in-content-primary-button-text-color) !important; + background: var(--in-content-primary-button-background) !important; + } + + /* Text */ + header h1, + .info, + .info a, + .faint a:hover, + .cta-neutral:hover { + color: var(--in-content-page-color) !important; + } + .links a, + .link-blue, + .text-blue-500 { + color: var(--in-content-link-color) !important; + } + .link-blue:hover { + color: var(--in-content-link-color-hover) !important; + } + .input-row input[type="email"], + .input-row input[type="number"], + .input-row input[type="password"], + .input-row input[type="tel"], + .input-row input[type="text"], + .input-row input::placeholder, + .firefox-family-services > ul > .firefox-service, + .faint, + .faint a, + .text-grey-400 { + color: var(--in-content-deemphasized-text) !important; + } + + + /* Background */ + .password-row .show-password-label { + background-color: unset !important; + } + #main-content, + .firefox-family-services, + .input-row input[type="email"], + .input-row input[type="number"], + .input-row input[type="password"], + .input-row input[type="tel"], + .input-row input[type="text"], + .password-row .show-password-label, + header, + .bg-white:not(nav) { + background: var(--in-content-box-background) !important; + } + #suggest-sync, + .cta-neutral { + background: var(--in-content-button-background) !important; + } + .cta-neutral:hover, + .bg-grey-50:hover, + .hover\:bg-grey-100:hover { + background: var(--in-content-button-background-hover) !important; + } + .hover\:bg-grey-200:hover { + background: var(--in-content-button-background-active) !important; + } + .button.primary-button:hover:enabled, + .button[type="submit"]:not(.secondary-button):hover:enabled, + .settings-button.primary-button:hover:enabled, + .settings-button[type="submit"]:not(.secondary-button):hover:enabled, + button.primary-button:hover:enabled, + button[type="submit"]:not(.secondary-button):hover:enabled { + background: var(--in-content-primary-button-background-hover) !important; + } + .tooltip, + .tooltip::before { + background: var(--in-content-danger-button-background) !important; + } + + /* Fill */ + .dismiss, + #about-mozilla, + .show-password-label, + footer a[data-testid="link-mozilla"] { + filter: invert(95%) !important; + } + header button svg, + header .rounded svg, + #service svg { + filter: brightness(15) !important; + } + button.relative, + #fxa-settings nav svg{ + filter: brightness(2) !important; + } + + /* Others */ + .input-row input[type="email"], + .input-row input[type="number"], + .input-row input[type="password"], + .input-row input[type="tel"], + .input-row input[type="text"], + .unit-row-hr + .border-grey-100 { + border-color: var(--in-content-border-color) !important; + } + .input-row input[type="email"]:hover, + .input-row input[type="number"]:hover, + .input-row input[type="password"]:hover, + .input-row input[type="tel"]:hover, + .input-row input[type="text"]:hover { + border-color: var(--in-content-border-hover) !important; + } + #main-content { + box-shadow: 0 12px 18px 2px rgba(249, 249, 250, .12) , + 0 6px 22px 4px rgba(91, 91, 102, .12), + 0 6px 10px -4px rgba(82, 82, 94, .04) !important; + } + .input-row input[type="email"]:focus, + .input-row input[type="number"]:focus, + .input-row input[type="password"]:focus, + .input-row input[type="tel"]:focus, + .input-row input[type="text"]:focus { + box-shadow: 0 0 0 3px color-mix(in srgb, var(--in-content-primary-button-background-hover) 80%, transparent) !important; + } + } } /** Fully Proton Mode *******************************************************/ From f457ce8620f4addc2b48b949befbb2a71d238fc3 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Sun, 18 Jul 2021 02:14:33 +0900 Subject: [PATCH 50/75] Doc: CREDITS for darkmode --- CREDITS | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CREDITS b/CREDITS index 23500ed..1a5a002 100644 --- a/CREDITS +++ b/CREDITS @@ -38,10 +38,18 @@ N: Multi-Account-Containers W: https://github.com/mozilla/multi-account-containers L: MPL 2.0 +N: Quantum Nox Firefox Dark Full Theme +W: https://github.com/Izheil/Quantum-Nox-Firefox-Dark-Full-Theme +L: MPL 2.0 + N: quietfox W: https://github.com/coekuss/quietfox L: MIT +N: ShadowFox +W: https://github.com/overdodactyl/ShadowFox +L: MIT + N: SVG Repo E: info@svgrepo.com W: https://www.svgrepo.com From f9eabf3b292560a3d7bf9ad572740284d9f1d3ef Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 20 Jul 2021 09:34:52 +0900 Subject: [PATCH 51/75] Add: Installer - Update mode --- install.sh | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/install.sh b/install.sh index 4bdbe21..dfcca58 100755 --- a/install.sh +++ b/install.sh @@ -437,6 +437,7 @@ select_profile() { #** Install ******************************************************************** #== Install Types ============================================================== +updateMode="" leptonBranch="master" select_distribution() { local selectedDistribution="" @@ -446,6 +447,7 @@ select_distribution() { "Original") leptonBranch="master"; break;; "Photon-Style") leptonBranch="photon-style"; break;; "Proton-Style") leptonBranch="proton-style"; break;; + "Update") updateMode="true"; break;; *) echo "Invalid option, reselect please.";; esac done @@ -696,9 +698,7 @@ update_profile() { git --git-dir "${LEPTONGITPATH}" pull --no-edit elif [ "${Type}" == "Local" ] || [ "${Type}" == "Release" ]; then check_chrome_exist - if [ ! -d "chrome" ]; then - clone_lepton - fi + clone_lepton firefoxProfilePaths=("${Path}") copy_lepton @@ -712,7 +712,6 @@ update_profile() { local Ver=$(git --git-dir "${LEPTONINFOFILE}" describe --tags --abbrev=0) git --git-dir "${LEPTONGITPATH}" checkout "tags/${Ver}" fi - check_chrome_restore else lepton_error_message "Unable to find update type, ${Type}" fi @@ -725,7 +724,6 @@ update_profile() { #** Main *********************************************************************** install_lepton() { - local updateMode="" local profileDir="" local profileName="" @@ -751,20 +749,17 @@ install_lepton() { check_profile_dir "${profileDir}" check_profile_ini update_profile_paths + write_lepton_info # Install Mode - if [ ! "${updateMode}" == true ]; then + if [ "${updateMode}" == true ]; then + update_profile + else # Install Mode select_profile "${profileName}" install_profile fi - # write_lepton_info - - ## Update Mode - # if [ ! "${updateMode}" == true ]; then - # update_profile - # write_lepton_info - # fi + write_lepton_info } install_lepton "$@" From ac5860e5cbf88b23417e1c5db9e2ea4874d7472f Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 20 Jul 2021 10:36:33 +0900 Subject: [PATCH 52/75] Clean: Installer - Code order --- install.sh | 198 ++++++++++++++++++++++++++--------------------------- 1 file changed, 99 insertions(+), 99 deletions(-) diff --git a/install.sh b/install.sh index dfcca58..8fb5cd7 100755 --- a/install.sh +++ b/install.sh @@ -435,6 +435,105 @@ select_profile() { fi } +#** Lepton Info File *********************************************************** +#== Info File format & update policy =========================================== +## `LEPTON` file format +# If this file exist in same directory as the `userChrome.css` file, +# it is recognized as the "Lepton" installation directory. +# Branch=master | photon-style | proton-style +# Ver= | | [NULL] + +## `lepton.ini` file Format +# [Profile Name] +# Type=Local | Release | Git +# Branch=master | photon-style | proton-style +# Ver= | | [NULL] +# Path= + +## Update Policy +# Type +# - Local(unknown): force latest commit update +# - Release(): force latest tag update +# - Git: latest commit update + +#== Lepton Info ================================================================ +LEPTONINFOFILE="lepton.ini" +check_lepton_ini() { + for profileDir in "${firefoxProfileDirPaths[@]}"; do + if [ ! -f "${profileDir}/${LEPTONINFOFILE}" ]; then + lepton_error_message "Unable to find ${LEPTONINFOFILE} at ${profileDir}" + fi + done + + lepton_ok_message "Lepton info file found" +} + +#== Create info file =========================================================== +# We should always create a new one, as it also takes into account the possibility of setting it manually. +# Updates happen infrequently, so the creation overhead is less significant. + +CHROMEINFOFILE="LEPTON" +write_lepton_info() { + # Init info + local output="" + local prevDir=$(dirname "${firefoxProfilePaths[0]}") + local latestPath="${firefoxProfilePaths[${#firefoxProfilePaths[@]} - 1]}" + for profilePath in "${firefoxProfilePaths[@]}"; do + local LEPTONINFOPATH="${profilePath}/chrome/${CHROMEINFOFILE}" + local LEPTONGITPATH="${profilePath}/chrome/.git" + + # Profile info + local Type="" + local Ver="" + local Branch="" + local Path="" + if [ -f "${LEPTONINFOPATH}" ]; then + if [ -d "${LEPTONGITPATH}" ]; then + Type="Git" + Ver=$( git --git-dir "${LEPTONGITPATH}" rev-parse HEAD) + Branch=$(git --git-dir "${LEPTONGITPATH}" rev-parse --abbrev-ref HEAD) + else + Type=$( get_ini_value "${LEPTONINFOPATH}" "TYPE" ) + Ver=$( get_ini_value "${LEPTONINFOPATH}" "Ver" ) + Branch=$(get_ini_value "${LEPTONINFOPATH}" "Branch") + + if [ "${Type}" == "" ]; then + Type="Local" + fi + fi + + Path="${profilePath}" + fi + + # Flushing + local profileDir=$(dirname "${profilePath}") + local profileName=$(basename "${profilePath}") + if [ "${prevDir}" != "${profileDir}" ]; then + write_file "${prevDir}/${LEPTONINFOFILE}" "${output}" + output="" + fi + + # Make output contents + if [ -f "${LEPTONINFOPATH}" ]; then + output="${output}$(set_ini_section ${profileName})" + fi + for key in "Type" "Branch" "Ver" "Path"; do + eval "local value=\${${key}}" + output="${output}$(set_ini_value ${key} ${value})" + done + + # Latest element flushing + if [ "${profilePath}" == "${latestPath}" ]; then + write_file "${profileDir}/${LEPTONINFOFILE}" "${output}" + fi + prevDir="${profileDir}" + done + + # Verify + check_lepton_ini + lepton_ok_message "Lepton info file created" +} + #** Install ******************************************************************** #== Install Types ============================================================== updateMode="" @@ -581,105 +680,6 @@ install_profile() { lepton_ok_message "End install" } -#** Lepton Info File *********************************************************** -#== Info File format & update policy =========================================== -## `LEPTON` file format -# If this file exist in same directory as the `userChrome.css` file, -# it is recognized as the "Lepton" installation directory. -# Branch=master | photon-style | proton-style -# Ver= | | [NULL] - -## `lepton.ini` file Format -# [Profile Name] -# Type=Local | Release | Git -# Branch=master | photon-style | proton-style -# Ver= | | [NULL] -# Path= - -## Update Policy -# Type -# - Local(unknown): force latest commit update -# - Release(): force latest tag update -# - Git: latest commit update - -#== Lepton Info ================================================================ -LEPTONINFOFILE="lepton.ini" -check_lepton_ini() { - for profileDir in "${firefoxProfileDirPaths[@]}"; do - if [ ! -f "${profileDir}/${LEPTONINFOFILE}" ]; then - lepton_error_message "Unable to find ${LEPTONINFOFILE} at ${profileDir}" - fi - done - - lepton_ok_message "Lepton info file found" -} - -#== Create info file =========================================================== -# We should always create a new one, as it also takes into account the possibility of setting it manually. -# Updates happen infrequently, so the creation overhead is less significant. - -CHROMEINFOFILE="LEPTON" -write_lepton_info() { - # Init info - local output="" - local prevDir=$(dirname "${firefoxProfilePaths[0]}") - local latestPath="${firefoxProfilePaths[${#firefoxProfilePaths[@]} - 1]}" - for profilePath in "${firefoxProfilePaths[@]}"; do - local LEPTONINFOPATH="${profilePath}/chrome/${CHROMEINFOFILE}" - local LEPTONGITPATH="${profilePath}/chrome/.git" - - # Profile info - local Type="" - local Ver="" - local Branch="" - local Path="" - if [ -f "${LEPTONINFOPATH}" ]; then - if [ -d "${LEPTONGITPATH}" ]; then - Type="Git" - Ver=$( git --git-dir "${LEPTONGITPATH}" rev-parse HEAD) - Branch=$(git --git-dir "${LEPTONGITPATH}" rev-parse --abbrev-ref HEAD) - else - Type=$( get_ini_value "${LEPTONINFOPATH}" "TYPE" ) - Ver=$( get_ini_value "${LEPTONINFOPATH}" "Ver" ) - Branch=$(get_ini_value "${LEPTONINFOPATH}" "Branch") - - if [ "${Type}" == "" ]; then - Type="Local" - fi - fi - - Path="${profilePath}" - fi - - # Flushing - local profileDir=$(dirname "${profilePath}") - local profileName=$(basename "${profilePath}") - if [ "${prevDir}" != "${profileDir}" ]; then - write_file "${prevDir}/${LEPTONINFOFILE}" "${output}" - output="" - fi - - # Make output contents - if [ -f "${LEPTONINFOPATH}" ]; then - output="${output}$(set_ini_section ${profileName})" - fi - for key in "Type" "Branch" "Ver" "Path"; do - eval "local value=\${${key}}" - output="${output}$(set_ini_value ${key} ${value})" - done - - # Latest element flushing - if [ "${profilePath}" == "${latestPath}" ]; then - write_file "${profileDir}/${LEPTONINFOFILE}" "${output}" - fi - prevDir="${profileDir}" - done - - # Verify - check_lepton_ini - lepton_ok_message "Lepton info file created" -} - #** Update ********************************************************************* update_profile() { check_git From 4c6b4ea5c8e4e60ce1fa4b654b4ab1d1aa1eaec4 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 20 Jul 2021 10:52:33 +0900 Subject: [PATCH 53/75] Fix: Installer - Selection list --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 8fb5cd7..581b9e4 100755 --- a/install.sh +++ b/install.sh @@ -540,7 +540,7 @@ updateMode="" leptonBranch="master" select_distribution() { local selectedDistribution="" - select distribution in "Original(default)" "Photon-Style" "Proton Style"; do + select distribution in "Original(default)" "Photon-Style" "Proton-Style" "Update"; do selectedDistribution="${distribution}" case "${distribution}" in "Original") leptonBranch="master"; break;; From fd65de685581d401ebeff37d67d953e80214c9bf Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 20 Jul 2021 12:10:36 +0900 Subject: [PATCH 54/75] Add: Installer - Check for librewolf profile dir #123 --- install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install.sh b/install.sh index 581b9e4..38680de 100755 --- a/install.sh +++ b/install.sh @@ -336,7 +336,9 @@ multiselect() { firefoxProfileDirPaths=( "${HOME}/.mozilla/firefox" "${HOME}/.var/app/org.mozilla.firefox/.mozilla/firefox" + "${HOME}/.librewolf/" "${HOME}/Library/Application Support/Firefox" + "${HOME}/Library/Application Support/LibreWolf" ) check_profile_dir() { From c688cdb90bd79eb09d0e37ec425e9ce56b32e647 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 20 Jul 2021 14:12:48 +0900 Subject: [PATCH 55/75] Fix: Installer - Update section to array --- install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 38680de..0807da5 100755 --- a/install.sh +++ b/install.sh @@ -687,7 +687,7 @@ update_profile() { check_git for profileDir in "${firefoxProfileDirPaths[@]}"; do local LEPTONINFOPATH="${profileDir}/${LEPTONINFOFILE}" - local sections=$(get_ini_section "${LEPTONINFOPATH}") + local sections=($(get_ini_section "${LEPTONINFOPATH}")) if [ ! -z "${sections}" ]; then for section in "${sections[@]}"; do local Type=$( get_ini_value "${LEPTONINFOPATH}" "Type" "${section}") @@ -715,7 +715,7 @@ update_profile() { git --git-dir "${LEPTONGITPATH}" checkout "tags/${Ver}" fi else - lepton_error_message "Unable to find update type, ${Type}" + lepton_error_message "Unable to find update type, ${Type} at ${section}" fi done fi From 539206d06ee1687caa98798da0abcbf2c5872419 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Wed, 21 Jul 2021 11:44:25 +0900 Subject: [PATCH 56/75] Clean: Installer - Indent --- Install.ps1 | 264 ++++++++++++++++++++++++++-------------------------- 1 file changed, 132 insertions(+), 132 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 7d0e07e..a580856 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -42,20 +42,21 @@ https://github.com/black7375/Firefox-UI-Fix#readme #> +#** Main *********************************************************************** [CmdletBinding( - SupportsShouldProcess = $true, - PositionalBinding = $false + SupportsShouldProcess = $true, + PositionalBinding = $false )] param( - [Alias("u")] - [Switch]$Update=$false, - [Alias("f")] - [string]$ProfilePath, - [Alias("p")] - [string]$ProfileName, - [Alias("h")] - [Switch]$Help=$false + [Alias("u")] + [Switch]$Update=$false, + [Alias("f")] + [string]$ProfilePath, + [Alias("p")] + [string]$ProfileName, + [Alias("h")] + [Switch]$Help=$false ) # Constants @@ -64,197 +65,196 @@ $DefaultFirefoxProfilePaths = @("~/AppData/Roaming/Mozilla/Firefox/") $ProfileInfoFile = "profiles.ini" function Check-Help { - # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' - if ($Help) { - Get-Help "$PSCommandPath" - exit 0 - } + # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' + if ($Help) { + Get-Help "$PSCommandPath" + exit 0 + } } function Verify-PowerShellVersion { - $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion) + $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion) - Write-Host "[$PSVersion]" - if ($PSVersion -lt $PSMinSupportedVersion) { - Write-Error -Category NotInstalled "You need a minimum PowerShell version of [$PSMinSupportedVersion] to use this installer" - exit -1 - } + Write-Host "[$PSVersion]" + if ($PSVersion -lt $PSMinSupportedVersion) { + Write-Error -Category NotInstalled "You need a minimum PowerShell version of [$PSMinSupportedVersion] to use this installer" + exit -1 + } } function Check-LeptonInstallFiles { - param ([string[]]$Files) + param ([string[]]$Files) - foreach ($item in $Files) { - if (-not (Test-Path $item)) { - return $false - } + foreach ($item in $Files) { + if (-not (Test-Path $item)) { + return $false } + } - return $true + return $true } $InstallType = @{ - Local = 0; - Release = 1; - Network = 2; + Local = 0; + Release = 1; + Network = 2; } function Get-LeptonInstallType { - $LocalFiles = "userChrome.css", "userContent.css", "icons" - $ReleaseFiles = "user.js", "chrome/userChrome.css", "chrome/userContent.css", "chrome/icons" + $LocalFiles = "userChrome.css", "userContent.css", "icons" + $ReleaseFiles = "user.js", "chrome/userChrome.css", "chrome/userContent.css", "chrome/icons" - $IsTypeLocal = Check-LeptonInstallFiles $LocalFiles - $IsTypeRelease = Check-LeptonInstallFiles $ReleaseFiles + $IsTypeLocal = Check-LeptonInstallFiles $LocalFiles + $IsTypeRelease = Check-LeptonInstallFiles $ReleaseFiles - if ($IsTypeLocal) { - return $InstallType.Local - } elseif ($IsTypeRelease) { - return $InstallType.Release - } + if ($IsTypeLocal) { + return $InstallType.Local + } elseif ($IsTypeRelease) { + return $InstallType.Release + } - return $InstallType.Network + return $InstallType.Network } function Select-LeptonDistributionPrompt { - # TODO: make it act like the bash installer with arrow keys + space - Write-Host "Select a distrubution:" - Write-Host " (1) Original" - Write-Host " (2) Photon-Style" - Write-Host " (3) Photon-Style" - Write-Host "" + # TODO: make it act like the bash installer with arrow keys + space + Write-Host "Select a distrubution:" + Write-Host " (1) Original" + Write-Host " (2) Photon-Style" + Write-Host " (3) Photon-Style" + Write-Host "" - $SelectedBranch = "" - while ($SelectedBranch -eq "") { - $SelectedInput = Read-Host "Enter a distribution number (1, 2, 3)" - - switch ($SelectedInput) { - "1" { $SelectedBranch = "master"; break } - "2" { $SelectedBranch = "photon-style"; break } - "3" { $SelectedBranch = "proton-style"; break } - default { Write-Host "Invalid option, reselect please." } - } + $SelectedBranch = "" + while ($SelectedBranch -eq "") { + $SelectedInput = Read-Host "Enter a distribution number (1, 2, 3)" + + switch ($SelectedInput) { + "1" { $SelectedBranch = "master"; break } + "2" { $SelectedBranch = "photon-style"; break } + "3" { $SelectedBranch = "proton-style"; break } + default { Write-Host "Invalid option, reselect please." } } + } - Write-Host "" - Write-Host "Selected '$SelectedBranch'!" + Write-Host "" + Write-Host "Selected '$SelectedBranch'!" - return $SelectedBranch + return $SelectedBranch } function Select-LeptonDistribution { - Write-Host "" + Write-Host "" - $FoundInstallType = Get-LeptonInstallType - switch ($FoundInstallType) { - $InstallType.Release { break } - $InstallType.Network { $SelectedDistribution = Select-LeptonDistributionPrompt; break } - $InstallType.Local { - $SelectedDistribution = Select-LeptonDistributionPrompt - $GitInstalled=$((Get-Command -ErrorAction SilentlyContinue "git").Length -eq 0) - if ($GitInstalled && Test-Path ".git" && $PSCmdlet.ShouldProcess(".git")) { - git checkout $LeptonBranchName - } - break - } - default { throw } + $FoundInstallType = Get-LeptonInstallType + switch ($FoundInstallType) { + $InstallType.Release { break } + $InstallType.Network { $SelectedDistribution = Select-LeptonDistributionPrompt; break } + $InstallType.Local { + $SelectedDistribution = Select-LeptonDistributionPrompt + $GitInstalled=$((Get-Command -ErrorAction SilentlyContinue "git").Length -eq 0) + if ($GitInstalled && Test-Path ".git" && $PSCmdlet.ShouldProcess(".git")) { + git checkout $LeptonBranchName + } + break } + default { throw } + } - return @{ - Type = $InstallType.Network; - Dist = $SelectedDistribution; - } + return @{ + Type = $InstallType.Network; + Dist = $SelectedDistribution; + } } function Get-TestedPaths { - param ([string[]]$Paths) + param ([string[]]$Paths) - $FoundPaths = @() - foreach ($pathItem in $Paths) { - if ($Test-Path -Path $pathItem) { - $FoundPaths += $pathItem - } + $FoundPaths = @() + foreach ($pathItem in $Paths) { + if ($Test-Path -Path $pathItem) { + $FoundPaths += $pathItem } + } - return $FoundPaths + return $FoundPaths } function Check-FirefoxProfileDirectories { - param ([string]$CustomProfilePath) + param ([string]$CustomProfilePath) - Write-Host -Nonewline "Checking Firefox profile directories... " + Write-Host -Nonewline "Checking Firefox profile directories... " - $FirefoxProfilePaths = $DefaultFirefoxProfilePaths - $FirefoxProfilePaths += $CustomProfilePath + $FirefoxProfilePaths = $DefaultFirefoxProfilePaths + $FirefoxProfilePaths += $CustomProfilePath - $FirefoxInstalls = Get-TestedPaths -Paths $FirefoxProfilePaths - if ($FirefoxInstalls.Length -eq 0) { - Write-Host "[not found]" - Write-Error "Unable to find Firefox installations" - exit -1 - } + $FirefoxInstalls = Get-TestedPaths -Paths $FirefoxProfilePaths + if ($FirefoxInstalls.Length -eq 0) { + Write-Host "[not found]" + Write-Error "Unable to find Firefox installations" + exit -1 + } - Write-Host "[found]" - return $FirefoxInstalls + Write-Host "[found]" + return $FirefoxInstalls } function Check-FirefoxProfileConfigurations { - param ([string[]]$InstallDirectories) - Write-Host -Nonewline "Checking profile info files... " + param ([string[]]$InstallDirectories) + Write-Host -Nonewline "Checking profile info files... " - foreach ($Install in $InstallDirectories) { - if (-not ($Test-Path -Path (-Join $Install, "\", $ProfileInfoFile))) { - Write-Error "Unable to find $ProfileInfoFile for install $Install" - exit -1 - } + foreach ($Install in $InstallDirectories) { + if (-not ($Test-Path -Path (-Join $Install, "\", $ProfileInfoFile))) { + Write-Error "Unable to find $ProfileInfoFile for install $Install" + exit -1 } + } - Write-Host "[found]" + Write-Host "[found]" } function Get-FirefoxProfilePaths { - param ([string[]]$InstallDirectories) + param ([string[]]$InstallDirectories) - Write-Host -Nonewline "Checking path information for profiles... " + Write-Host -Nonewline "Checking path information for profiles... " - $AbsoluteProfiles = @() + $AbsoluteProfiles = @() - foreach ($Directory in $InstallDirectories) { - $InfoFileContents = (Get-Content -Path (-Join $Directory, "\", $ProfileInfoFile)) -Split "\n" - $PathNames = $InfoFileContents - .Where({$_ -Match "Path=.+"}) - .ForEach({$_ -Replace "Path=",""}) - .ForEach({$AbsoluteProfiles += (-Join $Directory, "\", $_)}) - } - - # TODO: error handling - return $AbsoluteProfiles + foreach ($Directory in $InstallDirectories) { + $InfoFileContents = (Get-Content -Path (-Join $Directory, "\", $ProfileInfoFile)) -Split "\n" + $PathNames = $InfoFileContents + .Where({$_ -Match "Path=.+"}) + .ForEach({$_ -Replace "Path=",""}) + .ForEach({$AbsoluteProfiles += (-Join $Directory, "\", $_)}) + } + + # TODO: error handling + return $AbsoluteProfiles } function Install-LeptonToProfiles { - param ([string[]]$PathsToInstall) - # TODO: stub + param ([string[]]$PathsToInstall) + # TODO: stub } function Install-Lepton { - Write-Host -NoNewline "Checking PowerShell version... " - Verify-PowerShellVersion # Check installed version meets minimum + Write-Host -NoNewline "Checking PowerShell version... " + Verify-PowerShellVersion # Check installed version meets minimum - # TODO: select style distribution (Photon or Proton) - $SelectedDistribution = Select-LeptonDistribution + # TODO: select style distribution (Photon or Proton) + $SelectedDistribution = Select-LeptonDistribution - # TODO: check profile director{y,ies} (including custom) - $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath + # TODO: check profile director{y,ies} (including custom) + $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath - # TODO: check profile ini files exists - Check-FirefoxProfileConfigurations $InstallationDirectories + # TODO: check profile ini files exists + Check-FirefoxProfileConfigurations $InstallationDirectories - # TODO: read profile paths in from profiles.ini files - $AsboluteProfilePaths = Get-FirefoxProfilePaths + # TODO: read profile paths in from profiles.ini files + $AsboluteProfilePaths = Get-FirefoxProfilePaths - # TODO: install if in install mode - #Install-LeptonToProfiles $AbsoluteProfilePaths + # TODO: install if in install mode + #Install-LeptonToProfiles $AbsoluteProfilePaths } Check-Help Install-Lepton - From 967acf976de60f619cac3d052095c35465dcd22f Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Wed, 21 Jul 2021 14:30:23 +0900 Subject: [PATCH 57/75] Add: Installer - Port `Helper Utils`'s message, required tools --- Install.ps1 | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Install.ps1 b/Install.ps1 index a580856..a9d9089 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -42,6 +42,39 @@ https://github.com/black7375/Firefox-UI-Fix#readme #> +#** Helper Utils *************************************************************** +#== Message ==================================================================== +function Lepton-ErrorMessage() { + Write-Error "FAILED: ${args}" + exit -1 +} + +function Lepton-OKMessage() { + $local:SIZE = 50 + $local:FILLED = "" + for ($i = 0; $i -le ($SIZE - 2); $i++) { + $FILLED += "." + } + $FILLED += "OK" + + $local:message = "${args}" + Write-Host ${message}(${FILLED}.Substring(${message}.Length)) +} + +#== Required Tools ============================================================= +function Install-Choco() { + # https://chocolatey.org/install + Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) +} + +function Check-Git() { + if( -Not (Get-Command git) ) { + Install-Choco + } + + Lepton-OKMessage "Required - git" +} + #** Main *********************************************************************** [CmdletBinding( SupportsShouldProcess = $true, From 83c7b79f1c3a1f31f2bb9b97f49d9f98f27c4557 Mon Sep 17 00:00:00 2001 From: Yunsup Sim Date: Wed, 21 Jul 2021 18:25:33 +0900 Subject: [PATCH 58/75] fix: Fix sharing icon is not aligned --- userChrome.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/userChrome.css b/userChrome.css index b8dda9f..3a204b6 100644 --- a/userChrome.css +++ b/userChrome.css @@ -1020,7 +1020,7 @@ display: none; } - .tab-icon-image { + .tab-icon-image, .tab-sharing-icon-overlay { box-sizing: content-box; padding: 3px 0; From cadd5d8aaa7ad572d1481889561be4ed0a97697f Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Thu, 22 Jul 2021 10:41:26 +0900 Subject: [PATCH 59/75] Add: Installer - Port `Helper Utils`'s PATH/File, INI File --- Install.ps1 | 160 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) diff --git a/Install.ps1 b/Install.ps1 index a9d9089..d08e7cc 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -75,6 +75,166 @@ function Check-Git() { Lepton-OKMessage "Required - git" } +#== PATH / File ================================================================ +$currentDir = (Get-Location).path + +function Filter-Path() { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string[]] $pathList, + [Parameter(Position=1)] + [string] $option = "Any" + ) + + return $pathList.Where({ Test-Path -Path "$_" -PathType "${option}" }) +} + +function Copy-Auto() { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string] $file, + [Parameter(Mandatory=$true, Position=1)] + [string] $target + ) + + if ( "${file}" -eq "${target}" ) { + Write-Host "'${file}' and ${target} are same file" + return 0 + } + + if ( Test-Path -Path "${target}" ) { + Write-Host "${target} alreay exist." + Write-Host "Now Backup.." + Copy-Auto "${target}" "${target}.bak" + Write-Host "" + } + + Copy-Item -Path "${file}" -Destination "${target}" -Force +} + +function Move-Auto() { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string] $file, + [Parameter(Mandatory=$true, Position=1)] + [string] $target + ) + + if ( "${file}" -eq "${target}" ) { + Write-Host "'${file}' and ${target} are same file" + return 0 + } + + if ( Test-Path -Path "${target}" ) { + Write-Host "${target} alreay exist." + Write-Host "Now Backup.." + Move-Auto "${target}" "${target}.bak" + Write-Host "" + } + + Move-Item -Path "${file}" -Destination "${target}" -Force +} + +function Restore-Auto() { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string] $file + ) + $local:target = "${file}.bak" + + if ( Test-Path -Path "${file}" ) { + Remove-Item "${file}" -Recurse -Force + } + Move-Item -Path "${target}" -Destination "${file}" -Force + + $local:loopupTarget = "${target}.bak" + if ( Test-Path -Path "${lookupTarget}" ) { + Restore-Auto "${target}" + } +} + +function Write-File() { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string] $filePath, + [Parameter(Position=1)] + [string] $fileContent = "" + ) + + if ( "${fileContent}" -eq "" ) { + New-Item -Path "${filePath}" -Force + } + else { + Out-File -FilePath "${filePath}" -InputObject "${fileContent}" -Force + } +} + +#== INI File ================================================================ +# https://devblogs.microsoft.com/scripting/use-powershell-to-work-with-any-ini-file/ +function Get-IniContent () { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string] $filePath + ) + + $ini = @{} + switch -regex -file $filePath { + “^\[(.+)\]” { + # Section + $section = $matches[1] + $ini[$section] = @{} + $CommentCount = 0 + } + “^(;.*)$” { + # Comment + $value = $matches[1] + $CommentCount = $CommentCount + 1 + $name = “Comment” + $CommentCount + $ini[$section][$name] = $value + } + “(.+?)\s*=(.*)” { + # Key + $name,$value = $matches[1..2] + $ini[$section][$name] = $value + } + } + return $ini +} + +function Out-IniFile() { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string] $filePath, + [Parameter(Position=1)] + [hashtable] $iniObject = @{} + ) + + # Create new file + New-Item -Path "${filePath}" -Force + $local:outFile = New-Item -ItemType file -Path "${filepath}" + + foreach ($i in $iniObject.keys) { + if (!($($iniObject[$i].GetType().Name) -eq “Hashtable”)) { + #No Sections + Add-Content -Path $outFile -Value “$i=$($iniObject[$i])” + } + else { + #Sections + Add-Content -Path $outFile -Value “[$i]” + Foreach ($j in ($iniObject[$i].keys | Sort-Object)) { + if ($j -match “^Comment[\d]+”) { + Add-Content -Path $outFile -Value “$($iniObject[$i][$j])” + } + else { + Add-Content -Path $outFile -Value “$j=$($iniObject[$i][$j])” + } + + } + Add-Content -Path $outFile -Value “” + } + } +} + #** Main *********************************************************************** [CmdletBinding( SupportsShouldProcess = $true, From 38011804d956d8bff80a40815a944e6cd4534eba Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Thu, 22 Jul 2021 10:43:00 +0900 Subject: [PATCH 60/75] Clean: Installer - Change to multiline --- Install.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Install.ps1 b/Install.ps1 index d08e7cc..d0a9d3c 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -64,7 +64,9 @@ function Lepton-OKMessage() { #== Required Tools ============================================================= function Install-Choco() { # https://chocolatey.org/install - Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) + Set-ExecutionPolicy Bypass -Scope Process -Force + [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 + iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) } function Check-Git() { From 6837051e4ead4f00a96ecb68ddedd9db0cbef146 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Thu, 22 Jul 2021 16:38:47 +0900 Subject: [PATCH 61/75] Fix: Intaller - RFC update to need `[Info]` section --- .github/workflows/release.yml | 2 +- LEPTON | 1 + install.sh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index def15e6..7ddc0fd 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,7 +27,7 @@ jobs: BRANCH=${{ matrix.branch }} TAGVER=${GITHUB_REF#refs/*/} - echo -e "Ver=${TAGVER}\nBranch=${BRANCH}" > LEPTON + echo -e "\[Info\]\nVer=${TAGVER}\nBranch=${BRANCH}" > LEPTON - name: Release Structure run: | diff --git a/LEPTON b/LEPTON index 1e76b9c..4a109d0 100644 --- a/LEPTON +++ b/LEPTON @@ -1 +1,2 @@ +[Info] Branch=master diff --git a/install.sh b/install.sh index 0807da5..31dfb8f 100755 --- a/install.sh +++ b/install.sh @@ -442,6 +442,7 @@ select_profile() { ## `LEPTON` file format # If this file exist in same directory as the `userChrome.css` file, # it is recognized as the "Lepton" installation directory. +# [Info] # Branch=master | photon-style | proton-style # Ver= | | [NULL] From bc2279d7826ce98b19843575a71042e3912b7023 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 23 Jul 2021 09:03:49 +0900 Subject: [PATCH 62/75] Add: Installer - PS select menu --- CREDITS | 4 +++ Install.ps1 | 99 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) diff --git a/CREDITS b/CREDITS index 23500ed..ba21989 100644 --- a/CREDITS +++ b/CREDITS @@ -38,6 +38,10 @@ N: Multi-Account-Containers W: https://github.com/mozilla/multi-account-containers L: MPL 2.0 +N: PS-Menu +W: https://github.com/chrisseroka/ps-menu +L: MIT + N: quietfox W: https://github.com/coekuss/quietfox L: MIT diff --git a/Install.ps1 b/Install.ps1 index d0a9d3c..f8a6829 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -237,6 +237,105 @@ function Out-IniFile() { } } +#** Select Menu **************************************************************** +# https://github.com/chrisseroka/ps-menu +function Check-PsMenu() { + if(-Not (Get-InstalledModule ps-menu -ErrorAction silentlycontinue)) { + Set-PSRepository PSGallery -InstallationPolicy Trusted + Install-Module -Name ps-menu -Confirm:$False -Force + } +} + +function DrawMenu { + param ($menuItems, $menuPosition, $Multiselect, $selection) + $l = $menuItems.length + for ($i = 0; $i -le $l; $i++) { + if ($menuItems[$i] -ne $null){ + $item = $menuItems[$i] + if ($Multiselect) { + if ($selection -contains $i){ + $item = '[x] ' + $item + } + else { + $item = '[ ] ' + $item + } + } + if ($i -eq $menuPosition) { + Write-Host "> $($item)" -ForegroundColor Green + } + else { + Write-Host " $($item)" + } + } + } +} + +function Toggle-Selection { + param ($pos, [array]$selection) + if ($selection -contains $pos){ + $result = $selection | where {$_ -ne $pos} + } + else { + $selection += $pos + $result = $selection + } + $result +} + +function Menu { + param ([array]$menuItems, [switch]$ReturnIndex=$false, [switch]$Multiselect) + $vkeycode = 0 + $pos = 0 + $selection = @() + if ($menuItems.Length -gt 0) { + try { + [console]::CursorVisible=$false #prevents cursor flickering + DrawMenu $menuItems $pos $Multiselect $selection + While ($vkeycode -ne 13 -and $vkeycode -ne 27) { + $press = $host.ui.rawui.readkey("NoEcho,IncludeKeyDown") + $vkeycode = $press.virtualkeycode + If ($vkeycode -eq 38 -or $press.Character -eq 'k') {$pos--} + If ($vkeycode -eq 40 -or $press.Character -eq 'j') {$pos++} + If ($vkeycode -eq 36) { $pos = 0 } + If ($vkeycode -eq 35) { $pos = $menuItems.length - 1 } + If ($press.Character -eq ' ') { $selection = Toggle-Selection $pos $selection } + if ($pos -lt 0) {$pos = 0} + If ($vkeycode -eq 27) {$pos = $null } + if ($pos -ge $menuItems.length) {$pos = $menuItems.length -1} + if ($vkeycode -ne 27) { + $startPos = [System.Console]::CursorTop - $menuItems.Length + [System.Console]::SetCursorPosition(0, $startPos) + DrawMenu $menuItems $pos $Multiselect $selection + } + } + } + finally { + [System.Console]::SetCursorPosition(0, $startPos + $menuItems.Length) + [console]::CursorVisible = $true + } + } + else { + $pos = $null + } + + if ($ReturnIndex -eq $false -and $pos -ne $null) { + if ($Multiselect){ + return $menuItems[$selection] + } + else { + return $menuItems[$pos] + } + } + else { + if ($Multiselect) { + return $selection + } + else { + return $pos + } + } +} + #** Main *********************************************************************** [CmdletBinding( SupportsShouldProcess = $true, From d81365f8813b3b8ddd50f6f85793efd700cb5f4e Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 23 Jul 2021 11:02:57 +0900 Subject: [PATCH 63/75] Add: Installer - Port `Profile`, `Lepton Info File` --- Install.ps1 | 177 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 177 insertions(+) diff --git a/Install.ps1 b/Install.ps1 index f8a6829..800fbee 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -336,6 +336,183 @@ function Menu { } } +#** Profile ******************************************************************** +#== Profile Dir ================================================================ +# $HOME = (get-psprovider 'FileSystem').Home +$firefoxProfileDirPaths = @( + "${HOME}\AppData\Roaming\Mozilla\Firefox", + "${HOME}\AppData\Roaming\LibreWolf" +) + +function Check-ProfileDir() { + Param ( + [Parameter(Position=0)] + [string] $profileDir = "" + ) + + if ( "${profileDir}" -ne "" ) { + $firefoxProfileDirPaths = @("${profileDir}") + } + + + $firefoxProfileDirPaths = Filter-Path $firefoxProfileDirPaths "Container" + + if ( $firefoxProfileDirPaths.Length -eq 0 ) { + Lepton-ErrorMessage "Unable to find firefox profile dir." + } + + Lepton-OKMessage "Profiles dir found" +} + +#== Profile Info =============================================================== +$PROFILEINFOFILE="profiles.ini" +function Check-ProfileIni() { + foreach ( $profileDir in $firefoxProfileDirPaths ) { + if ( -Not (Test-Path -Path "${profileDir}/${PROFILEINFOFILE}" -PathType "Leaf") ) { + Lepton-ErrorMessage "Unable to find ${PROFILEINFOFILE} at ${profileDir}" + } + } + + Lepton-OKMessage "Profiles info file found" +} + +#== Profile PATH =============================================================== +$firefoxProfilePaths = @() +function Update-ProfilePaths() { + foreach ( $profileDir in $firefoxProfileDirPaths ) { + $local:iniContent = Get-IniContent "${profiledir}/${PROFILEINFOFILE}" + $firefoxProfilePaths += $iniContent.Values.Path + } + + if ( $firefoxProfilePaths.Length -ne 0 ) { + Lepton-OkMessage "Profile paths updated" + } + else { + Lepton-ErrorMessage "Doesn't exist profiles" + } +} + +# TODO: Multi select support +function Select-Profile() { + Param ( + [Parameter(Position=0)] + [string] $profileName = "" + ) + + if ( "${profileName}" -ne "" ) { + $local:targetPath = "" + foreach ( $profilePath in $firefoxProfilePaths ) { + if ( "${profilePath}" -like "*${profileName}" ) { + $targetPath = "${profilePath}" + break + } + } + + if ( "${targetPath}" -ne "" ) { + Lepton-OkMessage "Profile, `"${profileName}`" found" + $firefoxProfilePaths = @("${targetPath}") + } + else { + Lepton-ErrorMessage "Unable to find ${profileName}" + } + else + if ( $firefoxProfilePaths.Length -eq 1 ) { + Lepton-OkMessage "Auto detected profile" + } + else { + $firefoxProfilePaths = Menu $firefoxProfilePaths + + if ( $firefoxProfilePaths.Length -eq 0 ) { + Lepton-ErrorMessage "Please select profiles" + } + + Lepton-OkMessage "Selected profile" + } + } +} + +#** Lepton Info File *********************************************************** +# If you interst RFC, see install.sh + +#== Lepton Info ================================================================ +$LEPTONINFOFILE ="lepton.ini" +function Check-LeptonIni() { + foreach ( $profileDir in $firefoxProfileDirPaths ) { + if ( -Not (Test-Path -Path "${profileDir}/${LEPTONINFOFILE}") ) { + Lepton-ErrorMessage "Unable to find ${LEPTONINFOFILE} at ${profileDir}" + } + } + + Lepton-OkMessage "Lepton info file found" +} + +#== Create info file =========================================================== +# We should always create a new one, as it also takes into account the possibility of setting it manually. +# Updates happen infrequently, so the creation overhead is less significant. + +$CHROMEINFOFILE="LEPTON" +function Write-LeptonInfo() { + # Init info + $local:output = @{} + $local:prevDir = Split-Path $firefoxProfilePaths[0] -Parent + $local:latestPath = ( $firefoxProfilePaths | Select-Object -Last 1 ) + foreach ( $profilePath in $firefoxProfilePaths ) { + $local:LEPTONINFOPATH = "${profilePath}/chrome/${CHROMEINFOFILE}" + $local:LEPTONGITPATH = "${profilePath}/chrome/.git" + + # Profile info + $local:Type = "" + $local:Ver = "" + $local:Branch = "" + $local:Path = "" + if ( Test-Path -Path "${LEPTONINFOPATH}" ) { + if ( Test-Path -Path "${LEPTONGITPATH}" -PathType "Container" ) { + $Type = "Git" + $Ver = $(git --git-dir "${LEPTONGITPATH}" rev-parse HEAD) + $Branch = $(git --git-dir "${LEPTONGITPATH}" rev-parse --abbrev-ref HEAD) + } + else { + $local:iniContent = Get-IniContent "${LEPTONINFOPATH}" + $Type = $iniContent["Info"]["Type"] + $Ver = $iniContent["Info"]["Ver"] + $Branch = $iniContent["Info"]["Branch"] + + if ( "${Type}" -eq "" ) { + $Type = "Local" + } + } + + $Path = "${profilePath}" + } + + # Flushing + $local:profileDir = Split-Path "${profilePath}" -Parent + $local:profileName = Split-Path "${profilePath}" -Leaf + if ( "${prevDir}" -ne "${profileDir}" ) { + Out-IniFile "${prevDir}/${LEPTONINFOFILE}" $output + $output = @{} + } + + # Make output contents + foreach ( $key in @("Type", "Branch", "Ver", "Path") ) { + $local:value = Get-Variable -Name "${key}" + if ( "$value" -ne $null ) { + $output["${profileName}"] += @{"${key}" = "${value}"} + } + } + + # Latest element flushing + if ( "${profilePath}" -eq "${latestPath}" ) { + Out-IniFile "${profileDir}/${LEPTONINFOFILE}" $output + } + $prevDir = "${profileDir}" + } + + # Verify + Check-LeptonIni + Lepton-OkMessage "Lepton info file created" +} + #** Main *********************************************************************** [CmdletBinding( SupportsShouldProcess = $true, From 09eb4567905802c2933a139293aa51bb86dc9994 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 23 Jul 2021 11:08:36 +0900 Subject: [PATCH 64/75] Fix: Fully Dark Mode - Download popup background at light mode #131 --- userChrome.css | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/userChrome.css b/userChrome.css index 3a204b6..329daff 100644 --- a/userChrome.css +++ b/userChrome.css @@ -351,8 +351,10 @@ /*= Downloads ==============================================================*/ @-moz-document url("chrome://mozapps/content/downloads/unknownContentType.xhtml") { - :root { - --in-content-page-background: #42414d; + @media (-moz-toolbar-prefers-color-scheme:dark) { + :root { + --in-content-page-background: #42414d; + } } #unknownContentType { color: var(--in-content-page-color) !important; From 3705df59c8e8b20cd02949adacec095a1320a9b1 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 23 Jul 2021 14:45:02 +0900 Subject: [PATCH 65/75] Fix: Installer - Windows Path, choco install command --- Install.ps1 | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 800fbee..2544a95 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -72,6 +72,7 @@ function Install-Choco() { function Check-Git() { if( -Not (Get-Command git) ) { Install-Choco + choco install git -y } Lepton-OKMessage "Required - git" @@ -368,7 +369,7 @@ function Check-ProfileDir() { $PROFILEINFOFILE="profiles.ini" function Check-ProfileIni() { foreach ( $profileDir in $firefoxProfileDirPaths ) { - if ( -Not (Test-Path -Path "${profileDir}/${PROFILEINFOFILE}" -PathType "Leaf") ) { + if ( -Not (Test-Path -Path "${profileDir}\${PROFILEINFOFILE}" -PathType "Leaf") ) { Lepton-ErrorMessage "Unable to find ${PROFILEINFOFILE} at ${profileDir}" } } @@ -380,7 +381,7 @@ function Check-ProfileIni() { $firefoxProfilePaths = @() function Update-ProfilePaths() { foreach ( $profileDir in $firefoxProfileDirPaths ) { - $local:iniContent = Get-IniContent "${profiledir}/${PROFILEINFOFILE}" + $local:iniContent = Get-IniContent "${profiledir}\${PROFILEINFOFILE}" $firefoxProfilePaths += $iniContent.Values.Path } @@ -438,7 +439,7 @@ function Select-Profile() { $LEPTONINFOFILE ="lepton.ini" function Check-LeptonIni() { foreach ( $profileDir in $firefoxProfileDirPaths ) { - if ( -Not (Test-Path -Path "${profileDir}/${LEPTONINFOFILE}") ) { + if ( -Not (Test-Path -Path "${profileDir}\${LEPTONINFOFILE}") ) { Lepton-ErrorMessage "Unable to find ${LEPTONINFOFILE} at ${profileDir}" } } @@ -457,8 +458,8 @@ function Write-LeptonInfo() { $local:prevDir = Split-Path $firefoxProfilePaths[0] -Parent $local:latestPath = ( $firefoxProfilePaths | Select-Object -Last 1 ) foreach ( $profilePath in $firefoxProfilePaths ) { - $local:LEPTONINFOPATH = "${profilePath}/chrome/${CHROMEINFOFILE}" - $local:LEPTONGITPATH = "${profilePath}/chrome/.git" + $local:LEPTONINFOPATH = "${profilePath}\chrome\${CHROMEINFOFILE}" + $local:LEPTONGITPATH = "${profilePath}\chrome\.git" # Profile info $local:Type = "" @@ -489,7 +490,7 @@ function Write-LeptonInfo() { $local:profileDir = Split-Path "${profilePath}" -Parent $local:profileName = Split-Path "${profilePath}" -Leaf if ( "${prevDir}" -ne "${profileDir}" ) { - Out-IniFile "${prevDir}/${LEPTONINFOFILE}" $output + Out-IniFile "${prevDir}\${LEPTONINFOFILE}" $output $output = @{} } @@ -503,7 +504,7 @@ function Write-LeptonInfo() { # Latest element flushing if ( "${profilePath}" -eq "${latestPath}" ) { - Out-IniFile "${profileDir}/${LEPTONINFOFILE}" $output + Out-IniFile "${profileDir}\${LEPTONINFOFILE}" $output } $prevDir = "${profileDir}" } From 976cee6d2fc9ef6136939d69eb2e6b88ebde8c9c Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 23 Jul 2021 14:51:12 +0900 Subject: [PATCH 66/75] Add: Installer - Port to `Install`, `Update` --- Install.ps1 | 200 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 200 insertions(+) diff --git a/Install.ps1 b/Install.ps1 index 2544a95..ad0d4c0 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -514,6 +514,206 @@ function Write-LeptonInfo() { Lepton-OkMessage "Lepton info file created" } +#** Install ******************************************************************** +#== Install Types ============================================================== +$updateMode = $false +$leptonBranch = "master" +function Select-Distribution() { + while ( $true ) { + $local:selected = $false + $local:selectedDistribution = Menu @("Original(default)", "Photon-Style", "Proton-Style", "Update") + switch ( $selectedDistribution ) { + "Original(default)" { $leptonBranch = "master" ; $selected = $true } + "Photon-Style" { $leptonBranch = "photon-style"; $selected = $true } + "Proton-Style" { $leptonBranch = "proton-style"; $selected = $true } + "Update" { $updateMode = $true ; $selected = $true } + default { Write-Host "Invalid option, reselect please." } + } + + if ( $selected -eq $true ) { + break + } + } + Lepton-OkMessage "Selected ${selectedDistribution}" +} + +$leptonInstallType = "Network" # Other types: Local, Release +function Check-InstallType() { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string[]] $targetList, + [Parameter(Mandatory=$true, Position=1)] + [string] $installType + ) + + $local:targetCount = $targetList.Length + $local:foundCount = (Filter-Path $targetList ).Length + + if ( "${targetCount}" -eq "${foundCount}" ) { + $leptonInstallType="${installType}" + } +} + +$checkLocalFiles = @( + "userChrome.css", + "userContent.css", + "icons" +) +$checkReleaseFiles = @( + "user.js" + "chrome\userChrome.css" + "chrome\userContent.css" + "chrome\icons" +) +function Check-InstallTypes() { + Check-InstallType $checkLocalFiles "Local" + Check-InstallType $checkReleaseFiles "Release" + + Lepton-OkMessage "Checked install type: ${leptonInstallType}" + if ( "${leptonInstallType}" -eq "Network" ) { + Select-Distribution + } + if ( "${leptonInstallType}" -eq "Local" ) { + if ( Test-Path -Path ".git" -PathType "Container" ) { + Select-Distribution + git checkout "${leptonBranch}" + } + } +} + +#== Install Helpers ============================================================ +$chromeDuplicate = $false +function Check-ChromeExist() { + if ( Test-Path -Path "chrome" -and -Not (Test-Path -Path "chrome\${LEPTONINFOFILE}") ) { + $chromeDuplicate = $true + Move-Auto "chrome" "chrome.bak" + Lepton-OkMessage "Backup files" + } +} +function Check-ChromeRestore() { + if ( "${chromeDuplicate}" -eq $true ) { + Restore-Auto "chrome" + Lepton-OkMessage "End restore files" + } + Lepton-OkMessage "End check restore files" +} + +function Clean-Lepton() { + if ( $chromeDuplicate -ne $true ) { + Remove-Item "chrome" -Recurse -Force + } + Lepton-OkMessage "End clean files" +} +function Clone-Lepton() { + Param ( + [Parameter(Position=0)] + [string] $branch = "" + ) + local branch="$1" + + if ( "${branch}" -eq "" ) { + $branch = "${leptonBranch}" + } + + git clone -b "${branch}" https://github.com/black7375/Firefox-UI-Fix.git chrome + if ( -Not (Test-Path -Path "chrome" -PathType "Container") ) { + Lepton-ErrorMessage "Unable to find downloaded files" + } +} + +function Copy-Lepton() { + Param ( + [Parameter(Position=0)] + [string] $chromeDir = "chrome", + [Parameter(Position=0)], + [string] $userJSPath = "${chromeDir}\user.js" + ) + + foreach ( $profilePath in $firefoxProfilePaths ) { + Copy-Auto "${userJSPath}" "${profilePath}\user.js" + Copy-Auto "${chromeDir}" "${profilePath}\chrome" + } + + Lepton-OkMessage "End profile copy" +} + +#== Each Install =============================================================== +function Install-Local() { + Copy-Lepton "${currentDir}" "user.js" +} + +function Install-Release() { + Copy-Lepton "chrome" "user.js" +} + +function Install-Network() { + Check-ChromeExist + Check-Git + + Clone-Lepton + Copy-Lepton + + Clean-Lepton + Check-ChromeRestore +} + +function Install-Profile() { + Lepton-OkMessage "Started install" + + switch ( "${leptonInstallType}" ) { + "Local" { Install-Local } + "Release" { Install-Release } + "Network" { Install-Network } + } + + Lepton-OkMessage "End install" +} + +#** Update ********************************************************************* +function Update-Profile() { + Check-Git + foreach ( $profileDir in $firefoxProfileDirPaths ) { + $local:LEPTONINFOPATH = "${profileDir}\${LEPTONINFOFILE}" + $local:LEPTONINFO = Get-IniContent "${LEPTONINFOPATH}" + $local:sections = $LEPTONINFO.Keys + if ( $sections.Length -ne 0 ) { + foreach ( $section in $sections ) { + $local:Type = $LEPTONINFO["${section}"]["Type"] + $local:Branch = $LEPTONINFO["${section}"]["Branch"] + $local:Path = $LEPTONINFO["${section}"]["Path"] + + $local:LEPTONGITPATH="${Path}\chrome\.git" + if ( "${Type}" -eq "Git" ){ + git --git-dir "${LEPTONGITPATH}" checkout "${Branch}" + git --git-dir "${LEPTONGITPATH}" pull --no-edit + } + elseif ( "${Type}" -eq "Local" -or "${Type}" -eq "Release" ) { + Check-ChromeExist + Clone-Lepton + + $firefoxProfilePaths = @("${Path}") + Copy-Lepton + + if ( "${Branch}" -eq $null ) { + $Branch = "${leptonBranch}" + } + git --git-dir "${LEPTONGITPATH}" checkout "${Branch}" + + if ( "${Type}" -eq "Release" ) { + $local:Ver=$(git --git-dir "${LEPTONINFOFILE}" describe --tags --abbrev=0) + git --git-dir "${LEPTONGITPATH}" checkout "tags/${Ver}" + } + } + else { + Lepton-ErrorMessage "Unable to find update type, ${Type} at ${section}" + } + } + } + } + Clean-Lepton + Check-ChromeRestore +} + #** Main *********************************************************************** [CmdletBinding( SupportsShouldProcess = $true, From 1bdcaf606976f4b13952727a499f2a92ab5d0fa3 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Fri, 23 Jul 2021 17:27:05 +0900 Subject: [PATCH 67/75] Add: Installer - Port to `main` --- Install.ps1 | 219 ++++++++-------------------------------------------- 1 file changed, 31 insertions(+), 188 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index ad0d4c0..1639c85 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -61,6 +61,18 @@ function Lepton-OKMessage() { Write-Host ${message}(${FILLED}.Substring(${message}.Length)) } +$PSMinSupportedVersion = 2 +function Verify-PowerShellVersion { + Write-Host -NoNewline "Checking PowerShell version... " + $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion) + + Write-Host "[$PSVersion]" + if ($PSVersion -lt $PSMinSupportedVersion) { + Write-Error -Category NotInstalled "You need a minimum PowerShell version of [$PSMinSupportedVersion] to use this installer" + exit -1 + } +} + #== Required Tools ============================================================= function Install-Choco() { # https://chocolatey.org/install @@ -661,7 +673,7 @@ function Install-Profile() { Lepton-OkMessage "Started install" switch ( "${leptonInstallType}" ) { - "Local" { Install-Local } + "Local" { Install-Local } "Release" { Install-Release } "Network" { Install-Network } } @@ -722,210 +734,41 @@ function Update-Profile() { param( [Alias("u")] - [Switch]$Update=$false, + [Switch]$updateMode, [Alias("f")] - [string]$ProfilePath, + [string]$profileDir, [Alias("p")] - [string]$ProfileName, + [string]$profileName, [Alias("h")] - [Switch]$Help=$false + [Switch]$help = $false ) -# Constants -$PSMinSupportedVersion = 2 -$DefaultFirefoxProfilePaths = @("~/AppData/Roaming/Mozilla/Firefox/") -$ProfileInfoFile = "profiles.ini" - function Check-Help { # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' - if ($Help) { + if ($help) { Get-Help "$PSCommandPath" exit 0 } } -function Verify-PowerShellVersion { - $PSVersion = [int](Select-Object -Property Major -First 1 -ExpandProperty Major -InputObject $PSVersionTable.PSVersion) - - Write-Host "[$PSVersion]" - if ($PSVersion -lt $PSMinSupportedVersion) { - Write-Error -Category NotInstalled "You need a minimum PowerShell version of [$PSMinSupportedVersion] to use this installer" - exit -1 - } -} - -function Check-LeptonInstallFiles { - param ([string[]]$Files) - - foreach ($item in $Files) { - if (-not (Test-Path $item)) { - return $false - } - } - - return $true -} - -$InstallType = @{ - Local = 0; - Release = 1; - Network = 2; -} - -function Get-LeptonInstallType { - $LocalFiles = "userChrome.css", "userContent.css", "icons" - $ReleaseFiles = "user.js", "chrome/userChrome.css", "chrome/userContent.css", "chrome/icons" - - $IsTypeLocal = Check-LeptonInstallFiles $LocalFiles - $IsTypeRelease = Check-LeptonInstallFiles $ReleaseFiles - - if ($IsTypeLocal) { - return $InstallType.Local - } elseif ($IsTypeRelease) { - return $InstallType.Release - } - - return $InstallType.Network -} - -function Select-LeptonDistributionPrompt { - # TODO: make it act like the bash installer with arrow keys + space - Write-Host "Select a distrubution:" - Write-Host " (1) Original" - Write-Host " (2) Photon-Style" - Write-Host " (3) Photon-Style" - Write-Host "" - - $SelectedBranch = "" - while ($SelectedBranch -eq "") { - $SelectedInput = Read-Host "Enter a distribution number (1, 2, 3)" - - switch ($SelectedInput) { - "1" { $SelectedBranch = "master"; break } - "2" { $SelectedBranch = "photon-style"; break } - "3" { $SelectedBranch = "proton-style"; break } - default { Write-Host "Invalid option, reselect please." } - } - } - - Write-Host "" - Write-Host "Selected '$SelectedBranch'!" - - return $SelectedBranch -} - -function Select-LeptonDistribution { - Write-Host "" - - $FoundInstallType = Get-LeptonInstallType - switch ($FoundInstallType) { - $InstallType.Release { break } - $InstallType.Network { $SelectedDistribution = Select-LeptonDistributionPrompt; break } - $InstallType.Local { - $SelectedDistribution = Select-LeptonDistributionPrompt - $GitInstalled=$((Get-Command -ErrorAction SilentlyContinue "git").Length -eq 0) - if ($GitInstalled && Test-Path ".git" && $PSCmdlet.ShouldProcess(".git")) { - git checkout $LeptonBranchName - } - break - } - default { throw } - } - - return @{ - Type = $InstallType.Network; - Dist = $SelectedDistribution; - } -} - -function Get-TestedPaths { - param ([string[]]$Paths) - - $FoundPaths = @() - foreach ($pathItem in $Paths) { - if ($Test-Path -Path $pathItem) { - $FoundPaths += $pathItem - } - } - - return $FoundPaths -} - -function Check-FirefoxProfileDirectories { - param ([string]$CustomProfilePath) - - Write-Host -Nonewline "Checking Firefox profile directories... " - - $FirefoxProfilePaths = $DefaultFirefoxProfilePaths - $FirefoxProfilePaths += $CustomProfilePath - - $FirefoxInstalls = Get-TestedPaths -Paths $FirefoxProfilePaths - if ($FirefoxInstalls.Length -eq 0) { - Write-Host "[not found]" - Write-Error "Unable to find Firefox installations" - exit -1 - } - - Write-Host "[found]" - return $FirefoxInstalls -} - -function Check-FirefoxProfileConfigurations { - param ([string[]]$InstallDirectories) - Write-Host -Nonewline "Checking profile info files... " - - foreach ($Install in $InstallDirectories) { - if (-not ($Test-Path -Path (-Join $Install, "\", $ProfileInfoFile))) { - Write-Error "Unable to find $ProfileInfoFile for install $Install" - exit -1 - } - } - - Write-Host "[found]" -} - -function Get-FirefoxProfilePaths { - param ([string[]]$InstallDirectories) - - Write-Host -Nonewline "Checking path information for profiles... " - - $AbsoluteProfiles = @() - - foreach ($Directory in $InstallDirectories) { - $InfoFileContents = (Get-Content -Path (-Join $Directory, "\", $ProfileInfoFile)) -Split "\n" - $PathNames = $InfoFileContents - .Where({$_ -Match "Path=.+"}) - .ForEach({$_ -Replace "Path=",""}) - .ForEach({$AbsoluteProfiles += (-Join $Directory, "\", $_)}) - } - - # TODO: error handling - return $AbsoluteProfiles -} - -function Install-LeptonToProfiles { - param ([string[]]$PathsToInstall) - # TODO: stub -} - function Install-Lepton { - Write-Host -NoNewline "Checking PowerShell version... " Verify-PowerShellVersion # Check installed version meets minimum + Check-InstallTypes - # TODO: select style distribution (Photon or Proton) - $SelectedDistribution = Select-LeptonDistribution + Check-ProfileDir $profileDir + Check-ProfileIni + Update-ProfilePaths + Write-LeptonInfo - # TODO: check profile director{y,ies} (including custom) - $InstallationDirectories = Check-FirefoxProfileDirectories $ProfilePath + if ( $updateMode ) { + Update-Profile + } + else { + Select-Profile $profileName + Install-Profile + } - # TODO: check profile ini files exists - Check-FirefoxProfileConfigurations $InstallationDirectories - - # TODO: read profile paths in from profiles.ini files - $AsboluteProfilePaths = Get-FirefoxProfilePaths - - # TODO: install if in install mode - #Install-LeptonToProfiles $AbsoluteProfilePaths + Write-LeptonInfo } Check-Help From 331d03f7f709515b3fa0e01b4d3303fef3ef1764 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Sat, 24 Jul 2021 02:23:16 +0900 Subject: [PATCH 68/75] Fix: Intaller - Powershell syntax --- Install.ps1 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index 1639c85..bb5311a 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -193,21 +193,21 @@ function Get-IniContent () { ) $ini = @{} - switch -regex -file $filePath { - “^\[(.+)\]” { + switch ( -regex -file $filePath ) { + "^\[(.+)\]" { # Section $section = $matches[1] $ini[$section] = @{} $CommentCount = 0 } - “^(;.*)$” { + "^(;.*)$" { # Comment $value = $matches[1] $CommentCount = $CommentCount + 1 $name = “Comment” + $CommentCount $ini[$section][$name] = $value } - “(.+?)\s*=(.*)” { + "(.+?)\s*=(.*)" { # Key $name,$value = $matches[1..2] $ini[$section][$name] = $value @@ -229,23 +229,23 @@ function Out-IniFile() { $local:outFile = New-Item -ItemType file -Path "${filepath}" foreach ($i in $iniObject.keys) { - if (!($($iniObject[$i].GetType().Name) -eq “Hashtable”)) { + if (!($($iniObject[$i].GetType().Name) -eq "Hashtable")) { #No Sections - Add-Content -Path $outFile -Value “$i=$($iniObject[$i])” + Add-Content -Path $outFile -Value "$i=$($iniObject[$i])" } else { #Sections - Add-Content -Path $outFile -Value “[$i]” + Add-Content -Path $outFile -Value "[$i]" Foreach ($j in ($iniObject[$i].keys | Sort-Object)) { - if ($j -match “^Comment[\d]+”) { - Add-Content -Path $outFile -Value “$($iniObject[$i][$j])” + if ($j -match "^Comment[\d]+") { + Add-Content -Path $outFile -Value "$($iniObject[$i][$j])" } else { - Add-Content -Path $outFile -Value “$j=$($iniObject[$i][$j])” + Add-Content -Path $outFile -Value "$j=$($iniObject[$i][$j])" } } - Add-Content -Path $outFile -Value “” + Add-Content -Path $outFile -Value "" } } } @@ -637,7 +637,7 @@ function Copy-Lepton() { Param ( [Parameter(Position=0)] [string] $chromeDir = "chrome", - [Parameter(Position=0)], + [Parameter(Position=0)] [string] $userJSPath = "${chromeDir}\user.js" ) From 8af14761c39114b79d25d7c84d4193fdd052b013 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Sat, 24 Jul 2021 23:35:43 +0900 Subject: [PATCH 69/75] Fix: Installer - Scopes, Code Order --- Install.ps1 | 77 +++++++++++++++++++++++++++-------------------------- 1 file changed, 39 insertions(+), 38 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index bb5311a..cb80c61 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -42,6 +42,22 @@ https://github.com/black7375/Firefox-UI-Fix#readme #> +[CmdletBinding( + SupportsShouldProcess = $true, + PositionalBinding = $false +)] + +param( + [Alias("u")] + [Switch]$updateMode, + [Alias("f")] + [string]$profileDir, + [Alias("p")] + [string]$profileName, + [Alias("h")] + [Switch]$help = $false +) + #** Helper Utils *************************************************************** #== Message ==================================================================== function Lepton-ErrorMessage() { @@ -83,7 +99,9 @@ function Install-Choco() { function Check-Git() { if( -Not (Get-Command git) ) { - Install-Choco + if ( -Not (Get-Command choco)) { + Install-Choco + } choco install git -y } @@ -193,7 +211,7 @@ function Get-IniContent () { ) $ini = @{} - switch ( -regex -file $filePath ) { + switch -regex -file $filePath { "^\[(.+)\]" { # Section $section = $matches[1] @@ -225,8 +243,7 @@ function Out-IniFile() { ) # Create new file - New-Item -Path "${filePath}" -Force - $local:outFile = New-Item -ItemType file -Path "${filepath}" + $local:outFile = New-Item -ItemType file -Path "${filepath}" -Force foreach ($i in $iniObject.keys) { if (!($($iniObject[$i].GetType().Name) -eq "Hashtable")) { @@ -364,11 +381,11 @@ function Check-ProfileDir() { ) if ( "${profileDir}" -ne "" ) { - $firefoxProfileDirPaths = @("${profileDir}") + $global:firefoxProfileDirPaths = @("${profileDir}") } - $firefoxProfileDirPaths = Filter-Path $firefoxProfileDirPaths "Container" + $global:firefoxProfileDirPaths = Filter-Path $global:firefoxProfileDirPaths "Container" if ( $firefoxProfileDirPaths.Length -eq 0 ) { Lepton-ErrorMessage "Unable to find firefox profile dir." @@ -380,7 +397,7 @@ function Check-ProfileDir() { #== Profile Info =============================================================== $PROFILEINFOFILE="profiles.ini" function Check-ProfileIni() { - foreach ( $profileDir in $firefoxProfileDirPaths ) { + foreach ( $profileDir in $global:firefoxProfileDirPaths ) { if ( -Not (Test-Path -Path "${profileDir}\${PROFILEINFOFILE}" -PathType "Leaf") ) { Lepton-ErrorMessage "Unable to find ${PROFILEINFOFILE} at ${profileDir}" } @@ -392,9 +409,9 @@ function Check-ProfileIni() { #== Profile PATH =============================================================== $firefoxProfilePaths = @() function Update-ProfilePaths() { - foreach ( $profileDir in $firefoxProfileDirPaths ) { + foreach ( $profileDir in $global:firefoxProfileDirPaths ) { $local:iniContent = Get-IniContent "${profiledir}\${PROFILEINFOFILE}" - $firefoxProfilePaths += $iniContent.Values.Path + $global:firefoxProfilePaths += $iniContent.Values.Path } if ( $firefoxProfilePaths.Length -ne 0 ) { @@ -414,7 +431,7 @@ function Select-Profile() { if ( "${profileName}" -ne "" ) { $local:targetPath = "" - foreach ( $profilePath in $firefoxProfilePaths ) { + foreach ( $global:profilePath in $firefoxProfilePaths ) { if ( "${profilePath}" -like "*${profileName}" ) { $targetPath = "${profilePath}" break @@ -423,7 +440,7 @@ function Select-Profile() { if ( "${targetPath}" -ne "" ) { Lepton-OkMessage "Profile, `"${profileName}`" found" - $firefoxProfilePaths = @("${targetPath}") + $global:firefoxProfilePaths = @("${targetPath}") } else { Lepton-ErrorMessage "Unable to find ${profileName}" @@ -433,7 +450,7 @@ function Select-Profile() { Lepton-OkMessage "Auto detected profile" } else { - $firefoxProfilePaths = Menu $firefoxProfilePaths + $global:firefoxProfilePaths = Menu $firefoxProfilePaths if ( $firefoxProfilePaths.Length -eq 0 ) { Lepton-ErrorMessage "Please select profiles" @@ -450,7 +467,7 @@ function Select-Profile() { #== Lepton Info ================================================================ $LEPTONINFOFILE ="lepton.ini" function Check-LeptonIni() { - foreach ( $profileDir in $firefoxProfileDirPaths ) { + foreach ( $profileDir in $global:firefoxProfileDirPaths ) { if ( -Not (Test-Path -Path "${profileDir}\${LEPTONINFOFILE}") ) { Lepton-ErrorMessage "Unable to find ${LEPTONINFOFILE} at ${profileDir}" } @@ -469,7 +486,7 @@ function Write-LeptonInfo() { $local:output = @{} $local:prevDir = Split-Path $firefoxProfilePaths[0] -Parent $local:latestPath = ( $firefoxProfilePaths | Select-Object -Last 1 ) - foreach ( $profilePath in $firefoxProfilePaths ) { + foreach ( $profilePath in $global:firefoxProfilePaths ) { $local:LEPTONINFOPATH = "${profilePath}\chrome\${CHROMEINFOFILE}" $local:LEPTONGITPATH = "${profilePath}\chrome\.git" @@ -535,10 +552,10 @@ function Select-Distribution() { $local:selected = $false $local:selectedDistribution = Menu @("Original(default)", "Photon-Style", "Proton-Style", "Update") switch ( $selectedDistribution ) { - "Original(default)" { $leptonBranch = "master" ; $selected = $true } - "Photon-Style" { $leptonBranch = "photon-style"; $selected = $true } - "Proton-Style" { $leptonBranch = "proton-style"; $selected = $true } - "Update" { $updateMode = $true ; $selected = $true } + "Original(default)" { $global:leptonBranch = "master" ; $selected = $true } + "Photon-Style" { $global:leptonBranch = "photon-style"; $selected = $true } + "Proton-Style" { $global:leptonBranch = "proton-style"; $selected = $true } + "Update" { $global:updateMode = $true ; $selected = $true } default { Write-Host "Invalid option, reselect please." } } @@ -562,7 +579,7 @@ function Check-InstallType() { $local:foundCount = (Filter-Path $targetList ).Length if ( "${targetCount}" -eq "${foundCount}" ) { - $leptonInstallType="${installType}" + $global:leptonInstallType="${installType}" } } @@ -597,7 +614,7 @@ function Check-InstallTypes() { $chromeDuplicate = $false function Check-ChromeExist() { if ( Test-Path -Path "chrome" -and -Not (Test-Path -Path "chrome\${LEPTONINFOFILE}") ) { - $chromeDuplicate = $true + $global:chromeDuplicate = $true Move-Auto "chrome" "chrome.bak" Lepton-OkMessage "Backup files" } @@ -641,7 +658,7 @@ function Copy-Lepton() { [string] $userJSPath = "${chromeDir}\user.js" ) - foreach ( $profilePath in $firefoxProfilePaths ) { + foreach ( $profilePath in $global:firefoxProfilePaths ) { Copy-Auto "${userJSPath}" "${profilePath}\user.js" Copy-Auto "${chromeDir}" "${profilePath}\chrome" } @@ -684,7 +701,7 @@ function Install-Profile() { #** Update ********************************************************************* function Update-Profile() { Check-Git - foreach ( $profileDir in $firefoxProfileDirPaths ) { + foreach ( $profileDir in $global:firefoxProfileDirPaths ) { $local:LEPTONINFOPATH = "${profileDir}\${LEPTONINFOFILE}" $local:LEPTONINFO = Get-IniContent "${LEPTONINFOPATH}" $local:sections = $LEPTONINFO.Keys @@ -727,22 +744,6 @@ function Update-Profile() { } #** Main *********************************************************************** -[CmdletBinding( - SupportsShouldProcess = $true, - PositionalBinding = $false -)] - -param( - [Alias("u")] - [Switch]$updateMode, - [Alias("f")] - [string]$profileDir, - [Alias("p")] - [string]$profileName, - [Alias("h")] - [Switch]$help = $false -) - function Check-Help { # Cheap and dirty way of getting the same output as '-?' for '-h' and '-Help' if ($help) { From cd394cac3f0a84c663f3f2abb283b5b646d0635e Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 26 Jul 2021 09:52:46 +0900 Subject: [PATCH 70/75] Fix: Installer - ProfileDir Path --- install.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index 31dfb8f..2433a62 100755 --- a/install.sh +++ b/install.sh @@ -475,11 +475,21 @@ check_lepton_ini() { # We should always create a new one, as it also takes into account the possibility of setting it manually. # Updates happen infrequently, so the creation overhead is less significant. +get_profile_dir() { + local profilePath="$1" + for profileDir in "${firefoxProfileDirPaths[@]}"; do + if [[ "${profilePath}" == "${profileDir}"* ]]; then + echo "${profileDir}" + return 0 + fi + done +} + CHROMEINFOFILE="LEPTON" write_lepton_info() { # Init info local output="" - local prevDir=$(dirname "${firefoxProfilePaths[0]}") + local prevDir="$firefoxProfileDirPaths[0]" local latestPath="${firefoxProfilePaths[${#firefoxProfilePaths[@]} - 1]}" for profilePath in "${firefoxProfilePaths[@]}"; do local LEPTONINFOPATH="${profilePath}/chrome/${CHROMEINFOFILE}" @@ -509,7 +519,7 @@ write_lepton_info() { fi # Flushing - local profileDir=$(dirname "${profilePath}") + local profileDir=$(get_profile_dir "${profilePath}") local profileName=$(basename "${profilePath}") if [ "${prevDir}" != "${profileDir}" ]; then write_file "${prevDir}/${LEPTONINFOFILE}" "${output}" From 04381d738cbe51ba24b566c12ffe79e7dd02b348 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Mon, 26 Jul 2021 10:32:56 +0900 Subject: [PATCH 71/75] Fix: Installer - Exceptions --- Install.ps1 | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index cb80c61..fe82485 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -226,6 +226,12 @@ function Get-IniContent () { $ini[$section][$name] = $value } "(.+?)\s*=(.*)" { + # For compatibility + if ( $section -eq $null ) { + $section = "Info" + $ini[$section] = @{} + } + # Key $name,$value = $matches[1..2] $ini[$section][$name] = $value @@ -410,8 +416,8 @@ function Check-ProfileIni() { $firefoxProfilePaths = @() function Update-ProfilePaths() { foreach ( $profileDir in $global:firefoxProfileDirPaths ) { - $local:iniContent = Get-IniContent "${profiledir}\${PROFILEINFOFILE}" - $global:firefoxProfilePaths += $iniContent.Values.Path + $local:iniContent = Get-IniContent "${profileDir}\${PROFILEINFOFILE}" + $global:firefoxProfilePaths += $iniContent.Values.Path | ForEach-Object { "${profileDir}\${PSItem}" } } if ( $firefoxProfilePaths.Length -ne 0 ) { @@ -480,11 +486,23 @@ function Check-LeptonIni() { # We should always create a new one, as it also takes into account the possibility of setting it manually. # Updates happen infrequently, so the creation overhead is less significant. +function Get-ProfileDir() { + Param ( + [Parameter(Mandatory=$true, Position=0)] + [string] $profilePath + ) + foreach ( $profileDir in $firefoxProfileDirPaths ) { + if ( "$profilePath" -like "${profileDir}*" ) { + return "$profileDir" + } + } +} + $CHROMEINFOFILE="LEPTON" function Write-LeptonInfo() { # Init info $local:output = @{} - $local:prevDir = Split-Path $firefoxProfilePaths[0] -Parent + $local:prevDir = $firefoxProfileDirPaths[0] $local:latestPath = ( $firefoxProfilePaths | Select-Object -Last 1 ) foreach ( $profilePath in $global:firefoxProfilePaths ) { $local:LEPTONINFOPATH = "${profilePath}\chrome\${CHROMEINFOFILE}" @@ -516,7 +534,7 @@ function Write-LeptonInfo() { } # Flushing - $local:profileDir = Split-Path "${profilePath}" -Parent + $local:profileDir = Get-ProfileDir "${profilePath}" $local:profileName = Split-Path "${profilePath}" -Leaf if ( "${prevDir}" -ne "${profileDir}" ) { Out-IniFile "${prevDir}\${LEPTONINFOFILE}" $output From 1f3220e09eed63c066a06d41fe9de19e67ae2a04 Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 27 Jul 2021 09:03:55 +0900 Subject: [PATCH 72/75] Fix: Installer - ini property --- Install.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Install.ps1 b/Install.ps1 index fe82485..8cf1744 100644 --- a/Install.ps1 +++ b/Install.ps1 @@ -543,8 +543,8 @@ function Write-LeptonInfo() { # Make output contents foreach ( $key in @("Type", "Branch", "Ver", "Path") ) { - $local:value = Get-Variable -Name "${key}" - if ( "$value" -ne $null ) { + $local:value = (Get-Variable -Name "${key}").Value + if ( "$value" -ne "" ) { $output["${profileName}"] += @{"${key}" = "${value}"} } } From 29dc3ce5a9a4c9ff2447545eff79f8ab3856399a Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Wed, 28 Jul 2021 23:15:22 +0900 Subject: [PATCH 73/75] Doc: powershell script prototype by @jammehcow --- CREDITS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CREDITS b/CREDITS index b45fa74..bfe8a5c 100644 --- a/CREDITS +++ b/CREDITS @@ -96,6 +96,9 @@ N: Burak Yigit Kaya E: ben@byk.im W: https://byk.im/ +N: James Upjohn +E: jammehcow@jammehcow.co.nz + N: mamen W: https://www.mamen.at From 8b7f8a10b6f62174ab3faa94a07440a44986037a Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Thu, 29 Jul 2021 09:33:27 +0900 Subject: [PATCH 74/75] Clean: change powershell installer name --- Install.ps1 => install.ps1 | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Install.ps1 => install.ps1 (100%) diff --git a/Install.ps1 b/install.ps1 similarity index 100% rename from Install.ps1 rename to install.ps1 From 662c40a788d5ee89cd6bfd6ec23a150525009948 Mon Sep 17 00:00:00 2001 From: MS_Y Date: Thu, 29 Jul 2021 00:44:43 +0000 Subject: [PATCH 75/75] Doc: for v3.0 --- README.org | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/README.org b/README.org index b2a5d3a..05c4cf6 100644 --- a/README.org +++ b/README.org @@ -32,6 +32,10 @@ (Lepton's design :arrow_up:) - *Color* + - Default light/dark theme constrast enhancement + - Colorful context menu + - More dark mode support + - GTK system theme support - Windows system theme support - Windows7 compatibility - *Icons* @@ -42,6 +46,7 @@ - Panel - Menu - Density + - Others... - *Tab Design* - General: - Connect with toolbar(Buttons like tabs) @@ -75,10 +80,15 @@ *Script Installation(experimental)* Linux, mac users: - #+BEGIN_SRC + #+BEGIN_SRC bash bash -c "$(curl -fsSL https://raw.githubusercontent.com/black7375/Firefox-UI-Fix/master/install.sh)" #+END_SRC + Windows users: Run powershell as administrator + #+BEGIN_SRC powershell + Powershell -c "iwr https://raw.githubusercontent.com/black7375/Firefox-UI-Fix/master/install.ps1 -useb | iex" + #+END_SRC + *Menual Inatallation* You can see the [[https://github.com/black7375/Firefox-UI-Fix/wiki/Installation-Guide][installation guide]] with screenshots on the wiki.