Skip to content

Commit

Permalink
(JS) update privateTabs.uc.js to fix an oversight.
Browse files Browse the repository at this point in the history
(CSS) update onboarding styles.
update appearance of urlbar tip results.
  • Loading branch information
aminomancer committed Sep 14, 2022
1 parent 6524213 commit 87954d6
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 49 deletions.
39 changes: 21 additions & 18 deletions JS/privateTabs.uc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Private Tabs
// @version 1.2.1
// @version 1.2.2
// @author aminomancer
// @homepage https://github.com/aminomancer
// @description An fx-autoconfig port of Private Tab by xiaoxiaoflood. Adds
Expand Down Expand Up @@ -48,12 +48,14 @@ class PrivateTabManager {
// the internal duplicateTab method doesn't pass the skipAnimation parameter
// to addTrustedTab. so we need to make our own function, which requires us
// to access some private objects.
let { SessionStoreInternal, TAB_CUSTOM_VALUES } = ChromeUtils.import(
// eslint-disable-next-line mozilla/use-chromeutils-import
let { SessionStoreInternal, TAB_CUSTOM_VALUES } = Cu.import(
"resource:///modules/sessionstore/SessionStore.jsm"
);
this.SSI = SessionStoreInternal;
this.TAB_CUSTOM_VALUES = TAB_CUSTOM_VALUES;
XPCOMUtils.defineLazyModuleGetters(this, {
Management: "resource://gre/modules/Extension.jsm",
TabState: "resource:///modules/sessionstore/TabState.jsm",
TabStateFlusher: "resource:///modules/sessionstore/TabStateFlusher.jsm",
ContextualIdentityService: "resource://gre/modules/ContextualIdentityService.jsm",
Expand Down Expand Up @@ -322,19 +324,17 @@ class PrivateTabManager {
);
}

let { UUIDMap } = ChromeUtils.import("resource://gre/modules/Extension.jsm");
const { WebExtensionPolicy } = Cu.getGlobalForObject(Services);
let TST_ID = "treestyletab@piro.sakura.ne.jp";
this.TST_UUID = UUIDMap.get(TST_ID, false);

if (this.TST_UUID) this.setTstStyle(this.TST_UUID);
if (AddonManager && location.href === "chrome://browser/content/browser.xhtml") {
AddonManager.addAddonListener({
onInstalled: addon => {
if (addon.id == TST_ID) this.setTstStyle(UUIDMap.get(TST_ID, false));
},
onUninstalled: addon => {
if (addon.id == TST_ID) this.sss.unregisterSheet(this.TST_STYLE.url, this.TST_STYLE.type);
},
this.setTstStyle(WebExtensionPolicy.getByID(TST_ID)?.getURL());
if (location.href === "chrome://browser/content/browser.xhtml") {
this.Management.on("ready", (_ev, extension) => {
if (extension.id === TST_ID) this.setTstStyle(extension.getURL());
});
this.Management.on("uninstall", (_ev, extension) => {
if (extension.id === TST_ID && this.TST_STYLE) {
this.sss.unregisterSheet(this.TST_STYLE.uri, this.TST_STYLE.type);
}
});
}

Expand Down Expand Up @@ -603,17 +603,20 @@ class PrivateTabManager {
};
}

setTstStyle(uuid) {
setTstStyle(baseURL) {
if (!baseURL) return;
this.TST_STYLE = {
url: Services.io.newURI(
uri: Services.io.newURI(
"data:text/css;charset=UTF-8," +
encodeURIComponent(
`@-moz-document url-prefix(moz-extension://${uuid}/sidebar/sidebar.html) { .tab.contextual-identity-firefox-container-${this.container.userContextId} .label-content { text-decoration: underline !important; text-decoration-color: -moz-nativehyperlinktext !important; text-decoration-style: dashed !important; } .tab.contextual-identity-firefox-container-${this.container.userContextId} tab-favicon { border-bottom: 1px dashed -moz-nativehyperlinktext !important;}}`
`@-moz-document url-prefix(${baseURL}sidebar/sidebar.html) { .tab.contextual-identity-firefox-container-${this.container.userContextId} .label-content { text-decoration: underline !important; text-decoration-color: -moz-nativehyperlinktext !important; text-decoration-style: dashed !important; } .tab.contextual-identity-firefox-container-${this.container.userContextId} tab-favicon { border-bottom: 1px dashed -moz-nativehyperlinktext !important;}}`
)
),
type: this.sss.USER_SHEET,
};
this.sss.loadAndRegisterSheet(this.TST_STYLE.url, this.TST_STYLE.type);
if (!this.sss.sheetRegistered(this.TST_STYLE.uri, this.TST_STYLE.type)) {
this.sss.loadAndRegisterSheet(this.TST_STYLE.uri, this.TST_STYLE.type);
}
}
}

Expand Down
6 changes: 6 additions & 0 deletions resources/in-content/system.css
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,12 @@
word-wrap: anywhere;
}

.onboardingContainer.featureCallout .screen[pos="callout"] .section-main .main-content,
.onboardingContainer.featureCallout.arrow-inline-end::before {
background-color: var(--newtab-background-color-secondary) !important;
border-color: var(--fxview-contrast-border) !important;
}

@-moz-document regexp("^about:blocked.*") {
html:root,
html:root * {
Expand Down
7 changes: 6 additions & 1 deletion uc-extensions.css
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,16 @@ menupopup#viewSidebarMenu
}

/* Want My RSS */
:is(.pageAction-panel-button, .urlbar-page-action)[actionid="_4d567245-e70d-466a-bb2f-390fc7fb25c2_"] {
:is(.pageAction-panel-button, .urlbar-page-action)[actionid="_4d567245-e70d-466a-bb2f-390fc7fb25c2_"i] {
--pageAction-image-16px: url(chrome://userchrome/content/material/rss.svg) !important;
--pageAction-image-32px: url(chrome://userchrome/content/material/rss.svg) !important;
}

:is(.webextension-browser-action, .eom-addon-button)[data-extensionid="{4d567245-e70d-466a-bb2f-390fc7fb25c2}"i]
.toolbarbutton-icon {
list-style-image: url(chrome://userchrome/content/material/rss.svg);
}

/* sort bookmarks */
:is(.webextension-browser-action, .eom-addon-button)[data-extensionid="sort-bookmarks@heftig"]
.toolbarbutton-icon {
Expand Down
2 changes: 1 addition & 1 deletion uc-misc.css
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ toolbar:not(#PersonalToolbar) .toolbarbutton-1:focus-visible > .toolbarbutton-ba

.urlbarView-tip-button {
font-family: SF Pro Text, SF Arabic, Segoe UI, sans-serif !important;
font-weight: var(--uc-font-weight-bold, 600) !important;
font-weight: var(--uc-font-weight-semibold, 600) !important;
}

.popup-notification-body input[type="password"] {
Expand Down
10 changes: 9 additions & 1 deletion uc-popups.css
Original file line number Diff line number Diff line change
Expand Up @@ -1926,7 +1926,7 @@ link[href="chrome://global/content/printPagination.css"]
background-color: var(--uc-places-cell-hover-bgcolor) !important;
}

#viewGroup > radio[focused="true"] .radio-label-box {
#viewGroup:focus-visible > radio[focused="true"] .radio-label-box {
outline: var(--global-focus-outline, auto) !important;
}

Expand Down Expand Up @@ -2227,4 +2227,12 @@ link[href="chrome://global/content/printPagination.css"]
#perm-microphone-row .permissionLabel {
background-image: url(chrome://userchrome/content/notifications/microphone.svg);
}

@supports -moz-bool-pref("userChrome.css.mac-ui-fonts") {
strong,
.header,
.permissionLabel {
font-weight: var(--uc-font-weight-extrabold, 600) !important;
}
}
}
38 changes: 10 additions & 28 deletions uc-urlbar-results.css
Original file line number Diff line number Diff line change
Expand Up @@ -468,15 +468,6 @@ by underlining them (requires urlbarMods.uc.js) */
margin: 0 !important;
}

.urlbarView .urlbarView-row[type="tip"] > .urlbarView-row-inner {
border: none !important;
padding-block: 6px !important;
margin: 0 !important;
min-height: unset !important;
max-height: -moz-fit-content !important;
height: unset !important;
}

.urlbarView-tip-button,
.urlbarView-tip-help {
margin-block: unset !important;
Expand All @@ -492,8 +483,12 @@ by underlining them (requires urlbarMods.uc.js) */
}

.urlbarView-tip-button {
padding-inline: 6px !important;
padding-block: 3px !important;
padding-inline: 10px !important;
padding-block: 4px !important;
margin-inline-end: -3px !important;
font-size: 0.9em !important;
background-clip: revert !important;
min-width: revert !important;
}

.urlbarView-tip-help {
Expand Down Expand Up @@ -525,20 +520,6 @@ by underlining them (requires urlbarMods.uc.js) */
margin: 0 !important;
}

.urlbarView-row[type="tip"] > .urlbarView-row-inner > .urlbarView-favicon,
.urlbarView-row[type="tip"] > .urlbarView-row-inner > .urlbarView-title,
.urlbarView-row[type="tip"] > .urlbarView-row-inner > .urlbarView-help,
.urlbarView-tip-button {
margin-block-end: revert !important;
}

.urlbarView-row[type="tip"] > .urlbarView-row-inner > .urlbarView-title {
white-space: normal;
flex-basis: revert !important;
flex-grow: 0 !important;
flex-shrink: 0 !important;
}

.urlbarView-row .urlbarView-row-inner > .urlbarView-no-wrap > .urlbarView-title-separator,
.urlbarView-dynamic-calculator-action::before,
.urlbarView-dynamic-unitConversion-action::before {
Expand Down Expand Up @@ -586,7 +567,7 @@ by underlining them (requires urlbarMods.uc.js) */
.urlbarView-row[has-url] .urlbarView-title,
.urlbarView-row:not([has-action]) .urlbarView-title:has(strong),
.urlbarView-row .urlbarView-tag,
.urlbarView-row:where([type="tabtosearch"], [type="tokenaliasengine"]) .urlbarView-title,
.urlbarView-row:where([type="tabtosearch"], [type="tokenaliasengine"], [type="tip"]) .urlbarView-title,
.urlbarView-row:not([has-url])
.urlbarView-title[data-l10n-id="urlbar-result-action-search-w-engine"],
.urlbarView-tail-prefix {
Expand All @@ -600,7 +581,7 @@ by underlining them (requires urlbarMods.uc.js) */
color: var(--panel-shortcut-color);
}

.urlbarView-row:where([type="tabtosearch"], [type="tokenaliasengine"])[selected] .urlbarView-title,
.urlbarView-row:where([type="tabtosearch"], [type="tokenaliasengine"], [type="tip"])[selected] .urlbarView-title,
.urlbarView-row[has-action][selected] .urlbarView-title strong,
.urlbarView-row[has-action][selected] .urlbarView-title[isurl],
.urlbarView-row[type="bookmark"][selected]:not([has-url]) .urlbarView-title,
Expand Down Expand Up @@ -704,7 +685,8 @@ by underlining them (requires urlbarMods.uc.js) */

.urlbarView-row[engine="Google"]:is([type="tabtosearch"], [type="tokenaliasengine"])
.urlbarView-favicon,
.urlbarView-row[engine="Google"][type="search"] .urlbarView-favicon[src]:not([src^="chrome"]) {
.urlbarView-row[engine="Google"][type="search"] .urlbarView-favicon[src]:not([src^="chrome"]),
.urlbarView-row[type="tip"] .urlbarView-favicon[src="moz-extension://cd4aad93-9726-49dd-a5cd-9e5f5c4d76f4/favicon.ico"] {
box-sizing: border-box !important;
background: url(chrome://userchrome/content/engines/google.svg) no-repeat !important;
width: 16px !important;
Expand Down

0 comments on commit 87954d6

Please sign in to comment.