From 474a0279be09fe099338b075ce3282cfd8f9873c Mon Sep 17 00:00:00 2001 From: girst Date: Thu, 16 Nov 2017 17:03:39 +0100 Subject: [PATCH] Add TimeTravel (#16), fix contextmenu radio NEW_BGTAB --- _locales/en/messages.json | 5 +++++ background.js | 5 ++++- common.js | 5 +++++ icons/cacheicons/mementoweb.png | Bin 0 -> 821 bytes popup.htm | 4 ++++ 5 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 icons/cacheicons/mementoweb.png diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 3a2a904..766a04d 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -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" diff --git a/background.js b/background.js index 01e89c8..e097779 100644 --- a/background.js +++ b/background.js @@ -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-')) { diff --git a/common.js b/common.js index 781c689..b520ed5 100644 --- a/common.js +++ b/common.js @@ -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; diff --git a/icons/cacheicons/mementoweb.png b/icons/cacheicons/mementoweb.png new file mode 100644 index 0000000000000000000000000000000000000000..aa9ca10e1cbb5c4ca4a8d9840418e222ef54fb62 GIT binary patch literal 821 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc3?z4jzqJQaEa{HEjtmSN`?>!lvI6;x#X;^) z4C~IxyaaL-l0AZa85pWm85kOx85n;42hu?CQUeBtR|yOZRx=nF#PcV`A9VxjQwZ=0 zaRurDsu^O4k?}th(-%FxYq7D{;^MyO>%TWMt4mGw@bi0TX7-4nJa0`Pl zBg3pY5Etnf zh*uCvu+S56{L!1#8KO2>dy0J@#g?$GTuig?J}ePja{KYusyiwV zCtEC$dcdzxD^UB0XJG-0OR~nlBVJDfg*`>O_f1@P?G^8=_OoHT@4hOS`10GY=7${* zA5<94Ju80Nkp1P=s?B%bX6Btg{IO)8OhvOm@m{0(Q#Xk0ey&~alc?bPNngoGVfNxr ztaFl@#l1r;fB!z8|EAM?mc_EBGeA$NmbgZgq$HN4S|t~y0x1R~149#CLnB>7(-1=w zD`O)o0~1{Xb1MUbty5HisS!y-ZhlH;S|z#$Ln~7=h=vc1mRo=t7(8A5T-G@yGywqQ Coh*w0 literal 0 HcmV?d00001 diff --git a/popup.htm b/popup.htm index f3881b9..ffe2df9 100644 --- a/popup.htm +++ b/popup.htm @@ -18,6 +18,7 @@ label { } img { vertical-align: bottom; + height: 16px; }
@@ -39,6 +40,9 @@ img { +