Closed Wei-Winter closed 7 months ago
It is not possible because the API is not supported. 😔
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/sessions/restore
这是不可能的,因为不支持 API。 😔
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/sessions/restore
I am an ios Orion user and have installed this extension of yours in the Firefox store and it works perfectly! See this link for the 38th api that is available to support this browser
Thank you for Data ! I'll get right on it.
version 3.3
I added Reopen Closed Tab
in Tab
Gestures.
You can turn on Enable experimental features
to show it.
https://github.com/utubo/firefox-simple_gesture/commit/3c6b804ce967d38d22824b353c231fbd4a082763
I installed Orion to iPad Air.
But, Reopen CLosed Tab
does not work on Orion.
This works on Firefox for Android. (Windows)
🤔
我将 Orion 安装到 iPad Air。 但,
Reopen CLosed Tab
不适用于猎户座。 这适用于 Android 版 Firefox。 (视窗) 🤔
Sorry, after my testing, it's really not possible to restore closed tabs, but I did achieve this using an extension from the chrome store, maybe this api doesn't have full support 🥺
OK. I'll leave the source code as is. Hopefully one day it will be supported. 🙏
This browser says it will port to support full api in the future 🤭
I have studied an alternative that can be used on the mobile side, and hope to be Merged into the code. It implements the function by listening to the creation, update and deletion of the tab page. The following is the code.
// background.js
const exec = {
// ......
reopen: async () => {
// const session = (await browser.sessions.getRecentlyClosed({ maxResults: 1 }))[0];
// if (session) {
// browser.sessions.restore(session.tab ? session.tab.sessionId : session.window.sessionId);
// }
const url = simpleGesture_closedTabs.pop();
if (url) browser.tabs.create({ active: true, url });
else browser.tabs.executeScript({ code: `SimpleGesture.showTextToast('No recently closed tabs')` });
},
// ......
};
var simpleGesture_allTabs = new Map(
(await browser.tabs.query({})).map((tabInfo) => [tabInfo.id, tabInfo.url])
), simpleGesture_closedTabs = [];
browser.tabs.onCreated.addListener(tabInfo => simpleGesture_allTabs.set(tabInfo.id, tabInfo.url));
browser.tabs.onUpdated.addListener((tabId, chgInfo) => { if (chgInfo.url) simpleGesture_allTabs.set(tabId, chgInfo.url) });
browser.tabs.onRemoved.addListener(tabId => {
let url = simpleGesture_allTabs.get(tabId);
simpleGesture_allTabs.delete(tabId);
if (!url.startsWith('about:')) {
let index = simpleGesture_closedTabs.indexOf(url);
if (index == -1) simpleGesture_closedTabs.push(url);
else if (index < simpleGesture_closedTabs.length - 1) {
simpleGesture_closedTabs.splice(index, 1);
simpleGesture_closedTabs.push(url);
}
}
});
This is a good code! I will merge this with some fixes this month.
simpleGesture_allTabs
-> allTabs
(original names are not bad...)closedTabs
(fixed value 100)browser.sessions
works on Firefox for Desktop, so I will not remove the code for browsedr.sessions
.Thanks for the code.
So your idea is to make the storage persistent for closedTabs
, which is nice enough to get the behavior as close to browser.sessions
as possible.
I am looking forward to the next version.
I don't seem to find it in the settings