Skip to content
This repository was archived by the owner on Oct 3, 2024. It is now read-only.

Commit a67a048

Browse files
Hotfix 0.7.1 (Closed Beta)
- Added support for the other types of radios not being themed. - Removed borders for navbar, personal toolbar, browser and reduced the gap between tabs and top portion for Linux Native Titlebar users, to copy how Chrome/Chromium looked. - Fixed green https and red https position for Native Linux Titlebar users. - Forced identity panel background white and black text. - Removed the white overlay over TabsToolbar added by Firefox. This will result in Aero having the same transparency as other programs. - Pages.uc.js is now customly made from the original aminomancer script instead of a middleman script. - Added a interval to update renametitlebar uc js to make the switch from Mozilla Firefox to Google Chrome faster. - Renamed icognito page and all mentions to incognito. Spelling is hard ok?
1 parent a762228 commit a67a048

17 files changed

+590
-574
lines changed

theme/chrome/JS/pages.uc.js

+63-140
Original file line numberDiff line numberDiff line change
@@ -1,148 +1,71 @@
11
// ==UserScript==
2-
// @name About Pages
3-
// @description Adds correct about: pages to Firefox.
4-
// @author aubymori, ephemeralViolette
5-
// @include main
6-
// @backgroundmodule
2+
// @name Silverfox About Pages
3+
// @version 1.0
4+
// @description Creates custom about:x pages for Silverfox
5+
// @authoer florin, based on aminomancer's about:cfg 1.2.4 script
6+
// @grant none
77
// ==/UserScript==
88

