Skip to content

Commit

Permalink
(JS) update restorePreProtonArrowpanels.uc.js
Browse files Browse the repository at this point in the history
(CSS) change the margins of urlbar/searchbar to fix a visual jank.
update app menu banner styles.
  • Loading branch information
aminomancer committed Sep 30, 2022
1 parent 1ac8b46 commit 19df71b
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 103 deletions.
182 changes: 97 additions & 85 deletions JS/restorePreProtonArrowpanels.uc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ==UserScript==
// @name Restore pre-Proton Arrowpanels
// @version 1.2.0
// @version 1.2.1
// @author aminomancer
// @homepage https://github.com/aminomancer/uc.css.js
// @description This script will basically restore the arrows at the corner
Expand All @@ -17,103 +17,115 @@
// ==/UserScript==

(function() {
let { PopupNotifications } = ChromeUtils.import("resource://gre/modules/PopupNotifications.jsm");
if (PopupNotifications.prototype._showPanel.name === "PopupNotifications_showPanel") {
const NOTIFICATION_EVENT_SHOWING = "showing";
const NOTIFICATION_EVENT_SHOWN = "shown";
const TELEMETRY_STAT_OFFERED = 0;
eval(
`PopupNotifications.prototype._showPanel = function ` +
PopupNotifications.prototype._showPanel
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^function\s*/, "")
.replace(/^PopupNotifications_showPanel\s*/, "")
.replace(/^(.)/, `uc_PopupNotifications_showPanel$1`)
.replace(/bottomleft/, "bottomcenter")
(function() {
let { PopupNotifications } = ChromeUtils.importESModule(
"resource://gre/modules/PopupNotifications.sys.mjs"
);
}

let { ExtensionsUI } = ChromeUtils.import("resource:///modules/ExtensionsUI.jsm");
if (ExtensionsUI.showPermissionsPrompt.name === "showPermissionsPrompt") {
const DEFAULT_EXTENSION_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
function getTabBrowser(browser) {
while (browser.ownerGlobal.docShell.itemType !== Ci.nsIDocShell.typeChrome) {
browser = browser.ownerGlobal.docShell.chromeEventHandler;
}
let window = browser.ownerGlobal;
let viewType = browser.getAttribute("webextension-view-type");
if (viewType == "sidebar") {
window = window.browsingContext.topChromeWindow;
if (PopupNotifications.prototype._showPanel.name === "PopupNotifications_showPanel") {
const NOTIFICATION_EVENT_SHOWING = "showing";
const NOTIFICATION_EVENT_SHOWN = "shown";
const TELEMETRY_STAT_OFFERED = 0;
eval(
`PopupNotifications.prototype._showPanel = function ` +
PopupNotifications.prototype._showPanel
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^function\s*/, "")
.replace(/^PopupNotifications_showPanel\s*/, "")
.replace(/^(.)/, `uc_PopupNotifications_showPanel$1`)
.replace(/bottomleft/, "bottomcenter")
);
}
})();

(function() {
let { ExtensionsUI } = ChromeUtils.import("resource:///modules/ExtensionsUI.jsm");
if (ExtensionsUI.showPermissionsPrompt.name === "showPermissionsPrompt") {
const DEFAULT_EXTENSION_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
function getTabBrowser(browser) {
while (browser.ownerGlobal.docShell.itemType !== Ci.nsIDocShell.typeChrome) {
browser = browser.ownerGlobal.docShell.chromeEventHandler;
}
let window = browser.ownerGlobal;
let viewType = browser.getAttribute("webextension-view-type");
if (viewType == "sidebar") {
window = window.browsingContext.topChromeWindow;
}
if (viewType == "popup" || viewType == "sidebar") {
browser = window.gBrowser.selectedBrowser;
}
return { browser, window };
}
if (viewType == "popup" || viewType == "sidebar") {
browser = window.gBrowser.selectedBrowser;
eval(
`ExtensionsUI.showPermissionsPrompt = async function ` +
ExtensionsUI.showPermissionsPrompt
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^async\s*/, "")
.replace(/^function\s*/, "")
.replace(/^showPermissionsPrompt\s*/, "")
.replace(/^(.)/, `uc_showPermissionsPrompt$1`)
.replace(/bottomright/, "bottomcenter")
);
if (ExtensionsUI.showDefaultSearchPrompt.name === "showDefaultSearchPrompt") {
eval(
`ExtensionsUI.showDefaultSearchPrompt = async function ` +
ExtensionsUI.showDefaultSearchPrompt
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^function\s*/, "")
.replace(/^showDefaultSearchPrompt\s*/, "")
.replace(/^(.)/, `uc_showDefaultSearchPrompt$1`)
.replace(/bottomright/, "bottomcenter")
);
}
return { browser, window };
}
eval(
`ExtensionsUI.showPermissionsPrompt = async function ` +
ExtensionsUI.showPermissionsPrompt
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^async\s*/, "")
.replace(/^function\s*/, "")
.replace(/^showPermissionsPrompt\s*/, "")
.replace(/^(.)/, `uc_showPermissionsPrompt$1`)
.replace(/bottomright/, "bottomcenter")
);
if (ExtensionsUI.showDefaultSearchPrompt.name === "showDefaultSearchPrompt") {
})();

(function() {
let { UITour } = ChromeUtils.import("resource:///modules/UITour.jsm");
if (UITour.showInfo.name === "showInfo") {
const lazy = {
log: { warn() {} },
};
eval(
`ExtensionsUI.showDefaultSearchPrompt = async function ` +
ExtensionsUI.showDefaultSearchPrompt
`UITour.showInfo = async function ` +
UITour.showInfo
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^async\s*/, "")
.replace(/^function\s*/, "")
.replace(/^showDefaultSearchPrompt\s*/, "")
.replace(/^(.)/, `uc_showDefaultSearchPrompt$1`)
.replace(/^showInfo\s*/, "")
.replace(/^(.)/, `uc_showInfo$1`)
.replace(/bottomright/, "bottomcenter")
);
}
}

let { UITour } = ChromeUtils.import("resource:///modules/UITour.jsm");
if (UITour.showInfo.name === "showInfo") {
const lazy = {
log: { warn() {} },
};
eval(
`UITour.showInfo = async function ` +
UITour.showInfo
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^async\s*/, "")
.replace(/^function\s*/, "")
.replace(/^showInfo\s*/, "")
.replace(/^(.)/, `uc_showInfo$1`)
.replace(/bottomright/, "bottomcenter")
);
}
})();

