From 9b56884f53543a0bc4259c46ca39fe2ece7bd989 Mon Sep 17 00:00:00 2001 From: Anthony Lieuallen Date: Sun, 25 Feb 2018 13:33:03 -0500 Subject: [PATCH] Remove all i18n. It's janky and I'm never going to support other languages anyway. --- _locales/en/messages.json | 76 ----------------------------------- background.js | 84 +++++++++++++++++++++------------------ manifest.json | 8 ++-- popup.htm | 37 +++++++++++------ popup.js | 7 ---- 5 files changed, 74 insertions(+), 138 deletions(-) delete mode 100644 _locales/en/messages.json mode change 100644 => 100755 manifest.json diff --git a/_locales/en/messages.json b/_locales/en/messages.json deleted file mode 100644 index 766a04d..0000000 --- a/_locales/en/messages.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "extensionName": { - "message": "Resurrect Pages", - "description": "Name of the extension." - }, - - "extensionDescription": { - "message": "Resurrect dead pages, by finding their ghosts.", - "description": "Description of the add-on." - }, - - "resurrect_page": { - "message": "Resurrect this page", - "description": "Resurrect this page" - }, - - "resurrect_link": { - "message": "Resurrect this link", - "description": "Resurrect this link" - }, - - "resurrectGoogle": { - "message": "with Google", - "description": "with Google" - }, - - "resurrectGoogleText": { - "message": "with Google (text only)", - "description": "with Google (text only)" - }, - - "resurrectArchive": { - "message": "with The Internet Archive", - "description": "with The Internet Archive" - }, - - "resurrectArchiveList": { - "message": "with The Internet Archive (list all)", - "description": "with The Internet Archive (list all)" - }, - - "resurrectArchiveIs": { - "message": "with archive.is", - "description": "with archive.is" - }, - - "resurrectWebcitation": { - "message": "with WebCite", - "description": "with WebCite" - }, - - "resurrectMementoWeb": { - "message": "with Memento Timetravel", - "description": "with Memento Timetravel" - }, - - "resurrectConfigCurrentTab": { - "message": "in the current tab", - "description": "in the current tab" - }, - - "resurrectConfigNewTab": { - "message": "in a new tab (foreground)", - "description": "in a new tab (foreground)" - }, - - "resurrectConfigBgTab": { - "message": "in a new tab (background)", - "description": "in a new tab (background)" - }, - - "resurrectConfigNewWindow": { - "message": "in a new window", - "description": "in a new window" - } -} diff --git a/background.js b/background.js index 96650c4..afd0d99 100644 --- a/background.js +++ b/background.js @@ -3,41 +3,36 @@ chrome.storage.local.get('openIn', item => { openIn = item.openIn; } - function addResurrectItem(context, i18n, id, icon) { - chrome.contextMenus.create({ - id: 'resurrect-' + id + '-' + context, - title: chrome.i18n.getMessage('resurrect' + i18n), - icons: {16: 'icons/cacheicons/' + icon + '.png'}, - contexts: [context], - parentId: 'resurrect-' + context - }, logLastError); - } - - function addConfigItem(context, i18n, where, checked) { - chrome.contextMenus.create({ - id: 'resurrect-' + where + '-' + context, - type: 'radio', - title: chrome.i18n.getMessage('resurrectConfig' + i18n), - contexts: [context], - checked: checked, - parentId: 'resurrect-' + context - }, logLastError); - } - ['page', 'link'].forEach(context => { chrome.contextMenus.create({ + contexts: [context], id: 'resurrect-' + context, - title: chrome.i18n.getMessage('resurrect_' + context), - contexts: [context] + title: 'Resurrect this ' + context, }, logLastError); - addResurrectItem(context, 'Google', 'google', 'google'); - addResurrectItem(context, 'GoogleText', 'googletext', 'google'); - addResurrectItem(context, 'Archive', 'archive', 'waybackmachine'); - addResurrectItem(context, 'ArchiveList', 'archivelist', 'waybackmachine'); - addResurrectItem(context, 'ArchiveIs', 'archiveis', 'archiveis'); - addResurrectItem(context, 'Webcitation', 'webcitation', 'webcitation'); - addResurrectItem(context, 'MementoWeb', 'mementoweb', 'mementoweb'); + chrome.contextMenus.create({ + enabled: false, + id: 'resurrect-with-' + context, + parentId: 'resurrect-' + context, + title: 'With:', + }); + for (let [name, id, icon] of [ + ['Google', 'google', 'google'], + ['Google (text only)', 'googletext', 'google'], + ['The Internet Archive', 'archive', 'waybackmachine'], + ['The Internet Archive (list all)', 'archivelist', 'waybackmachine'], + ['archive.is', 'archiveis', 'archiveis'], + ['WebCite', 'webcitation', 'webcitation'], + ['Memento Timetravel', 'mementoweb', 'mementoweb'], + ]) { + chrome.contextMenus.create({ + contexts: [context], + icons: {16: 'icons/cacheicons/' + icon + '.png'}, + id: 'resurrect-' + id + '-' + context, + parentId: 'resurrect-' + context, + title: name, + }, logLastError); + } chrome.contextMenus.create({ id: 'resurrect-separator-config-' + context, @@ -46,14 +41,27 @@ chrome.storage.local.get('openIn', item => { parentId: 'resurrect-' + context }, logLastError); - addConfigItem( - context, 'CurrentTab', 'current-tab', openIn == openInEnum.CURRENT_TAB); - addConfigItem( - context, 'NewTab', 'new-tab', openIn == openInEnum.NEW_TAB); - addConfigItem( - context, 'BgTab', 'bg-tab', openIn == openInEnum.NEW_BGTAB); - addConfigItem( - context, 'NewWindow', 'new-window', openIn == openInEnum.NEW_WINDOW); + chrome.contextMenus.create({ + enabled: false, + id: 'resurrect-in-' + context, + parentId: 'resurrect-' + context, + title: 'In:', + }); + for (let [name, where, checked] of [ + ['the current tab', 'current-tab', openIn == openInEnum.CURRENT_TAB], + ['a new tab (foreground)', 'new-tab', openIn == openInEnum.NEW_TAB], + ['a new tab (background)', 'bg-tab', openIn == openInEnum.NEW_BGTAB], + ['a new window', 'new-window', openIn == openInEnum.NEW_WINDOW], + ]) { + chrome.contextMenus.create({ + id: 'resurrect-' + where + '-' + context, + type: 'radio', + title: name, + contexts: [context], + checked: checked, + parentId: 'resurrect-' + context + }, logLastError); + } }); }); diff --git a/manifest.json b/manifest.json old mode 100644 new mode 100755 index 2299184..15af71c --- a/manifest.json +++ b/manifest.json @@ -1,10 +1,8 @@ { "manifest_version": 2, - "name": "__MSG_extensionName__", - "short_name": "__MSG_extensionName__", - "description": "__MSG_extensionDescription__", + "name": "Resurrect Pages", + "description": "Resurrect dead pages, by finding their ghosts.", "version": "5", - "default_locale": "en", "homepage_url": "https://github.com/arantius/resurrect-pages", "applications": { @@ -23,7 +21,7 @@ "browser_action": { "default_icon": "icons/page-32.png", - "default_title": "__MSG_extensionName__", + "default_title": "Resurrect Pages", "default_popup": "popup.htm" }, diff --git a/popup.htm b/popup.htm index ffe2df9..8289e6f 100644 --- a/popup.htm +++ b/popup.htm @@ -22,41 +22,54 @@ img { }
- - - - - - - -
+
 
-