mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 13:39:58 +02:00
Merge remote-tracking branch 'origin/main' into fix/extensions-and-google-link-in-zen-sidebar
# Conflicts: # src/ZenSidebarManager.mjs
This commit is contained in:
commit
ecbeceab57
3 changed files with 48 additions and 7 deletions
|
@ -421,6 +421,7 @@ var gZenBrowserManagerSidebar = {
|
||||||
browserContainers.appendChild(browser);
|
browserContainers.appendChild(browser);
|
||||||
if (data.ua) {
|
if (data.ua) {
|
||||||
browser.browsingContext.customUserAgent = this.DEFAULT_MOBILE_USER_AGENT;
|
browser.browsingContext.customUserAgent = this.DEFAULT_MOBILE_USER_AGENT;
|
||||||
|
browser.reload();
|
||||||
}
|
}
|
||||||
browser.docShellIsActive = true;
|
browser.docShellIsActive = true;
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
|
|
||||||
{
|
{
|
||||||
const ZEN_TAB_UNLOADER_PREF = "zen.tab-unloader.enabled";
|
|
||||||
const ZEN_TAB_UNLOADER_TIMEOUT_PREF = "zen.tab-unloader.timeout";
|
|
||||||
|
|
||||||
const lazy = {};
|
const lazy = {};
|
||||||
|
|
||||||
XPCOMUtils.defineLazyPreferenceGetter(
|
XPCOMUtils.defineLazyPreferenceGetter(
|
||||||
|
@ -16,7 +13,7 @@
|
||||||
lazy,
|
lazy,
|
||||||
"zenTabUnloaderTimeout",
|
"zenTabUnloaderTimeout",
|
||||||
"zen.tab-unloader.timeout-minutes",
|
"zen.tab-unloader.timeout-minutes",
|
||||||
5
|
20
|
||||||
);
|
);
|
||||||
|
|
||||||
XPCOMUtils.defineLazyPreferenceGetter(
|
XPCOMUtils.defineLazyPreferenceGetter(
|
||||||
|
@ -152,6 +149,7 @@
|
||||||
if (!lazy.zenTabUnloaderEnabled) {
|
if (!lazy.zenTabUnloaderEnabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this.insertIntoContextMenu();
|
||||||
this.observer = new ZenTabsObserver();
|
this.observer = new ZenTabsObserver();
|
||||||
this.intervalUnloader = new ZenTabsIntervalUnloader(this);
|
this.intervalUnloader = new ZenTabsIntervalUnloader(this);
|
||||||
this.observer.addTabsListener(this.onTabEvent.bind(this));
|
this.observer.addTabsListener(this.onTabEvent.bind(this));
|
||||||
|
@ -220,10 +218,52 @@
|
||||||
return gBrowser.tabs;
|
return gBrowser.tabs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
insertIntoContextMenu() {
|
||||||
|
const element = window.MozXULElement.parseXULToFragment(`
|
||||||
|
<menuseparator/>
|
||||||
|
<menuitem id="context_zenUnloadTab"
|
||||||
|
data-lazy-l10n-id="tab-zen-unload"
|
||||||
|
oncommand="gZenTabUnloader.unloadTab();"/>
|
||||||
|
<menu data-lazy-l10n-id="zen-tabs-unloader-tab-actions" id="context_zenTabActions">
|
||||||
|
<menupopup>
|
||||||
|
<menuitem id="context_zenPreventUnloadTab"
|
||||||
|
data-lazy-l10n-id="tab-zen-prevent-unload"
|
||||||
|
oncommand="gZenTabUnloader.preventUnloadTab();"/>
|
||||||
|
<menuitem id="context_zenIgnoreUnloadTab"
|
||||||
|
data-lazy-l10n-id="tab-zen-ignore-unload"
|
||||||
|
oncommand="gZenTabUnloader.ignoreUnloadTab();"/>
|
||||||
|
</menupopup>
|
||||||
|
</menu>
|
||||||
|
`);
|
||||||
|
document.getElementById('context_closeDuplicateTabs').parentNode.appendChild(element);
|
||||||
|
}
|
||||||
|
|
||||||
|
unloadTab() {
|
||||||
|
const tabs = TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
|
||||||
|
for (const tab of tabs) {
|
||||||
|
gBrowser.discardBrowser(tab);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
preventUnloadTab() {
|
||||||
|
const tabs = TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
|
||||||
|
for (const tab of tabs) {
|
||||||
|
tab.zenIgnoreUnload = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ignoreUnloadTab() {
|
||||||
|
const tabs = TabContextMenu.contextTab.multiselected ? gBrowser.selectedTabs : [TabContextMenu.contextTab];
|
||||||
|
for (const tab of tabs) {
|
||||||
|
tab.zenIgnoreUnload = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
canUnloadTab(tab, currentTimestamp, excludedUrls) {
|
canUnloadTab(tab, currentTimestamp, excludedUrls) {
|
||||||
if (tab.pinned || tab.selected || tab.multiselected
|
if (tab.pinned || tab.selected || tab.multiselected
|
||||||
|| tab.hasAttribute("busy") || tab.hasAttribute("pending")
|
|| tab.hasAttribute("busy") || tab.hasAttribute("pending")
|
||||||
|| !tab.linkedPanel || tab.splitView || tab.attention
|
|| !tab.linkedPanel || tab.splitView || tab.attention || tab.soundPlaying
|
||||||
|
|| tab.zenIgnoreUnload
|
||||||
|| excludedUrls.some(url => url.test(tab.linkedBrowser.currentURI.spec))) {
|
|| excludedUrls.some(url => url.test(tab.linkedBrowser.currentURI.spec))) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ var ZenWorkspaces = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_kIcons: JSON.parse(Services.prefs.getStringPref("zen.workspaces.icons")).map((icon) => icon),
|
_kIcons: JSON.parse(Services.prefs.getStringPref("zen.workspaces.icons")).map((icon) => Array.from(icon)[0]),
|
||||||
|
|
||||||
_initializeWorkspaceCreationIcons() {
|
_initializeWorkspaceCreationIcons() {
|
||||||
let container = document.getElementById('PanelUI-zen-workspaces-create-icons-container');
|
let container = document.getElementById('PanelUI-zen-workspaces-create-icons-container');
|
||||||
|
@ -248,7 +248,7 @@ var ZenWorkspaces = {
|
||||||
if (this.workspaceHasIcon(workspace)) {
|
if (this.workspaceHasIcon(workspace)) {
|
||||||
return workspace.icon;
|
return workspace.icon;
|
||||||
}
|
}
|
||||||
return workspace.name[0].toUpperCase();
|
return Array.from(workspace.name)[0].toUpperCase();
|
||||||
},
|
},
|
||||||
|
|
||||||
get shouldShowContainers() {
|
get shouldShowContainers() {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue