From c9ec7bc97b92c735bd310290041232600d468b0c Mon Sep 17 00:00:00 2001 From: alstjr7375 Date: Tue, 28 Dec 2021 14:10:56 +0900 Subject: [PATCH] Clean: Remove `userChrome.tab.shareProton` --- __tests__/option.test.scss | 21 +++++++++++ src/padding/_index.scss | 8 ++--- src/tabbar/_container_tab.scss | 2 +- src/tabbar/_unselected_tab.scss | 4 ++- .../unselected_tab/_dynamic_separator.scss | 36 ++++++++----------- src/utils/_option.scss | 6 ++++ user.js | 3 -- 7 files changed, 49 insertions(+), 31 deletions(-) diff --git a/__tests__/option.test.scss b/__tests__/option.test.scss index 153c4ed..4aee947 100644 --- a/__tests__/option.test.scss +++ b/__tests__/option.test.scss @@ -21,3 +21,24 @@ } } } + +@include test-module("If not exist pref [mx]") { + @include test("simple") { + @include assert { + @include output { + @include option.NotOption("userChrome.tab.photon") { + body { + font-size: 16px; + } + } + } + @include expect { + @supports not -moz-bool-pref("userChrome.tab.photon") { + body { + font-size: 16px; + } + } + } + } + } +} diff --git a/src/padding/_index.scss b/src/padding/_index.scss index 092a0ee..5d8893b 100644 --- a/src/padding/_index.scss +++ b/src/padding/_index.scss @@ -85,7 +85,7 @@ padding-right: var(--newtab-button-width-padding) !important; } -@include Option("userChrome.tab.shareProton") { +@include NotOption("userChrome.tab.photon") { #tabbrowser-tabs[haspinnedtabs]:not([positionpinnedtabs]) > #tabbrowser-arrowscrollbox > .tabbrowser-tab[first-visible-unpinned-tab] { @@ -119,7 +119,7 @@ } /* Tab - Max Size */ -@include Option("userChrome.tab.shareProton") { +@include NotOption("userChrome.tab.photon") { :root { --tab-max-width: 240px; } @@ -134,7 +134,7 @@ } /* neighbouring tabs should "pinch" together */ -@include Option("userChrome.tab.shareProton") { +@include NotOption("userChrome.tab.photon") { .tabbrowser-tab { padding-inline: 1px !important; } @@ -162,7 +162,7 @@ } /* Toolbar Height */ -@include Option("userChrome.tab.shareProton") { +@include NotOption("userChrome.tab.photon") { :root:not([uidensity="touch"]) #TabsToolbar { --toolbarbutton-inner-padding: 9px; /* Original: calc((var(--tab-min-height) - 16px) / 2) = 10px */ } diff --git a/src/tabbar/_container_tab.scss b/src/tabbar/_container_tab.scss index 9b271c3..b8a84cf 100644 --- a/src/tabbar/_container_tab.scss +++ b/src/tabbar/_container_tab.scss @@ -1,4 +1,4 @@ -@include Option("userChrome.tab.shareProton") { +@include NotOption("userChrome.tab.photon") { .tab-context-line { display: none; } diff --git a/src/tabbar/_unselected_tab.scss b/src/tabbar/_unselected_tab.scss index bc29bc2..8049318 100644 --- a/src/tabbar/_unselected_tab.scss +++ b/src/tabbar/_unselected_tab.scss @@ -1,5 +1,7 @@ /*= Unselected Tab - Dynamic Separator =======================================*/ -@import "unselected_tab/dynamic_separator"; +@include NotOption("userChrome.tab.photon") { + @import "unselected_tab/dynamic_separator"; +} /*= Unselected Tab - Static Separator ========================================*/ @include Option("userChrome.tab.photon") { diff --git a/src/tabbar/unselected_tab/_dynamic_separator.scss b/src/tabbar/unselected_tab/_dynamic_separator.scss index bad5fa9..015c275 100644 --- a/src/tabbar/unselected_tab/_dynamic_separator.scss +++ b/src/tabbar/unselected_tab/_dynamic_separator.scss @@ -57,10 +57,8 @@ } } -@include Option("userChrome.tab.shareProton") { - .tabbrowser-tab:not([visuallyselected], [multiselected], :hover, :first-child) .tab-background::before { - opacity: var(--tab-separator-opacity); - } +.tabbrowser-tab:not([visuallyselected], [multiselected], :hover, :first-child) .tab-background::before { + opacity: var(--tab-separator-opacity); } @include Option("userChrome.tab.original") { #tabs-newtab-button:not(:hover, [open])::before { @@ -76,16 +74,14 @@ } } -@include Option("userChrome.tab.shareProton") { - #navigator-toolbox:not([movingtab]) - .tabbrowser-tab[first-visible-unpinned-tab]:is([visuallyselected], [multiselected], :hover) - .tab-background::before, - #navigator-toolbox:not([movingtab]) - #tabbrowser-arrowscrollbox[overflowing] - tab.tabbrowser-tab[first-visible-unpinned-tab] - .tab-background::before { - opacity: 0 !important; - } +#navigator-toolbox:not([movingtab]) + .tabbrowser-tab[first-visible-unpinned-tab]:is([visuallyselected], [multiselected], :hover) + .tab-background::before, +#navigator-toolbox:not([movingtab]) + #tabbrowser-arrowscrollbox[overflowing] + tab.tabbrowser-tab[first-visible-unpinned-tab] + .tab-background::before { + opacity: 0 !important; } @include Option("userChrome.tab.original") { #navigator-toolbox:not([movingtab]) @@ -112,10 +108,8 @@ /* Animate */ @media (prefers-reduced-motion: no-preference) { - @include Option("userChrome.tab.shareProton") { - .tab-background::before { - transition: opacity 0.2s var(--animation-easing-function); /* cubic-bezier(.07, .95, 0, 1) */ - } + .tab-background::before { + transition: opacity 0.2s var(--animation-easing-function); /* cubic-bezier(.07, .95, 0, 1) */ } @include Option("userChrome.tab.original") { #tabs-newtab-button::before { @@ -132,8 +126,6 @@ } /* Latest Tab & New tab margin */ -@include Option("userChrome.tab.shareProton") { - #tabbrowser-arrowscrollbox:not([overflowing]) .tabbrowser-tab[last-visible-tab] { - margin-inline-end: 1px !important; - } +#tabbrowser-arrowscrollbox:not([overflowing]) .tabbrowser-tab[last-visible-tab] { + margin-inline-end: 1px !important; } diff --git a/src/utils/_option.scss b/src/utils/_option.scss index 620f180..881b8ab 100644 --- a/src/utils/_option.scss +++ b/src/utils/_option.scss @@ -5,3 +5,9 @@ $tabProton: "userChrome.tab.proton"; @content; } } + +@mixin NotOption($optionName) { + @supports not -moz-bool-pref("#{$optionName}") { + @content; + } +} diff --git a/user.js b/user.js index fe833a2..f9919a5 100644 --- a/user.js +++ b/user.js @@ -27,9 +27,6 @@ user_pref("browser.newtabpage.activity-stream.improvesearch.handoffToAwesomebar" // user_pref("layout.css.prefers-color-scheme.content-override", 3); // ** Theme Related Options **************************************************** -user_pref("userChrome.tab.sharePhoton", true); // Original, Photon -user_pref("userChrome.tab.shareProton", true); // Original, Proton - user_pref("userChrome.tab.original", true); // Original // user_pref("userChrome.tab.photon", true); // Photon // user_pref("userChrome.tab.proton", true); // Proton