9-
class OverrideObject
10-
{
11-
_uri = null;
12-
QueryInterface = null;
13-
14-
constructor(uri)
15-
{
16-
this._uri = uri;
17-
this.QueryInterface = ChromeUtils.generateQI(["nsIAboutModule"]);
18-
}
19-
20-
get uri()
21-
{
22-
return Services.io.newURI(this._uri);
23-
}
24-
25-
newChannel(uri, loadInfo)
26-
{
27-
const ch = Services.io.newChannelFromURIWithLoadInfo(this.uri, loadInfo);
28-
ch.owner = Services.scriptSecurityManager.getSystemPrincipal();
29-
return ch;
30-
}
31-
32-
getURIFlags(uri)
33-
{
34-
return Ci.nsIAboutModule.ALLOW_SCRIPT | Ci.nsIAboutModule.IS_SECURE_CHROME_UI;
35-
}
36-
37-
getChromeURI(_uri)
38-
{
39-
return this.uri;
9+
const customAboutPages = {
10+
"flags": "chrome://userchrome/content/pages/flags/flags.xhtml",
11+
"bookmarks": "chrome://browser/content/places/bookmarksSidebar.xhtml",
12+
"history": "chrome://browser/content/places/historySidebar.xhtml",
13+
"silverfox": "chrome://userchrome/content/pages/about/about.xhtml",
14+
"privatebrowsing": "chrome://userchrome/content/pages/incognito/incognito.xhtml",
15+
"credits": "https://silverfox.neocities.org/components/redirector/redirect_credits",
16+
"home": "chrome://userchrome/content/pages/homepage/homepage.xhtml",
17+
"newtab": "chrome://userchrome/content/pages/homepage/homepage.xhtml",
18+
"intro": "https://silverfox.neocities.org/components/redirector/redirect_intro"
19+
};
20+
21+
let { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
22+
let { manager: Cm } = Components;
23+
let registrar = Cm.QueryInterface(Ci.nsIComponentRegistrar);
24+
25+
function generateFreeCID() {
26+
let uuid = Components.ID(Services.uuid.generateUUID().toString());
27+
while (registrar.isCIDRegistered(uuid)) {
28+
uuid = Components.ID(Services.uuid.generateUUID().toString());
4029
}
30+
return uuid;
4131
}
4232

43-
class OverrideFactory
44-
{
45-
QueryInterface = null;
46-
uri = null;
47-
48-
constructor(uri)
49-
{
50-
this.uri = uri;
51-
this.QueryInterface = ChromeUtils.generateQI(["nsIFactory"]);
52-
}
53-
54-
createInstance(aIID)
55-
{
56-
return (new OverrideObject(this.uri)).QueryInterface(aIID);
57-
}
58-
}
59-
60-
class SilverfoxPages
61-
{
62-
static registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
63-
static registeredPages = {};
64-
65-
/* Generate unique ID every launch */
66-
static generateFreeCID()
67-
{
68-
let uuid;
69-
do
70-
{
71-
uuid = Components.ID(Services.uuid.generateUUID().toString());
72-
}
73-
while (this.registrar.isCIDRegistered(uuid));
74-
75-
return uuid;
76-
}
77-
78-
static registerAboutPage(name, uri)
79-
{
80-
/* Unregister the page if it has already been registered. */
81-
this.unregisterAboutPage(name);
82-
83-
let factory = new OverrideFactory(uri);
84-
let cid = this.generateFreeCID();
85-
86-
this.registeredPages[name] = {
87-
cid: cid,
88-
factory: factory
89-
};
90-
91-
this.registrar.registerFactory(
92-
cid,
93-
`about:${name}`,
94-
`@mozilla.org/network/protocol/about;1?what=${name}`,
95-
factory
96-
);
97-
}
98-
99-
static unregisterAboutPage(name)
100-
{
101-
if (this.registeredPages[name])
102-
{
103-
this.registrar.unregisterFactory(
104-
this.registeredPages[name].cid,
105-
this.registeredPages[name].factory
106-
);
107-
delete this.registeredPages[name];
108-
}
109-
}
33+
function createCustomAboutModule(url) {
34+
function CustomAboutPage() {}
35+
36+
CustomAboutPage.prototype = {
37+
get uri() {
38+
return this._uri || (this._uri = Services.io.newURI(url));
39+
},
40+
newChannel(_uri, loadInfo) {
41+
const ch = Services.io.newChannelFromURIWithLoadInfo(this.uri, loadInfo);
42+
ch.owner = Services.scriptSecurityManager.getSystemPrincipal();
43+
return ch;
44+
},
45+
getURIFlags(_uri) {
46+
return Ci.nsIAboutModule.ALLOW_SCRIPT | Ci.nsIAboutModule.IS_SECURE_CHROME_UI;
47+
},
48+
getChromeURI(_uri) {
49+
return this.uri;
50+
},
51+
QueryInterface: ChromeUtils.generateQI(["nsIAboutModule"]),
52+
};
53+
54+
return CustomAboutPage;
11055
}
11156

112-
SilverfoxPages.registerAboutPage(
113-
"flags",
114-
"chrome://userchrome/content/pages/flags/flags.xhtml"
115-
);
116-
SilverfoxPages.registerAboutPage(
117-
"bookmarks",
118-
"chrome://browser/content/places/bookmarksSidebar.xhtml"
119-
);
120-
SilverfoxPages.registerAboutPage(
121-
"history",
122-
"chrome://browser/content/places/historySidebar.xhtml"
123-
);
124-
SilverfoxPages.registerAboutPage(
125-
"silverfox",
126-
"chrome://userchrome/content/pages/about/about.xhtml"
127-
);
128-
SilverfoxPages.registerAboutPage(
129-
"privatebrowsing",
130-
"chrome://userchrome/content/pages/icognito/icognito.xhtml"
131-
);
132-
SilverfoxPages.registerAboutPage(
133-
"credits",
134-
"https://silverfox.neocities.org/components/redirector/redirect_credits"
135-
);
136-
SilverfoxPages.registerAboutPage(
137-
"home",
138-
"chrome://userchrome/content/pages/homepage/homepage.xhtml"
139-
);
140-
SilverfoxPages.registerAboutPage(
141-
"newtab",
142-
"chrome://userchrome/content/pages/homepage/homepage.xhtml"
143-
);
144-
SilverfoxPages.registerAboutPage(
145-
"intro",
146-
"https://silverfox.neocities.org/components/redirector/redirect_intro"
147-
);
148-
let EXPORTED_SYMBOLS = [];
57+
Object.entries(customAboutPages).forEach(([aboutPage, url]) => {
58+
let factory = {
59+
createInstance(aIID) {
60+
return new (createCustomAboutModule(url))().QueryInterface(aIID);
61+
},
62+
QueryInterface: ChromeUtils.generateQI(["nsIFactory"]),
63+
};
64+
65+
registrar.registerFactory(
66+
generateFreeCID(),
67+
`about:${aboutPage}`,
68+
`@mozilla.org/network/protocol/about;1?what=${aboutPage}`,
69+
factory
70+
);
71+
});

theme/chrome/JS/renametitlebar.uc.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,11 @@ var ReplaceFirefoxTitlebar = {
3838
const mainwindow = document.getElementById("main-window");
3939
setAttributes(mainwindow, attributes);
4040
}
41+
42+
updateTitle();
43+
setInterval(updateTitle, 5000);
4144
} catch (e) {}
4245
},
4346
};
4447

45-
document.addEventListener("DOMContentLoaded", ReplaceFirefoxTitlebar.init, false);
48+
ReplaceFirefoxTitlebar.init();

theme/chrome/JS/version.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.7
1+
0.7.1

theme/chrome/css/UI/browser.css

+11
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,15 @@
1616
border-left: none !important;
1717
border-bottom: none !important;
1818
margin-top: 0px !important;
19+
}
20+
21+
/* On Linux, if native titlebars are enabled remove borders and margin */
22+
23+
@media (-moz-platform: linux) {
24+
:root:not([tabsintitlebar="true"]) #browser {
25+
border-right: none !important;
26+
border-left: none !important;
27+
border-bottom: none !important;
28+
margin-top: 0px !important;
29+
}
1930
}

theme/chrome/css/UI/identitypanel.css

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
#identity-popup-multiView {
3232
display: block !important;
33+
background: white !important;
3334
}
3435

3536

@@ -112,6 +113,7 @@
112113
.identityInfo p {
113114
font-size: 12px;
114115
margin-top: -10px;
116+
color: black;
115117
}
116118

117119
.identityNotVerified,
@@ -143,6 +145,7 @@
143145
.firstThing p {
144146
font-weight: bold;
145147
font-size: 14px;
148+
color: black;
146149
}
147150

148151
.fakeBorder {
@@ -184,6 +187,7 @@
184187
.permissionsTab p {
185188
font-size: 12px;
186189
font-weight: bold;
190+
color: black;
187191
}
188192

189193
.cookiesTab a {
@@ -204,12 +208,14 @@
204208
.infoView {
205209
border-bottom: 1px solid rgb(204, 204, 204);
206210
font-size: 12px;
211+
color: black;
207212
}
208213

209214
.keepMeInfo,
210215
.keepMeSafe {
211216
margin-top: 12px;
212217
display: flex;
218+
color: black;
213219
}
214220

215221
.keepMeInfo img,

0 commit comments

Comments
 (0)