Skip to content

Commit 19df71b

Browse files
committed
(JS) update restorePreProtonArrowpanels.uc.js
(CSS) change the margins of urlbar/searchbar to fix a visual jank. update app menu banner styles.
1 parent 1ac8b46 commit 19df71b

6 files changed

+111
-103
lines changed

JS/restorePreProtonArrowpanels.uc.js

+97-85
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name Restore pre-Proton Arrowpanels
3-
// @version 1.2.0
3+
// @version 1.2.1
44
// @author aminomancer
55
// @homepage https://github.com/aminomancer/uc.css.js
66
// @description This script will basically restore the arrows at the corner
@@ -17,103 +17,115 @@
1717
// ==/UserScript==
1818

1919
(function() {
20-
let { PopupNotifications } = ChromeUtils.import("resource://gre/modules/PopupNotifications.jsm");
21-
if (PopupNotifications.prototype._showPanel.name === "PopupNotifications_showPanel") {
22-
const NOTIFICATION_EVENT_SHOWING = "showing";
23-
const NOTIFICATION_EVENT_SHOWN = "shown";
24-
const TELEMETRY_STAT_OFFERED = 0;
25-
eval(
26-
`PopupNotifications.prototype._showPanel = function ` +
27-
PopupNotifications.prototype._showPanel
28-
.toSource()
29-
.replace(/^\(/, "")
30-
.replace(/\)$/, "")
31-
.replace(/^function\s*/, "")
32-
.replace(/^PopupNotifications_showPanel\s*/, "")
33-
.replace(/^(.)/, `uc_PopupNotifications_showPanel$1`)
34-
.replace(/bottomleft/, "bottomcenter")
20+
(function() {
21+
let { PopupNotifications } = ChromeUtils.importESModule(
22+
"resource://gre/modules/PopupNotifications.sys.mjs"
3523
);
36-
}
37-
38-
let { ExtensionsUI } = ChromeUtils.import("resource:///modules/ExtensionsUI.jsm");
39-
if (ExtensionsUI.showPermissionsPrompt.name === "showPermissionsPrompt") {
40-
const DEFAULT_EXTENSION_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
41-
function getTabBrowser(browser) {
42-
while (browser.ownerGlobal.docShell.itemType !== Ci.nsIDocShell.typeChrome) {
43-
browser = browser.ownerGlobal.docShell.chromeEventHandler;
44-
}
45-
let window = browser.ownerGlobal;
46-
let viewType = browser.getAttribute("webextension-view-type");
47-
if (viewType == "sidebar") {
48-
window = window.browsingContext.topChromeWindow;
24+
if (PopupNotifications.prototype._showPanel.name === "PopupNotifications_showPanel") {
25+
const NOTIFICATION_EVENT_SHOWING = "showing";
26+
const NOTIFICATION_EVENT_SHOWN = "shown";
27+
const TELEMETRY_STAT_OFFERED = 0;
28+
eval(
29+
`PopupNotifications.prototype._showPanel = function ` +
30+
PopupNotifications.prototype._showPanel
31+
.toSource()
32+
.replace(/^\(/, "")
33+
.replace(/\)$/, "")
34+
.replace(/^function\s*/, "")
35+
.replace(/^PopupNotifications_showPanel\s*/, "")
36+
.replace(/^(.)/, `uc_PopupNotifications_showPanel$1`)
37+
.replace(/bottomleft/, "bottomcenter")
38+
);
39+
}
40+
})();
41+
42+
(function() {
43+
let { ExtensionsUI } = ChromeUtils.import("resource:///modules/ExtensionsUI.jsm");
44+
if (ExtensionsUI.showPermissionsPrompt.name === "showPermissionsPrompt") {
45+
const DEFAULT_EXTENSION_ICON = "chrome://mozapps/skin/extensions/extensionGeneric.svg";
46+
function getTabBrowser(browser) {
47+
while (browser.ownerGlobal.docShell.itemType !== Ci.nsIDocShell.typeChrome) {
48+
browser = browser.ownerGlobal.docShell.chromeEventHandler;
49+
}
50+
let window = browser.ownerGlobal;
51+
let viewType = browser.getAttribute("webextension-view-type");
52+
if (viewType == "sidebar") {
53+
window = window.browsingContext.topChromeWindow;
54+
}
55+
if (viewType == "popup" || viewType == "sidebar") {
56+
browser = window.gBrowser.selectedBrowser;
57+
}
58+
return { browser, window };
4959
}
50-
if (viewType == "popup" || viewType == "sidebar") {
51-
browser = window.gBrowser.selectedBrowser;
60+
eval(
61+
`ExtensionsUI.showPermissionsPrompt = async function ` +
62+
ExtensionsUI.showPermissionsPrompt
63+
.toSource()
64+
.replace(/^\(/, "")
65+
.replace(/\)$/, "")
66+
.replace(/^async\s*/, "")
67+
.replace(/^function\s*/, "")
68+
.replace(/^showPermissionsPrompt\s*/, "")
69+
.replace(/^(.)/, `uc_showPermissionsPrompt$1`)
70+
.replace(/bottomright/, "bottomcenter")
71+
);
72+
if (ExtensionsUI.showDefaultSearchPrompt.name === "showDefaultSearchPrompt") {
73+
eval(
74+
`ExtensionsUI.showDefaultSearchPrompt = async function ` +
75+
ExtensionsUI.showDefaultSearchPrompt
76+
.toSource()
77+
.replace(/^\(/, "")
78+
.replace(/\)$/, "")
79+
.replace(/^function\s*/, "")
80+
.replace(/^showDefaultSearchPrompt\s*/, "")
81+
.replace(/^(.)/, `uc_showDefaultSearchPrompt$1`)
82+
.replace(/bottomright/, "bottomcenter")
83+
);
5284
}
53-
return { browser, window };
5485
}
55-
eval(
56-
`ExtensionsUI.showPermissionsPrompt = async function ` +
57-
ExtensionsUI.showPermissionsPrompt
58-
.toSource()
59-
.replace(/^\(/, "")
60-
.replace(/\)$/, "")
61-
.replace(/^async\s*/, "")
62-
.replace(/^function\s*/, "")
63-
.replace(/^showPermissionsPrompt\s*/, "")
64-
.replace(/^(.)/, `uc_showPermissionsPrompt$1`)
65-
.replace(/bottomright/, "bottomcenter")
66-
);
67-
if (ExtensionsUI.showDefaultSearchPrompt.name === "showDefaultSearchPrompt") {
86+
})();
87+
88+
(function() {
89+
let { UITour } = ChromeUtils.import("resource:///modules/UITour.jsm");
90+
if (UITour.showInfo.name === "showInfo") {
91+
const lazy = {
92+
log: { warn() {} },
93+
};
6894
eval(
69-
`ExtensionsUI.showDefaultSearchPrompt = async function ` +
70-
ExtensionsUI.showDefaultSearchPrompt
95+
`UITour.showInfo = async function ` +
96+
UITour.showInfo
7197
.toSource()
7298
.replace(/^\(/, "")
7399
.replace(/\)$/, "")
100+
.replace(/^async\s*/, "")
74101
.replace(/^function\s*/, "")
75-
.replace(/^showDefaultSearchPrompt\s*/, "")
76-
.replace(/^(.)/, `uc_showDefaultSearchPrompt$1`)
102+
.replace(/^showInfo\s*/, "")
103+
.replace(/^(.)/, `uc_showInfo$1`)
77104
.replace(/bottomright/, "bottomcenter")
78105
);
79106
}
80-
}
81-
82-
let { UITour } = ChromeUtils.import("resource:///modules/UITour.jsm");
83-
if (UITour.showInfo.name === "showInfo") {
84-
const lazy = {
85-
log: { warn() {} },
86-
};
87-
eval(
88-
`UITour.showInfo = async function ` +
89-
UITour.showInfo
90-
.toSource()
91-
.replace(/^\(/, "")
92-
.replace(/\)$/, "")
93-
.replace(/^async\s*/, "")
94-
.replace(/^function\s*/, "")
95-
.replace(/^showInfo\s*/, "")
96-
.replace(/^(.)/, `uc_showInfo$1`)
97-
.replace(/bottomright/, "bottomcenter")
98-
);
99-
}
107+
})();
100108

101-
let { CustomizeMode } = ChromeUtils.import("resource:///modules/CustomizeMode.jsm");
102-
if (CustomizeMode.prototype._showDownloadsAutoHidePanel.name === "_showDownloadsAutoHidePanel") {
103-
eval(
104-
`CustomizeMode.prototype._showDownloadsAutoHidePanel = async function ` +
105-
CustomizeMode.prototype._showDownloadsAutoHidePanel
106-
.toSource()
107-
.replace(/^\(/, "")
108-
.replace(/\)$/, "")
109-
.replace(/^async\s*/, "")
110-
.replace(/^function\s*/, "")
111-
.replace(/^_showDownloadsAutoHidePanel\s*/, "")
112-
.replace(/^(.)/, `uc_showDownloadsAutoHidePanel$1`)
113-
.replace(/topleft topright/, "leftcenter topright")
114-
.replace(/topright topleft/, "rightcenter topleft")
115-
);
116-
}
109+
(function() {
110+
let { CustomizeMode } = ChromeUtils.import("resource:///modules/CustomizeMode.jsm");
111+
if (
112+
CustomizeMode.prototype._showDownloadsAutoHidePanel.name === "_showDownloadsAutoHidePanel"
113+
) {
114+
eval(
115+
`CustomizeMode.prototype._showDownloadsAutoHidePanel = async function ` +
116+
CustomizeMode.prototype._showDownloadsAutoHidePanel
117+
.toSource()
118+
.replace(/^\(/, "")
119+
.replace(/\)$/, "")
120+
.replace(/^async\s*/, "")
121+
.replace(/^function\s*/, "")
122+
.replace(/^_showDownloadsAutoHidePanel\s*/, "")
123+
.replace(/^(.)/, `uc_showDownloadsAutoHidePanel$1`)
124+
.replace(/topleft topright/, "leftcenter topright")
125+
.replace(/topright topleft/, "rightcenter topleft")
126+
);
127+
}
128+
})();
117129

118130
let dummyNotification = document.createXULElement("notification", {
119131
is: "translation-notification",

uc-app-menu.css

+2
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@
418418
background-image: url(chrome://userchrome/content/help-square.svg);
419419
}
420420

421+
.panel-banner-item > .toolbarbutton-text,
422+
.addon-banner-item > .toolbarbutton-text,
421423
#appMenu-save-file-button2 > .toolbarbutton-text,
422424
#appMenu-more-button2 > .toolbarbutton-text,
423425
#appMenu-help-button2 > .toolbarbutton-text,

uc-findbar.css

+1
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ findbar[hidden] {
137137
border-radius: 0 !important;
138138
outline: none !important;
139139
height: var(--findbar-height, 22px) !important;
140+
box-sizing: border-box !important;
140141
padding-inline: 6px !important;
141142
-moz-box-flex: 1 !important;
142143
}

uc-navbar.css

+4-7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ if it's visible in the row beneath the tabs then it's probably in here. */
1313
border: none !important;
1414
}
1515

16+
#customization-palette toolbarpaletteitem {
17+
transform-style: preserve-3d !important;
18+
}
19+
1620
toolbarpaletteitem > toolbarspring {
1721
margin-block: calc((var(--urlbar-container-height) - var(--urlbar-height)) / 2) !important;
1822
outline: none !important;
@@ -33,13 +37,6 @@ toolbarpaletteitem[place="palette"] > toolbarspring {
3337
margin-inline: 2px !important;
3438
}
3539

36-
#wrapper-urlbar-container + toolbarpaletteitem > #search-container,
37-
#nav-bar[customizing="true"] #urlbar-container + #search-container,
38-
#wrapper-search-container + toolbarpaletteitem > #urlbar-container,
39-
#nav-bar[customizing="true"] #search-container + #urlbar-container {
40-
margin-inline-start: 1px !important;
41-
}
42-
4340
/* toolbar button badges */
4441
:is(.customization-target, .widget-overflow-list)
4542
:is(toolbarbutton, toolbaritem):not([attention])

uc-urlbar.css

+6-11
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,20 @@ that includes all the icons, page actions, etc. */
1616
}
1717

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

2323
toolbarpaletteitem[place="palette"] > #search-container {
2424
min-height: 32px !important;
2525
max-height: 32px !important;
2626
padding-block: 0 !important;
27-
margin-block: 5px !important;
27+
margin: 5px 0 !important;
2828
}
2929

3030
#nav-bar-customization-target #search-container {
3131
padding-block: 0 !important;
32-
margin-inline: 3px !important;
32+
margin-inline: var(--urlbar-margin-inline, 3px) !important;
3333
height: var(--urlbar-container-height) !important;
3434
min-height: var(--urlbar-container-height) !important;
3535
}
@@ -136,8 +136,9 @@ toolbarpaletteitem[place="palette"] > #search-container {
136136
}
137137

138138
#urlbar-search-splitter {
139-
min-width: 12px !important;
140-
margin-inline: -7px !important;
139+
min-width: 6px !important;
140+
margin-inline: -3px !important;
141+
z-index: 1 !important;
141142
}
142143

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

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

977-
#wrapper-urlbar-container,
978-
#wrapper-search-container {
979-
-moz-box-flex: 1 !important;
980-
}
981-
982977
:root[customizing]
983978
#wrapper-urlbar-container[removable="false"]
984979
#urlbar

uc-variables.css

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ menupopup {
8080
--urlbar-container-height: var(--uc-urlbar-container-height) !important;
8181
--urlbar-height: calc(var(--urlbar-container-height) - 6px) !important;
8282
--urlbar-container-padding: 1px !important;
83+
--urlbar-margin-inline: 2px !important;
8384
--urlbar-icon-border-radius: var(--general-button-border-radius) !important;
8485
--urlbar-icon-fill-opacity: 0.6 !important;
8586
--urlbar-popup-url-color: var(--purple-35) !important;

0 commit comments

Comments
 (0)