let { CustomizeMode } = ChromeUtils.import("resource:///modules/CustomizeMode.jsm");
if (CustomizeMode.prototype._showDownloadsAutoHidePanel.name === "_showDownloadsAutoHidePanel") {
eval(
`CustomizeMode.prototype._showDownloadsAutoHidePanel = async function ` +
CustomizeMode.prototype._showDownloadsAutoHidePanel
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^async\s*/, "")
.replace(/^function\s*/, "")
.replace(/^_showDownloadsAutoHidePanel\s*/, "")
.replace(/^(.)/, `uc_showDownloadsAutoHidePanel$1`)
.replace(/topleft topright/, "leftcenter topright")
.replace(/topright topleft/, "rightcenter topleft")
);
}
(function() {
let { CustomizeMode } = ChromeUtils.import("resource:///modules/CustomizeMode.jsm");
if (
CustomizeMode.prototype._showDownloadsAutoHidePanel.name === "_showDownloadsAutoHidePanel"
) {
eval(
`CustomizeMode.prototype._showDownloadsAutoHidePanel = async function ` +
CustomizeMode.prototype._showDownloadsAutoHidePanel
.toSource()
.replace(/^\(/, "")
.replace(/\)$/, "")
.replace(/^async\s*/, "")
.replace(/^function\s*/, "")
.replace(/^_showDownloadsAutoHidePanel\s*/, "")
.replace(/^(.)/, `uc_showDownloadsAutoHidePanel$1`)
.replace(/topleft topright/, "leftcenter topright")
.replace(/topright topleft/, "rightcenter topleft")
);
}
})();

