-
Notifications
You must be signed in to change notification settings - Fork 2
/
macosTheme.uc.js
171 lines (146 loc) · 5.71 KB
/
macosTheme.uc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
// ==UserScript==
// @name MacOS Window Control & Font Theme
// @version 1.1.1
// @author Hakanbaban53
// @homepage https://github.com/Hakanbaban53/RealFire
// @description Move the window control to the left and recolor it and change the font.
// @downloadURL https://cdn.jsdelivr.net/gh/Hakanbaban53/RealFire@main/JS/macosTheme.uc.js
// @updateURL https://cdn.jsdelivr.net/gh/Hakanbaban53/RealFire@main/JS/macosTheme.uc.js
// @license This Source Code Form is subject to the terms of the Creative Commons Attribution-NonCommercial-ShareAlike International License, v. 4.0. If a copy of the CC BY-NC-SA 4.0 was not distributed with this file, You can obtain one at http://creativecommons.org/licenses/by-nc-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.
// ==/UserScript==
(function () {
// CSS rules to apply
var css = `
/* Default font family for most elements, with fallbacks */
*:not([class*="FokDXb"]):not([class*="upload"]):not([class*="icon"]):not([class*="mui-amount"]):not([class*="chaoshi"]):not([class*="top-nav"]):not([href*="ju.taobao.com"]):not([class*="Icon"]):not(b):not(ins):not(i):not(s) {
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Ubuntu", "Cantarell", sans-serif !important;
}
/* Responsive adjustments for toolbar when width is less than 1000px */
@media (max-width: 1000px) {
#toolbar-menubar .titlebar-buttonbox-container {
display: flex !important;
}
#toolbar-menubar {
display: flex;
flex-direction: row-reverse;
}
}
/* Toolbar adjustments for when width is 1000px or more */
@media (min-width: 1000px) {
#navigator-toolbox:not([inFullscreen]) #TabsToolbar .titlebar-buttonbox-container {
visibility: visible !important;
display: block !important;
position: absolute !important;
top: 12px;
left: -8px;
}
}
/* Hide titlebar buttonbox container in toolbar menubar by default */
#toolbar-menubar .titlebar-buttonbox-container {
display: none;
}
/* Reorder toolbar items */
#TabsToolbar .toolbar-items {
order: 1 !important;
}
#TabsToolbar .titlebar-buttonbox-container {
order: 0 !important;
}
/* Styling for titlebar buttons */
:root[sizemode="maximized"] .titlebar-buttonbox-container {
padding-top: 0 !important;
}
:root:-moz-window-inactive:not([customizing]) .titlebar-buttonbox > toolbarbutton:not(:hover) {
opacity: 0.65 !important;
list-style-image: url(chrome://userchrome/content/material/inactive.svg) !important;
}
.titlebar-buttonbox {
gap: 10px;
margin-right: 12px !important;
margin-left: 12px !important;
}
.titlebar-button > .toolbarbutton-icon,
.toolbarbutton-icon {
opacity: 1 !important;
appearance: none !important;
background-image: none !important;
}
.titlebar-button > .toolbarbutton-icon {
height: 15px !important;
min-height: 25px !important;
width: 15px !important;
min-width: 25px !important;
padding-left: 6px !important;
padding-right: 6px !important;
}
/* Order and appearance of titlebar buttons */
.titlebar-close {
order: 0 !important;
padding: 0 !important;
list-style-image: url(chrome://userchrome/content/material/close.svg) !important;
}
.titlebar-min {
order: 1 !important;
padding: 0 !important;
list-style-image: url(chrome://userchrome/content/material/minimize.svg) !important;
}
.titlebar-max, .titlebar-restore {
order: 2 !important;
padding: 0 !important;
list-style-image: url(chrome://userchrome/content/material/maximize.svg) !important;
}
/* Hover states for titlebar buttons */
.titlebar-min:hover {
list-style-image: url(chrome://userchrome/content/material/minimize-hover.svg) !important;
}
.titlebar-max:hover {
list-style-image: url(chrome://userchrome/content/material/maximize-hover.svg) !important;
}
.titlebar-restore:hover {
list-style-image: url(chrome://userchrome/content/material/maximize-restore.svg) !important;
}
.titlebar-close:hover {
list-style-image: url(chrome://userchrome/content/material/close-hover.svg) !important;
}
`;
// Function to initialize the script
function init() {
var root = document.documentElement;
var urlbarPosition = getComputedStyle(root).getPropertyValue('--uc-urlbar-position').trim();
console.log('URL Bar Position:', urlbarPosition);
// Function to apply styles based on the media query status
function applyStyles(matches) {
var navBar = document.getElementById('nav-bar');
var titleBar = document.getElementById('titlebar');
if (urlbarPosition === '1') {
navBar.style.paddingLeft = matches ? '106px' : '0';
} else if (urlbarPosition === '3') {
titleBar.style.paddingLeft = matches ? '106px' : '0';
}
}
// Initial application of styles
applyStyles(window.matchMedia('(min-width: 1000px)').matches);
// Listen for changes in the media query status
window.matchMedia('(min-width: 1000px)').addListener(function (event) {
console.log('Media Query Match:', event.matches);
applyStyles(event.matches);
});
}
// Check if the browser initialization is complete
if (gBrowserInit.delayedStartupFinished) {
init();
} else {
let delayedListener = (subject, topic) => {
if (topic == "browser-delayed-startup-finished" && subject == window) {
Services.obs.removeObserver(delayedListener, topic);
init();
}
};
Services.obs.addObserver(delayedListener, "browser-delayed-startup-finished");
}
// Create a style element and append the CSS rules
var style = document.createElement("style");
style.type = "text/css";
style.textContent = css;
document.head.appendChild(style);
})();