Skip to content

Commit 423e093

Browse files
v1.0.3
1 parent 408a8cb commit 423e093

5 files changed

Lines changed: 70 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
# DoNotDiscard
2-
Avoid Chrome automatically discarding tabs that it thinks don't interest to you when they do.
1+
# Disable automatic tab discarding
2+
Stops Chrome from suspending tabs, and reloading them when you switch to them.

_locales/en/messages.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"manifest_name": {
3+
"message": "Disable automatic tab discarding"
4+
},
5+
"manifest_description": {
6+
"message": "Stops Chrome from suspending tabs, and reloading them when you switch to them"
7+
},
8+
"manifest_title": {
9+
"message": "Automatic tab discarding currently disabled\nDisable/uninstall this extension to enable it"
10+
},
11+
"cm_review": {
12+
"message": "Rate this extension in store"
13+
},
14+
"cm_support": {
15+
"message": "Send feedback (suggestions, issues)"
16+
}
17+
}

_locales/es/messages.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"manifest_name": {
3+
"message": "Deshabilitar la suspensión de pestañas"
4+
},
5+
"manifest_description": {
6+
"message": "Evita que Chrome suspenda pestañas y se actualicen cuando vuelves a ellas"
7+
},
8+
"manifest_title": {
9+
"message": "La suspensión de pestañas está deshabilitada\nDesactiva/desinstala esta extensión para activarla"
10+
},
11+
"cm_review": {
12+
"message": "Calificar esta extensión en la tienda"
13+
},
14+
"cm_support": {
15+
"message": "Enviar comentarios (sugerencias, problemas)"
16+
}
17+
}

background.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ chrome.tabs.onCreated.addListener(function(tab) {
33
chrome.tabs.update(tab.id, {autoDiscardable: false});
44
});
55

6+
chrome.tabs.onReplaced.addListener(function(tabId) {
7+
chrome.tabs.update(tabId, {autoDiscardable: false});
8+
});
9+
610
chrome.runtime.onInstalled.addListener(function(details) {
711
chrome.tabs.query({}, function(tabs) {
812
tabs.forEach(function(tab) {
@@ -11,6 +15,26 @@ chrome.runtime.onInstalled.addListener(function(details) {
1115
});
1216
});
1317

14-
chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
15-
if(changeInfo.discarded) chrome.tabs.reload(tabId);
18+
19+
chrome.runtime.setUninstallURL("https://chrome.google.com/webstore/detail/dnhngfnfolbmhgealdpolmhimnoliiok/support");
20+
21+
chrome.contextMenus.create({
22+
id: "review",
23+
title: "🌟 " + chrome.i18n.getMessage("cm_review"),
24+
contexts: ["browser_action"]
25+
});
26+
chrome.contextMenus.create({
27+
id: "support",
28+
title: "💬 " + chrome.i18n.getMessage("cm_support"),
29+
contexts: ["browser_action"]
30+
});
31+
chrome.contextMenus.onClicked.addListener(function(info, tab) {
32+
switch(info.menuItemId) {
33+
case "review":
34+
chrome.tabs.create({url: "https://chrome.google.com/webstore/detail/dnhngfnfolbmhgealdpolmhimnoliiok/reviews"});
35+
break;
36+
case "support":
37+
chrome.tabs.create({url: "https://chrome.google.com/webstore/detail/dnhngfnfolbmhgealdpolmhimnoliiok/support"});
38+
break;
39+
}
1640
});

manifest.json

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
{
22
"manifest_version": 2,
3-
"name": "Disable automatic tab discarding",
4-
"description": "Stops Chrome from suspending tabs, and reloading them when you switch to them — works like chrome://flags/#automatic-tab-discarding",
5-
"version": "1.0.2",
3+
"name": "__MSG_manifest_name__",
4+
"description": "__MSG_manifest_description__",
5+
"version": "1.0.3",
66
"background": {
7-
"scripts": ["background.js"]
7+
"scripts": ["background.js"],
8+
"persistent": false
89
},
910
"browser_action": {
10-
"default_title": "Automatic tab discarding currently disabled\nDisable/uninstall this extension to enable it",
11+
"default_title": "__MSG_manifest_title__",
1112
"default_icon":"icon.png"
1213
},
1314
"icons": {
1415
"16":"icon.png",
1516
"48":"icon.png",
1617
"128":"icon.png"
1718
},
18-
"permissions": []
19+
"permissions": ["contextMenus"],
20+
"default_locale": "en"
1921
}

0 commit comments

Comments
 (0)