let dummyNotification = document.createXULElement("notification", {
is: "translation-notification",
Expand Down
2 changes: 2 additions & 0 deletions uc-app-menu.css
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@
background-image: url(chrome://userchrome/content/help-square.svg);
}

.panel-banner-item > .toolbarbutton-text,
.addon-banner-item > .toolbarbutton-text,
#appMenu-save-file-button2 > .toolbarbutton-text,
#appMenu-more-button2 > .toolbarbutton-text,
#appMenu-help-button2 > .toolbarbutton-text,
Expand Down
1 change: 1 addition & 0 deletions uc-findbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ findbar[hidden] {
border-radius: 0 !important;
outline: none !important;
height: var(--findbar-height, 22px) !important;
box-sizing: border-box !important;
padding-inline: 6px !important;
-moz-box-flex: 1 !important;
}
Expand Down
11 changes: 4 additions & 7 deletions uc-navbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ if it's visible in the row beneath the tabs then it's probably in here. */
border: none !important;
}

#customization-palette toolbarpaletteitem {
transform-style: preserve-3d !important;
}

toolbarpaletteitem > toolbarspring {
margin-block: calc((var(--urlbar-container-height) - var(--urlbar-height)) / 2) !important;
outline: none !important;
Expand All @@ -33,13 +37,6 @@ toolbarpaletteitem[place="palette"] > toolbarspring {
margin-inline: 2px !important;
}

#wrapper-urlbar-container + toolbarpaletteitem > #search-container,
#nav-bar[customizing="true"] #urlbar-container + #search-container,
#wrapper-search-container + toolbarpaletteitem > #urlbar-container,
#nav-bar[customizing="true"] #search-container + #urlbar-container {
margin-inline-start: 1px !important;
}

/* toolbar button badges */
:is(.customization-target, .widget-overflow-list)
:is(toolbarbutton, toolbaritem):not([attention])
Expand Down
17 changes: 6 additions & 11 deletions uc-urlbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,20 @@ that includes all the icons, page actions, etc. */
}

#urlbar-container {
margin-inline: 3px !important;
margin-inline: var(--urlbar-margin-inline, 3px) !important;
padding-block: calc((var(--urlbar-container-height) - var(--urlbar-height)) / 2) !important;
}

toolbarpaletteitem[place="palette"] > #search-container {
min-height: 32px !important;
max-height: 32px !important;
padding-block: 0 !important;
margin-block: 5px !important;
margin: 5px 0 !important;
}

#nav-bar-customization-target #search-container {
padding-block: 0 !important;
margin-inline: 3px !important;
margin-inline: var(--urlbar-margin-inline, 3px) !important;
height: var(--urlbar-container-height) !important;
min-height: var(--urlbar-container-height) !important;
}
Expand Down Expand Up @@ -136,8 +136,9 @@ toolbarpaletteitem[place="palette"] > #search-container {
}

#urlbar-search-splitter {
min-width: 12px !important;
margin-inline: -7px !important;
min-width: 6px !important;
margin-inline: -3px !important;
z-index: 1 !important;
}

#PopupSearchAutoComplete {
Expand Down Expand Up @@ -438,7 +439,6 @@ the NTP/home page hasn't opened yet. */
/* iffy modification to center urlbar buttons not contained in page action button box */
#urlbar-input-container {
-moz-box-align: center;
z-index: 11;
}

#plugins-notification-icon {
Expand Down Expand Up @@ -974,11 +974,6 @@ urlbarMods.uc.js assigns them custom classes .aboutBlockedPage and
opacity: revert !important;
}

#wrapper-urlbar-container,
#wrapper-search-container {
-moz-box-flex: 1 !important;
}

:root[customizing]
#wrapper-urlbar-container[removable="false"]
#urlbar
Expand Down
1 change: 1 addition & 0 deletions uc-variables.css
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ menupopup {
--urlbar-container-height: var(--uc-urlbar-container-height) !important;
--urlbar-height: calc(var(--urlbar-container-height) - 6px) !important;
--urlbar-container-padding: 1px !important;
--urlbar-margin-inline: 2px !important;
--urlbar-icon-border-radius: var(--general-button-border-radius) !important;
--urlbar-icon-fill-opacity: 0.6 !important;
--urlbar-popup-url-color: var(--purple-35) !important;
Expand Down

0 comments on commit 19df71b

Please sign in to comment.