Skip to content

Commit

Permalink
fixes #288
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Neomy committed Sep 5, 2022
1 parent fa57473 commit 5206cbe
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 170 deletions.
2 changes: 1 addition & 1 deletion v3/data/inject/meta.js
@@ -1,7 +1,7 @@
{
const top = window.top === window;
(top ? {
'time': performance.timing.domLoading,
'time': window.lastVisit || performance.timing.domLoading,
'audible': Boolean(document.pictureInPictureElement),
'permission': typeof Notification !== 'undefined' ? Notification.permission === 'granted' : false,
'ready': document.readyState === 'complete' || document.readyState === 'loaded',
Expand Down
10 changes: 9 additions & 1 deletion v3/data/inject/watch.js
@@ -1,5 +1,7 @@
/* this watches if there are any unsaved forms on the page */

window.isReceivingFormInput = false;
window.addEventListener('keydown', e => {
addEventListener('keydown', e => {
const {keyCode, target, path} = e;
// check target
if (keyCode >= 48 && keyCode <= 90 && target.tagName) {
Expand Down Expand Up @@ -27,3 +29,9 @@ window.addEventListener('keydown', e => {
}
}
}, true);

/* */
addEventListener('visibilitychange', () => {
window.lastVisit = Date.now();
console.log(window.lastVisit);
});
13 changes: 8 additions & 5 deletions v3/manifest.json
@@ -1,5 +1,5 @@
{
"manifest_version": 2,
"manifest_version": 3,
"version": "0.6.1",
"name": "Auto Tab Discard",
"description": "__MSG_app_description__",
Expand All @@ -19,15 +19,17 @@
"permissions": [
"idle",
"storage",
"tabs",
"contextMenus",
"notifications",
"alarms",
"scripting"
],
"host_permissions": [
"*://*/*"
],
"background": {
"persistent": false,
"page": "v2.html"
"service_worker": "worker/core.mjs",
"type": "module"
},
"content_scripts": [{
"match_about_blank": true,
Expand All @@ -38,7 +40,7 @@
"run_at": "document_start",
"all_frames": true
}],
"browser_action": {
"action": {
"default_popup": "data/popup/index.html"
},
"options_ui": {
Expand All @@ -47,6 +49,7 @@
},
"homepage_url": "https://add0n.com/tab-discard.html",
"commands": {
"_execute_action": {},
"discard-tab": {
"description": "__MSG_cmd_discard_tab__"
},
Expand Down
80 changes: 0 additions & 80 deletions v3/manifest.json.v3.json

This file was deleted.

7 changes: 0 additions & 7 deletions v3/v2.html

This file was deleted.

70 changes: 0 additions & 70 deletions v3/v2.js

This file was deleted.

2 changes: 1 addition & 1 deletion v3/worker/core/startup.mjs
Expand Up @@ -23,4 +23,4 @@ const starters = {
chrome.runtime.onInstalled.addListener(once);
}

export {starters}
export {starters};
2 changes: 1 addition & 1 deletion v3/worker/core/utils.mjs
Expand Up @@ -9,7 +9,7 @@ const notify = e => chrome.notifications.create({
message: e.message || e
});

const query = options => new Promise(resolve => chrome.tabs.query(options, resolve));
const query = options => chrome.tabs.query(options);

const match = (list, hostname, href) => {
if (list.filter(s => s.startsWith('re:') === false).indexOf(hostname) !== -1) {
Expand Down
8 changes: 4 additions & 4 deletions v3/worker/modes/number.mjs
Expand Up @@ -98,15 +98,15 @@ number.check = async (filterTabsFrom, ops = {}) => {
}
let tbs = await query(options);
const icon = (tb, title) => {
chrome.browserAction.setTitle({
chrome.action.setTitle({
tabId: tb.id,
title
}, () => chrome.runtime.lastError);
chrome.browserAction.setIcon({
chrome.action.setIcon({
tabId: tb.id,
path: {
'16': 'data/icons/disabled/16.png',
'32': 'data/icons/disabled/32.png'
'16': '/data/icons/disabled/16.png',
'32': '/data/icons/disabled/32.png'
}
});
};
Expand Down

0 comments on commit 5206cbe

Please sign in to comment.