Skip to content

Commit d7580c9

Browse files
committed
update fullscreen & viewsource for new patches:
update toggleMenubarHotkey.uc.js to 1.1.1. update fullscreen menubar styles for this. update viewsource styles for a new patch.
1 parent f926aae commit d7580c9

5 files changed

Lines changed: 66 additions & 232 deletions

File tree

JS/toggleMenubarHotkey.uc.js

Lines changed: 12 additions & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// ==UserScript==
22
// @name Toggle Menubar Hotkey
3-
// @version 1.1
3+
// @version 1.1.1
44
// @author aminomancer
55
// @homepage https://github.com/aminomancer
66
// @description Press alt+M to toggle the menubar.
@@ -31,112 +31,17 @@
3131
function init() {
3232
if (!hotkeyRegistered) return;
3333
document.getElementById("toolbar-menubar").setAttribute("key", hotkeyId);
34-
window.onViewToolbarsPopupShowing = function (aEvent, aInsertPoint) {
35-
var popup = aEvent.target;
36-
if (popup != aEvent.currentTarget) return;
37-
for (var i = popup.children.length - 1; i >= 0; --i) {
38-
var deadItem = popup.children[i];
39-
if (deadItem.hasAttribute("toolbarId")) popup.removeChild(deadItem);
40-
}
41-
MozXULElement.insertFTLIfNeeded("browser/toolbarContextMenu.ftl");
42-
let firstMenuItem = aInsertPoint || popup.firstElementChild;
43-
let toolbarNodes = gNavToolbox.querySelectorAll("toolbar");
44-
for (let toolbar of toolbarNodes) {
45-
if (!toolbar.hasAttribute("toolbarname")) continue;
46-
47-
if (toolbar.id == "PersonalToolbar") {
48-
let menu = BookmarkingUI.buildBookmarksToolbarSubmenu(toolbar);
49-
popup.insertBefore(menu, firstMenuItem);
50-
} else {
51-
let menuItem = document.createXULElement("menuitem");
52-
menuItem.setAttribute("id", "toggle_" + toolbar.id);
53-
menuItem.setAttribute("toolbarId", toolbar.id);
54-
menuItem.setAttribute("type", "checkbox");
55-
menuItem.setAttribute("label", toolbar.getAttribute("toolbarname"));
56-
let hidingAttribute =
57-
toolbar.getAttribute("type") == "menubar" ? "autohide" : "collapsed";
58-
menuItem.setAttribute(
59-
"checked",
60-
toolbar.getAttribute(hidingAttribute) != "true"
61-
);
62-
menuItem.setAttribute("accesskey", toolbar.getAttribute("accesskey"));
63-
if (toolbar.hasAttribute("key"))
64-
menuItem.setAttribute("key", toolbar.getAttribute("key"));
65-
popup.insertBefore(menuItem, firstMenuItem);
66-
menuItem.addEventListener("command", onViewToolbarCommand);
67-
}
68-
}
69-
let moveToPanel = popup.querySelector(".customize-context-moveToPanel");
70-
let removeFromToolbar = popup.querySelector(".customize-context-removeFromToolbar");
71-
if (!moveToPanel || !removeFromToolbar) return;
72-
let toolbarItem = popup.triggerNode;
73-
if (toolbarItem && toolbarItem.localName == "toolbarpaletteitem")
74-
toolbarItem = toolbarItem.firstElementChild;
75-
else if (toolbarItem && toolbarItem.localName != "toolbar")
76-
while (toolbarItem && toolbarItem.parentElement) {
77-
let parent = toolbarItem.parentElement;
78-
if (
79-
(parent.classList && parent.classList.contains("customization-target")) ||
80-
parent.getAttribute("overflowfortoolbar") ||
81-
parent.localName == "toolbarpaletteitem" ||
82-
parent.localName == "toolbar"
83-
)
84-
break;
85-
toolbarItem = parent;
86-
}
87-
else toolbarItem = null;
88-
let showTabStripItems = toolbarItem && toolbarItem.id == "tabbrowser-tabs";
89-
for (let node of popup.querySelectorAll('menuitem[contexttype="toolbaritem"]'))
90-
node.hidden = showTabStripItems;
91-
for (let node of popup.querySelectorAll('menuitem[contexttype="tabbar"]'))
92-
node.hidden = !showTabStripItems;
93-
document
94-
.getElementById("toolbar-context-menu")
95-
.querySelectorAll("[data-lazy-l10n-id]")
96-
.forEach((el) => {
97-
el.setAttribute("data-l10n-id", el.getAttribute("data-lazy-l10n-id"));
98-
el.removeAttribute("data-lazy-l10n-id");
99-
});
100-
let menuSeparator = document.getElementById("toolbarItemsMenuSeparator");
101-
menuSeparator.hidden = false;
102-
document.getElementById("toolbarNavigatorItemsMenuSeparator").hidden =
103-
!showTabStripItems;
104-
if (
105-
!CustomizationHandler.isCustomizing() &&
106-
CustomizableUI.isSpecialWidget(toolbarItem?.id || "")
107-
) {
108-
moveToPanel.hidden = true;
109-
removeFromToolbar.hidden = true;
110-
menuSeparator.hidden = !showTabStripItems;
111-
}
112-
if (showTabStripItems) {
113-
let multipleTabsSelected = !!gBrowser.multiSelectedTabsCount;
114-
document.getElementById("toolbar-context-bookmarkSelectedTabs").hidden =
115-
!multipleTabsSelected;
116-
document.getElementById("toolbar-context-bookmarkSelectedTab").hidden =
117-
multipleTabsSelected;
118-
document.getElementById("toolbar-context-reloadSelectedTabs").hidden =
119-
!multipleTabsSelected;
120-
document.getElementById("toolbar-context-reloadSelectedTab").hidden =
121-
multipleTabsSelected;
122-
document.getElementById("toolbar-context-selectAllTabs").disabled =
123-
gBrowser.allTabsSelected();
124-
document.getElementById("toolbar-context-undoCloseTab").disabled =
125-
SessionStore.getClosedTabCount(window) == 0;
126-
return;
127-
}
128-
let movable =
129-
toolbarItem && toolbarItem.id && CustomizableUI.isWidgetRemovable(toolbarItem);
130-
if (movable) {
131-
if (CustomizableUI.isSpecialWidget(toolbarItem.id))
132-
moveToPanel.setAttribute("disabled", true);
133-
else moveToPanel.removeAttribute("disabled");
134-
removeFromToolbar.removeAttribute("disabled");
135-
} else {
136-
moveToPanel.setAttribute("disabled", true);
137-
removeFromToolbar.setAttribute("disabled", true);
138-
}
139-
};
34+
let src = onViewToolbarsPopupShowing.toSource();
35+
if (src.startsWith("function"))
36+
eval(
37+
`window.onViewToolbarsPopupShowing = function uc_onViewToolbarsPopupShowing ` +
38+
src
39+
.replace(/^function onViewToolbarsPopupShowing/, "")
40+
.replace(
41+
/if \(popup\.id != \"toolbar-context-menu\"\)/,
42+
`if (toolbar.hasAttribute("key"))`
43+
)
44+
);
14045
}
14146

14247
if (gBrowserInit.delayedStartupFinished) {

resources/in-content/system.css

Lines changed: 20 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,7 @@
77
/* handles system pages and injects some important global variables into extension pages */
88

99
@-moz-document regexp("view-source:.*") {
10-
:root {
11-
font-family: Fira Code UC, Fira Code, SF Mono, -moz-fixed, monospace;
12-
font-weight: 300;
13-
}
14-
15-
xmp,
16-
pre,
17-
plaintext {
18-
font-family: Fira Code UC, Fira Code, SF Mono, -moz-fixed, monospace;
19-
font-weight: 300;
20-
}
21-
2210
@media (prefers-color-scheme: dark) {
23-
:root,
24-
body {
25-
color: var(--plaintext-color);
26-
background-color: var(--in-content-bg-dark);
27-
}
28-
29-
span {
30-
color: var(--plaintext-color);
31-
}
32-
33-
html:root {
34-
color: var(--plaintext-color);
35-
background: none !important;
36-
}
37-
3811
::selection {
3912
color: var(--content-selection-color) !important;
4013
background-color: var(--content-selection-bgcolor) !important;
@@ -44,56 +17,37 @@
4417
background-color: var(--content-selection-bgcolor-disabled) !important;
4518
}
4619

47-
.highlight .attribute-name {
48-
color: lightskyblue !important;
49-
}
50-
51-
.highlight .attribute-name::selection {
52-
color: darkcyan !important;
53-
}
54-
55-
.highlight .attribute-value {
56-
color: lightgreen !important;
57-
}
58-
59-
.highlight .attribute-value::selection {
60-
color: darkgreen !important;
61-
}
62-
63-
.highlight :is(.start-tag, .end-tag) {
64-
color: #cd5c5c !important;
20+
.highlight :is(.start-tag, .end-tag)::selection {
21+
color: #801f1f !important;
6522
}
6623

67-
.highlight .end-tag::selection {
68-
color: #973737 !important;
24+
.highlight .comment::selection {
25+
color: #235c23 !important;
6926
}
7027

71-
.highlight .error {
72-
color: white !important;
73-
background-color: rgba(178, 34, 34, 0.5) !important;
28+
.highlight .cdata::selection {
29+
color: #77254e !important;
7430
}
7531

76-
.highlight .comment {
77-
color: gray !important;
32+
.highlight :is(.doctype, .markupdeclaration)::selection {
33+
color: #555 !important;
7834
}
7935

80-
.highlight .error::selection,
81-
.highlight .error > *::selection {
82-
color: firebrick !important;
83-
background-color: var(--content-selection-bgcolor) !important;
84-
}
85-
86-
.highlight .entity {
87-
color: #f18a65 !important;
36+
.highlight .entity::selection {
37+
color: #884026 !important;
8838
}
8939

90-
.highlight .entity::selection {
91-
color: #a55437 !important;
40+
.highlight .attribute-value::selection {
41+
color: #233d6d !important;
9242
}
9343

9444
.highlight .pi::selection {
9545
color: #6b228f !important;
9646
}
47+
48+
.highlight .error::selection {
49+
text-decoration-color: #801f1f !important;
50+
}
9751
}
9852
}
9953

@@ -123,9 +77,7 @@
12377
--in-content-box-background-dim: var(--uc-content-box-background-dim) !important;
12478
--in-content-box-border-color: var(--uc-content-box-border-color) !important;
12579
--in-content-button-background: var(--uc-content-button-background) !important;
126-
--in-content-button-background-hover: var(
127-
--uc-content-button-background-hover
128-
) !important;
80+
--in-content-button-background-hover: var(--uc-content-button-background-hover) !important;
12981
--in-content-button-background-active: var(
13082
--uc-content-button-background-active
13183
) !important;
@@ -150,7 +102,8 @@
150102
--in-content-table-header-background: var(--purple-40-a50) !important;
151103
--in-content-box-info-background: var(--in-content-button-background-solid) !important;
152104
--focus-outline-offset: 2px !important;
153-
--default-focusring: var(--global-focus-outline-width) solid var(--global-focus-outline-color) !important;
105+
--default-focusring: var(--global-focus-outline-width) solid
106+
var(--global-focus-outline-color) !important;
154107
--newtab-background-color: var(--in-content-page-background) !important;
155108
--newtab-text-primary-color: var(--in-content-page-color) !important;
156109
--lwt-sidebar-background-color: var(--in-content-box-background) !important;
@@ -749,7 +702,7 @@
749702
}
750703

751704
/* firefox screenshots addon overlay */
752-
@-moz-document url("^moz-extension://.*/blank.html.*")
705+
@-moz-document regexp("^moz-extension://.*/blank.html.*")
753706
{
754707
:root[uc-extension-id="screenshots@mozilla.org"] .all-buttons-container {
755708
background-color: var(--uc-content-box-background) !important;

resources/layout/XMLPrettyPrint.css

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ the location URL doesn't reflect that this stylesheet is used. */
1313

1414
@import url("resource://content-accessible/viewsource.css");
1515

16-
@-moz-document unobservable-document() {
17-
:root,
18-
:host {
19-
color-scheme: light dark;
20-
font-family: Fira Code UC, Fira Code, SF Mono, -moz-fixed;
21-
font-weight: 300;
22-
}
16+
:host {
17+
color-scheme: light dark;
18+
font-family: Fira Code UC, Fira Code, SF Mono, -moz-fixed;
19+
font-weight: 300;
2320
}
2421

2522
#header {
@@ -30,12 +27,6 @@ the location URL doesn't reflect that this stylesheet is used. */
3027
}
3128

3229
@media (prefers-color-scheme: dark) {
33-
:root,
34-
:host {
35-
background-color: var(--in-content-bg-dark);
36-
color: var(--plaintext-color);
37-
}
38-
3930
#header {
4031
background-color: var(--in-content-box-bg-dark);
4132
border-bottom: 1px solid var(--in-content-border-color-dim);
@@ -67,7 +58,7 @@ the location URL doesn't reflect that this stylesheet is used. */
6758
cursor: pointer;
6859
padding-inline-end: 2px;
6960
/* Don't want to inherit the styling from pi and comment elements */
70-
color: initial;
61+
color: buttontext;
7162
font: initial;
7263
}
7364

0 commit comments

Comments
 (0)