2019-02-05 10:53:26 -05:00
|
|
|
browser.windows.onCreated.addListener(themeWindow);
|
|
|
|
|
|
|
|
// Theme all currently open windows
|
|
|
|
browser.windows.getAll().then(wins => wins.forEach(themeWindow));
|
|
|
|
|
|
|
|
function themeWindow(window) {
|
2019-02-07 17:09:31 -05:00
|
|
|
// Check if the window is in private browsing
|
|
|
|
if (window.incognito) {
|
2019-02-19 11:43:44 -05:00
|
|
|
browser.theme.update(window.id, {
|
|
|
|
images: {
|
|
|
|
headerURL: "icons/toopie.png",
|
2019-02-07 17:09:31 -05:00
|
|
|
},
|
|
|
|
colors: {
|
|
|
|
accentcolor: "#A0A0DE",
|
|
|
|
textcolor: "white",
|
|
|
|
toolbar: "#A0A0DE",
|
|
|
|
toolbar_text: "white"
|
|
|
|
}
|
|
|
|
});
|
2019-02-19 11:43:44 -05:00
|
|
|
browser.windows.update(window.id, {
|
|
|
|
titlePreface: "I2P Browser (Private Browsing) - "
|
|
|
|
});
|
2019-02-07 17:09:31 -05:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
browser.theme.update(window.id, {
|
|
|
|
images: {
|
2019-02-19 11:43:44 -05:00
|
|
|
headerURL: "icons/toopie.png",
|
2019-02-07 17:09:31 -05:00
|
|
|
},
|
|
|
|
colors: {
|
|
|
|
accentcolor: "#BFA0DE",
|
|
|
|
textcolor: "white",
|
|
|
|
toolbar: "#BFA0DE",
|
|
|
|
toolbar_text: "white"
|
|
|
|
}
|
|
|
|
});
|
2019-02-19 11:43:44 -05:00
|
|
|
browser.windows.update(window.id, {
|
|
|
|
titlePreface: "I2P Browser - "
|
|
|
|
});
|
2019-02-07 17:09:31 -05:00
|
|
|
}
|
2019-02-05 10:53:26 -05:00
|
|
|
}
|
2019-02-07 20:14:57 -05:00
|
|
|
|
2019-02-19 11:43:44 -05:00
|
|
|
function setTitle(window){
|
|
|
|
if (window.incognito) {
|
|
|
|
browser.windows.update(window.id, {
|
|
|
|
titlePreface: "I2P Browser (Private Browsing) - "
|
|
|
|
});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
browser.windows.update(window.id, {
|
|
|
|
titlePreface: "I2P Browser - "
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
2019-02-07 20:14:57 -05:00
|
|
|
|
2019-02-19 11:43:44 -05:00
|
|
|
function setTitleError(window){
|
|
|
|
alert("plugin error setting title on", window.id)
|
|
|
|
}
|
2019-02-07 20:14:57 -05:00
|
|
|
|
|
|
|
browser.windows.onCreated.addListener(() => {
|
|
|
|
const gettingStoredSettings = browser.storage.local.get();
|
|
|
|
gettingStoredSettings.then(setupProxy, onError);
|
|
|
|
});
|
2019-02-19 11:43:44 -05:00
|
|
|
|
|
|
|
browser.tabs.onCreated.addListener(() => {
|
|
|
|
const getting = browser.windows.getCurrent({populate: true});
|
|
|
|
getting.then(setTitle, setTitleError);
|
|
|
|
});
|