forked from aminomancer/uc.css.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathprivateWindowHomepage.uc.js
More file actions
30 lines (29 loc) · 1.6 KB
/
privateWindowHomepage.uc.js
File metadata and controls
30 lines (29 loc) · 1.6 KB
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
// ==UserScript==
// @name Private Window Homepage
// @version 1.0
// @author aminomancer
// @homepage https://github.com/aminomancer/uc.css.js
// @description By default, private windows are opened to about:privatebrowsing, regardless of your homepage or new tab page preferences. Once the window is opened, opening a new tab goes to your new tab page, and pressing the home button goes to your actual home page. But the first tab of a private window is always opened to about:privatebrowsing. This behavior is coded right into OpenBrowserWindow() but we can change it. This script simply removes the part of the function that manually sets the URL to about:privatebrowsing. So private windows will now behave like ordinary windows in this (and only this) respect.
// ==/UserScript==
(function () {
function init() {
window.og_OpenBrowserWindow = OpenBrowserWindow;
eval(
`OpenBrowserWindow = ` +
OpenBrowserWindow.toSource().replace(
/\N*\s*if \(\!PrivateBrowsingUtils\.permanentPrivateBrowsing\) {\s*.*\s*defaultArgs \= \"about\:privatebrowsing\"\;\s*\}/gm,
``
)
);
}
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");
}
})();