1
1
Bifurcation 0

Update background.js

Context menu revived
Cette révision appartient à :
DenB10 2018-05-04 11:30:33 +02:00 révisé par GitHub
Parent 9fc038e1dd
révision 12774ecfc3
Aucune clé n'a été trouvée pour cette signature dans la base de données
ID de la clé GPG: 4AEE18F83AFDEB23

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