Add TimeTravel (#16), fix contextmenu radio NEW_BGTAB

Cette révision appartient à :
girst 2017-11-16 17:03:39 +01:00
Parent 6a94c66c48
révision 474a0279be
5 fichiers modifiés avec 18 ajouts et 1 suppressions

Voir le fichier

@ -49,6 +49,11 @@
"description": "with WebCite"
},
"resurrectMementoWeb": {
"message": "with Memento Timetravel",
"description": "with Memento Timetravel"
},
"resurrectConfigCurrentTab": {
"message": "in the current tab",
"description": "in the current tab"

Voir le fichier

@ -41,6 +41,7 @@ chrome.storage.local.get('openIn', item => {
addResurrectItem(context, 'ArchiveList', 'archivelist', 'waybackmachine');
addResurrectItem(context, 'ArchiveIs', 'archiveis', 'archiveis');
addResurrectItem(context, 'Webcitation', 'webcitation', 'webcitation');
addResurrectItem(context, 'MementoWeb', 'mementoweb', 'mementoweb');
chrome.contextMenus.create({
id: 'resurrect-separator-config-' + context,
@ -54,7 +55,7 @@ chrome.storage.local.get('openIn', item => {
addConfigItem(
context, 'NewTab', 'new-tab', openIn == openInEnum.NEW_TAB);
addConfigItem(
context, 'BgTab', 'bg-tab', openIn == openInEnum.BG_TAB);
context, 'BgTab', 'bg-tab', openIn == openInEnum.NEW_BGTAB);
addConfigItem(
context, 'NewWindow', 'new-window', openIn == openInEnum.NEW_WINDOW);
});
@ -82,6 +83,8 @@ chrome.contextMenus.onClicked.addListener(function(info, tab) {
goToUrl(genArchiveIsUrl(url), openIn);
} else if (id.startsWith('resurrect-webcitation-')) {
goToUrl(genWebCiteUrl(url), openIn);
} else if (id.startsWith('resurrect-mementoweb-')) {
goToUrl(genMementoUrl(url), openIn);
} else if (id.startsWith('resurrect-current-tab-')) {
setOpenIn(openInEnum.CURRENT_TAB);
} else if (id.startsWith('resurrect-new-tab-')) {

Voir le fichier

@ -47,6 +47,11 @@ function genWebCiteUrl(url) {
return 'http://webcitation.org/query.php?url='+encodeURIComponent(url);
}
function genMementoUrl(url) {
let dateStr =(new Date()).toISOString().replace(/-|T|:|\..*/g, '');
return 'http://timetravel.mementoweb.org/list/'+dateStr+'/'+encodeURIComponent(url);
}
function setOpenIn(where) {
openIn = where;

BIN
icons/cacheicons/mementoweb.png Fichier normal

Fichier binaire non affiché.

Après

Largeur:  |  Hauteur:  |  Taille: 821 B

Voir le fichier

@ -18,6 +18,7 @@ label {
}
img {
vertical-align: bottom;
height: 16px;
}
</style>
<form>
@ -39,6 +40,9 @@ img {
<button data-locale="resurrectWebcitation" data-gen="genWebCiteUrl">
<img src="icons/cacheicons/webcitation.png">
</button>
<button data-locale="resurrectMementoWeb" data-gen="genMementoUrl">
<img src="icons/cacheicons/mementoweb.png">
</button>
<br>