Merge pull request #13 from DenB10/patch-1

Update background.js
Cette révision appartient à :
Albirew 2018-05-04 16:29:57 +02:00 révisé par GitHub
révision e2fed0aac7
Signature inconnue de Forgejo
ID de la clé GPG: 4AEE18F83AFDEB23
1 fichiers modifiés avec 14 ajouts et 28 suppressions

Voir le fichier

@ -7,32 +7,25 @@ chrome.storage.local.get('openIn', item => {
chrome.contextMenus.create({ chrome.contextMenus.create({
contexts: [context], contexts: [context],
id: 'resurrect-' + context, id: 'resurrect-' + context,
title: chrome.i18n.getMessage('resurrect' + i18n) + context, title: chrome.i18n.getMessage('resurrect_' + context),
}, logLastError); }, logLastError);
chrome.contextMenus.create({
enabled: false,
id: 'resurrect-' + where + '-' + context,
parentId: 'resurrect-' + context,
title: chrome.i18n.getMessage('resurrectConfig' + i18n),
});
for (let [name, id, icon] of [ for (let [name, id, icon] of [
['Google', 'google', 'google'], ['Google', 'google', 'google'],
['Google (text only)', 'googletext', 'google'], ['GoogleText', 'googletext', 'google'],
['The Internet Archive', 'archive', 'waybackmachine'], ['Archive', 'archive', 'waybackmachine'],
['The Internet Archive (list all)', 'archivelist', 'waybackmachine'], ['ArchiveList', 'archivelist', 'waybackmachine'],
['archive.is', 'archiveis', 'archiveis'], ['ArchiveIs', 'archiveis', 'archiveis'],
['WebCite', 'webcitation', 'webcitation'], ['WebCitation', 'webcitation', 'webcitation'],
['Memento Timetravel', 'mementoweb', 'mementoweb'], ['MementoWeb', 'mementoweb', 'mementoweb'],
['isup.me', 'IsUp', 'isup'], ['IsUp', 'isup', 'isup'],
]) { ]) {
chrome.contextMenus.create({ chrome.contextMenus.create({
contexts: [context], contexts: [context],
icons: {16: 'icons/cacheicons/' + icon + '.png'}, icons: {16: 'icons/cacheicons/' + icon + '.png'},
id: 'resurrect-' + id + '-' + context, id: 'resurrect-' + id + '-' + context,
parentId: 'resurrect-' + context, parentId: 'resurrect-' + context,
title: chrome.i18n.getMessage('resurrect_' + context), title: chrome.i18n.getMessage('resurrect' + name),
}, logLastError); }, logLastError);
} }
@ -43,23 +36,16 @@ chrome.storage.local.get('openIn', item => {
parentId: 'resurrect-' + context parentId: 'resurrect-' + context
}, logLastError); }, logLastError);
chrome.contextMenus.create({
enabled: false,
id: 'resurrect-in-' + context,
parentId: 'resurrect-' + context,
title: 'In:',
});
for (let [name, where, checked] of [ for (let [name, where, checked] of [
['the current tab', 'current-tab', openIn == openInEnum.CURRENT_TAB], ['CurrentTab', 'current-tab', openIn == openInEnum.CURRENT_TAB],
['a new tab (foreground)', 'new-tab', openIn == openInEnum.NEW_TAB], ['NewTab', 'new-tab', openIn == openInEnum.NEW_TAB],
['a new tab (background)', 'bg-tab', openIn == openInEnum.NEW_BGTAB], ['BgTab', 'bg-tab', openIn == openInEnum.NEW_BGTAB],
['a new window', 'new-window', openIn == openInEnum.NEW_WINDOW], ['NewWindow', 'new-window', openIn == openInEnum.NEW_WINDOW],
]) { ]) {
chrome.contextMenus.create({ chrome.contextMenus.create({
id: 'resurrect-' + where + '-' + context, id: 'resurrect-' + where + '-' + context,
type: 'radio', type: 'radio',
title: name, title: chrome.i18n.getMessage('resurrectConfig' + name),
contexts: [context], contexts: [context],
checked: checked, checked: checked,
parentId: 'resurrect-' + context parentId: 'resurrect-' + context