From 4f124ee566312b452fe493d7485e0a7c7c36d04e Mon Sep 17 00:00:00 2001 From: girst Date: Sat, 19 Aug 2017 18:32:36 +0200 Subject: [PATCH] Rewrite as WebExtension Not everything that was in the old version has been brought over yet. This is mainly: * all the locales (English only currently) * toolbar button * hotkey (Ctrl-Shift-U) * network error page However, the main feature is there: resurrect * the current page * the link right-clicked on * the selected string of text in either * the current * a new foreground tab * a new background tab * a new window using * Google Cache * Google Cache (Text-Only) * The Internet Archive's Wayback Machine * Archive.is * WebCite --- README.md | 6 +- _locales/en/messages.json | 72 +++ background.js | 412 ++++++++++++++++++ chrome.manifest | 42 -- content/netError.xhtml | 40 -- content/resurrect-overlay.xul | 41 -- content/resurrect-select-mirror.xul | 59 --- content/resurrect.js | 191 -------- defaults/preferences/resurrect.js | 3 - icons/cacheicons/archiveis.png | Bin 0 -> 709 bytes {skin => icons}/cacheicons/google.png | Bin {skin => icons}/cacheicons/waybackmachine.png | Bin {skin => icons}/cacheicons/webcitation.png | Bin icons/page-16.png | Bin 0 -> 669 bytes skin/em-icon.png => icons/page-32.png | Bin {skin => icons}/tb-icon-large.png | Bin install.rdf | 23 - manifest.json | 29 ++ skin/cacheicons/archive.png | Bin 177 -> 0 bytes skin/cacheicons/archiveis.ico | Bin 5430 -> 0 bytes skin/netError.css | 46 -- skin/resurrect-overlay.css | 6 - skin/select-mirror.css | 3 - skin/tb-icon-small.png | Bin 719 -> 0 bytes 24 files changed, 516 insertions(+), 457 deletions(-) create mode 100644 _locales/en/messages.json create mode 100644 background.js delete mode 100644 chrome.manifest delete mode 100644 content/netError.xhtml delete mode 100644 content/resurrect-overlay.xul delete mode 100644 content/resurrect-select-mirror.xul delete mode 100644 content/resurrect.js delete mode 100644 defaults/preferences/resurrect.js create mode 100644 icons/cacheicons/archiveis.png rename {skin => icons}/cacheicons/google.png (100%) rename {skin => icons}/cacheicons/waybackmachine.png (100%) rename {skin => icons}/cacheicons/webcitation.png (100%) create mode 100644 icons/page-16.png rename skin/em-icon.png => icons/page-32.png (100%) rename {skin => icons}/tb-icon-large.png (100%) delete mode 100644 install.rdf create mode 100644 manifest.json delete mode 100644 skin/cacheicons/archive.png delete mode 100755 skin/cacheicons/archiveis.ico delete mode 100644 skin/netError.css delete mode 100644 skin/resurrect-overlay.css delete mode 100755 skin/select-mirror.css delete mode 100644 skin/tb-icon-small.png diff --git a/README.md b/README.md index 4bf8efa..a8e09ab 100644 --- a/README.md +++ b/README.md @@ -20,12 +20,12 @@ Hit back and try another one! * Accessible: * In the context (right-click) menu for the current page, and for all links. - * In the toolbar, just customize it to drag the button in. - * With the keyboard: press `Ctrl-Shift-U` - * Directly in the net error ("Firefox could not load this page...") page. # Changelog + * Version 4 (Aug 19, 2017) + * completely rewritten as WebExtension + * Not everything from the old version ported over yet * Version 3 (Sep 9, 2015) * Fix layout on error page w.r.t. the "report error" dialog. * Add keyboard accessibility for cache retrieval buttons. diff --git a/_locales/en/messages.json b/_locales/en/messages.json new file mode 100644 index 0000000..79bab1a --- /dev/null +++ b/_locales/en/messages.json @@ -0,0 +1,72 @@ +{ + "extensionName": { + "message": "Resurrect Pages", + "description": "Name of the extension." + }, + + "extensionDescription": { + "message": "Resurrect dead pages, by finding their ghosts.", + "description": "Description of the add-on." + }, + + "contextMenuItemResurrectPage": { + "message": "Resurrect this page", + "description": "Resurrect this page" + }, + + "contextMenuItemResurrectLink": { + "message": "Resurrect this link", + "description": "Resurrect this link" + }, + + "contextMenuItemResurrectSelection": { + "message": "Resurrect this selection", + "description": "Resurrect this selection, TODO: only if its a link" + }, + + "contextMenuItemResurrectGoogle": { + "message": "with Google", + "description": "with Google" + }, + + "contextMenuItemResurrectGoogleText": { + "message": "with Google (text only)", + "description": "with Google (text only)" + }, + + "contextMenuItemResurrectArchive": { + "message": "with The Internet Archive", + "description": "with The Internet Archive" + }, + + "contextMenuItemResurrectArchiveIs": { + "message": "with archive.is", + "description": "with archive.is" + }, + + "contextMenuItemResurrectWebcitation": { + "message": "with WebCite", + "description": "with WebCite" + }, + + "contextMenuItemResurrectConfigCurrentTab": { + "message": "in the current tab", + "description": "in the current tab" + }, + + "contextMenuItemResurrectConfigNewTab": { + "message": "in a new tab (foreground)", + "description": "in a new tab (foreground)" + }, + + "contextMenuItemResurrectConfigNewBackgroundTab": { + "message": "in a new tab (background)", + "description": "in a new tab (background)" + }, + + "contextMenuItemResurrectConfigNewWindow": { + "message": "in a new window", + "description": "in a new window" + } + +} diff --git a/background.js b/background.js new file mode 100644 index 0000000..181b720 --- /dev/null +++ b/background.js @@ -0,0 +1,412 @@ +openInEnum = { + CURRENT_TAB : 0, + NEW_TAB : 1, + NEW_BGTAB : 2, + NEW_WINDOW : 3 +} + +var openIn = openInEnum.CURRENT_TAB; +browser.storage.local.get ("openIn").then (function (item) {if (item.openIn) {openIn = item.openIn}}, onError); + +function onCreated(n) { + if (browser.runtime.lastError) { + console.log(`Error: ${browser.runtime.lastError}`); + } +} + +function onRemoved() { } + +function onError(error) { + console.log(`Error: ${error}`); +} + +/* +Create all the context menu items. +*/ +// top level {{{ +browser.contextMenus.create({ + id: "resurrect-page", + title: browser.i18n.getMessage("contextMenuItemResurrectPage"), + contexts: ["page"] +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link", + title: browser.i18n.getMessage("contextMenuItemResurrectLink"), + contexts: ["link"] +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection", + title: browser.i18n.getMessage("contextMenuItemResurrectSelection"), + contexts: ["selection"] +}, onCreated); +//}}} + +// resurrect page {{{ +browser.contextMenus.create({ + id: "resurrect-page-google", + title: browser.i18n.getMessage("contextMenuItemResurrectGoogle"), + icons: { 16: "icons/cacheicons/google.png" }, + contexts: ["all"], + parentId: "resurrect-page" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-page-googletext", + title: browser.i18n.getMessage("contextMenuItemResurrectGoogleText"), + icons: { 16: "icons/cacheicons/google.png" }, + contexts: ["all"], + parentId: "resurrect-page" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-page-archive", + title: browser.i18n.getMessage("contextMenuItemResurrectArchive"), + icons: { 16: "icons/cacheicons/waybackmachine.png" }, + contexts: ["all"], + parentId: "resurrect-page" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-page-archiveis", + title: browser.i18n.getMessage("contextMenuItemResurrectArchiveIs"), + icons: { 16: "icons/cacheicons/archiveis.png" }, + contexts: ["all"], + parentId: "resurrect-page" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-page-webcitation", + title: browser.i18n.getMessage("contextMenuItemResurrectWebcitation"), + icons: { 16: "icons/cacheicons/webcitation.png" }, + contexts: ["all"], + parentId: "resurrect-page" +}, onCreated); +//}}} + +// resurrect link {{{ +browser.contextMenus.create({ + id: "resurrect-link-google", + title: browser.i18n.getMessage("contextMenuItemResurrectGoogle"), + icons: { 16: "icons/cacheicons/google.png" }, + contexts: ["all"], + parentId: "resurrect-link" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link-googletext", + title: browser.i18n.getMessage("contextMenuItemResurrectGoogleText"), + icons: { 16: "icons/cacheicons/google.png" }, + contexts: ["all"], + parentId: "resurrect-link" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link-archive", + title: browser.i18n.getMessage("contextMenuItemResurrectArchive"), + icons: { 16: "icons/cacheicons/waybackmachine.png" }, + contexts: ["all"], + parentId: "resurrect-link" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link-archiveis", + title: browser.i18n.getMessage("contextMenuItemResurrectArchiveIs"), + icons: { 16: "icons/cacheicons/archiveis.png" }, + contexts: ["all"], + parentId: "resurrect-link" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link-webcitation", + title: browser.i18n.getMessage("contextMenuItemResurrectWebcitation"), + icons: { 16: "icons/cacheicons/webcitation.png" }, + contexts: ["all"], + parentId: "resurrect-link" +}, onCreated); +//}}} + +// resurrect selection {{{ +browser.contextMenus.create({ + id: "resurrect-selection-google", + title: browser.i18n.getMessage("contextMenuItemResurrectGoogle"), + icons: { 16: "icons/cacheicons/google.png" }, + contexts: ["all"], + parentId: "resurrect-selection" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection-googletext", + title: browser.i18n.getMessage("contextMenuItemResurrectGoogleText"), + icons: { 16: "icons/cacheicons/google.png" }, + contexts: ["all"], + parentId: "resurrect-selection" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection-archive", + title: browser.i18n.getMessage("contextMenuItemResurrectArchive"), + icons: { 16: "icons/cacheicons/waybackmachine.png" }, + contexts: ["all"], + parentId: "resurrect-selection" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection-archiveis", + title: browser.i18n.getMessage("contextMenuItemResurrectArchiveIs"), + icons: { 16: "icons/cacheicons/archiveis.png" }, + contexts: ["all"], + parentId: "resurrect-selection" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection-webcitation", + title: browser.i18n.getMessage("contextMenuItemResurrectWebcitation"), + icons: { 16: "icons/cacheicons/webcitation.png" }, + contexts: ["all"], + parentId: "resurrect-selection" +}, onCreated); +//}}} + +//config page {{{ +browser.contextMenus.create({ + id: "separator-1", + type: "separator", + contexts: ["all"], + parentId: "resurrect-page" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-page-current-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigCurrentTab"), + contexts: ["all"], + checked: true, + parentId: "resurrect-page" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-page-new-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewTab"), + contexts: ["all"], + checked: false, + parentId: "resurrect-page" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-page-new-background-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewBackgroundTab"), + contexts: ["all"], + checked: false, + parentId: "resurrect-page" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-page-new-window", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewWindow"), + contexts: ["all"], + checked: false, + parentId: "resurrect-page" +}, onCreated); +//}}} + +//config link {{{ +browser.contextMenus.create({ + id: "separator-2", + type: "separator", + contexts: ["all"], + parentId: "resurrect-link" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link-current-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigCurrentTab"), + contexts: ["all"], + checked: true, + parentId: "resurrect-link" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link-new-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewTab"), + contexts: ["all"], + checked: false, + parentId: "resurrect-link" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link-new-background-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewBackgroundTab"), + contexts: ["all"], + checked: false, + parentId: "resurrect-link" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-link-new-window", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewWindow"), + contexts: ["all"], + checked: false, + parentId: "resurrect-link" +}, onCreated); +//}}} + +//config selection {{{ +browser.contextMenus.create({ + id: "separator-3", + type: "separator", + contexts: ["all"], + parentId: "resurrect-selection" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection-current-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigCurrentTab"), + contexts: ["all"], + checked: true, + parentId: "resurrect-selection" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection-new-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewTab"), + contexts: ["all"], + checked: false, + parentId: "resurrect-selection" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection-new-background-tab", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewBackgroundTab"), + contexts: ["all"], + checked: false, + parentId: "resurrect-selection" +}, onCreated); + +browser.contextMenus.create({ + id: "resurrect-selection-new-window", + type: "radio", + title: browser.i18n.getMessage("contextMenuItemResurrectConfigNewWindow"), + contexts: ["all"], + checked: false, + parentId: "resurrect-selection" +}, onCreated); +//}}} + + +browser.contextMenus.onClicked.addListener(function(info, tab) { + var gotoUrl=null; + + var rawUrl = info.pageUrl; + + switch (info.menuItemId) { + case "resurrect-page-google": + gotoUrl='https://www.google.com/search?q=cache:'+encodeURIComponent(info.pageUrl); + break; + case "resurrect-link-google": + gotoUrl='https://www.google.com/search?q=cache:'+encodeURIComponent(info.linkUrl); + break; + case "resurrect-selection-google": + gotoUrl='https://www.google.com/search?q=cache:'+encodeURIComponent(info.selectionText); + break; + + case "resurrect-page-googletext": + gotoUrl='https://www.google.com/search?strip=1&q=cache:'+encodeURIComponent(info.pageUrl); + break; + case "resurrect-link-googletext": + gotoUrl='https://www.google.com/search?strip=1&q=cache:'+encodeURIComponent(info.linkUrl); + break; + case "resurrect-selection-googletext": + gotoUrl='https://www.google.com/search?strip=1&q=cache:'+encodeURIComponent(info.selectionText); + break; + + case "resurrect-page-archive": + var dateStr = (new Date()).toISOString().replace(/-|T|:|\..*/g, ''); + gotoUrl='https://web.archive.org/web/'+dateStr+'/'+info.pageUrl + break; + case "resurrect-link-archive": + var dateStr = (new Date()).toISOString().replace(/-|T|:|\..*/g, ''); + gotoUrl='https://web.archive.org/web/'+dateStr+'/'+info.linkUrl + break; + case "resurrect-selection-archive": + var dateStr = (new Date()).toISOString().replace(/-|T|:|\..*/g, ''); + gotoUrl='https://web.archive.org/web/'+dateStr+'/'+info.selectionText + break; + + case "resurrect-page-archiveis": + gotoUrl='https://archive.is/'+info.pageUrl; + break; + case "resurrect-link-archiveis": + gotoUrl='https://archive.is/'+info.linkUrl; + break; + case "resurrect-selection-archiveis": + gotoUrl='https://archive.is/'+info.selectionText; + break; + + case "resurrect-page-webcitation": + gotoUrl='http://webcitation.org/query.php?url='+encodeURIComponent(info.pageUrl); + break; + case "resurrect-link-webcitation": + gotoUrl='http://webcitation.org/query.php?url='+encodeURIComponent(info.linkUrl); + break; + case "resurrect-selection-webcitation": + gotoUrl='http://webcitation.org/query.php?url='+encodeURIComponent(info.selectionText); + break; + + case "resurrect-page-current-tab": + case "resurrect-link-current-tab": + case "resurrect-selection-current-tab": + openIn = openInEnum.CURRENT_TAB; + browser.storage.local.set({openIn: openIn}); + return; + case "resurrect-page-new-tab": + case "resurrect-link-new-tab": + case "resurrect-selection-new-tab": + openIn = openInEnum.NEW_TAB; + browser.storage.local.set({openIn: openIn}); + return; + case "resurrect-page-new-background-tab": + case "resurrect-link-new-background-tab": + case "resurrect-selection-new-background-tab": + openIn = openInEnum.NEW_BGTAB; + browser.storage.local.set({openIn: openIn}); + return; + case "resurrect-page-new-window": + case "resurrect-link-new-window": + case "resurrect-selection-new-window": + openIn = openInEnum.NEW_WINDOW; + browser.storage.local.set({openIn: openIn}); + return; + } + + if (gotoUrl) { + console.log ("would've gone to " + gotoUrl + " opened in " + openIn); + switch (openIn) { + case openInEnum.CURRENT_TAB: + browser.tabs.update({ "url": gotoUrl}); + break; + case openInEnum.NEW_TAB: + browser.tabs.create({ "url": gotoUrl}); + break; + case openInEnum.NEW_BGTAB: + browser.tabs.create({ "url": gotoUrl, "active":false}); + break; + case openInEnum.NEW_WINDOW: + browser.windows.create({ "url": gotoUrl}); + break; + } + } +}); + + diff --git a/chrome.manifest b/chrome.manifest deleted file mode 100644 index f29ef28..0000000 --- a/chrome.manifest +++ /dev/null @@ -1,42 +0,0 @@ -content resurrect content/ contentaccessible=yes -skin resurrect classic/1.0 skin/ - -overlay chrome://browser/content/browser.xul chrome://resurrect/content/resurrect-overlay.xul -style chrome://global/content/customizeToolbar.xul chrome://resurrect/skin/resurrect-overlay.css - -locale resurrect ca-AD locale/ca-AD/ -locale resurrect cs-CZ locale/cs-CZ/ -locale resurrect da locale/da/ -locale resurrect da-DK locale/da-DK/ -locale resurrect de locale/de/ -locale resurrect de-DE locale/de-DE/ -locale resurrect el locale/el/ -locale resurrect el-GR locale/el-GR/ -locale resurrect en-US locale/en-US/ -locale resurrect es-AR locale/es-AR/ -locale resurrect es-CL locale/es-CL/ -locale resurrect es-ES locale/es-ES/ -locale resurrect fi locale/fi/ -locale resurrect fi-FI locale/fi-FI/ -locale resurrect fr locale/fr/ -locale resurrect fr-FR locale/fr-FR/ -locale resurrect hr-HR locale/hr-HR/ -locale resurrect it locale/it/ -locale resurrect it-IT locale/it-IT/ -locale resurrect ja-JP locale/ja-JP/ -locale resurrect ko-KR locale/ko-KR/ -locale resurrect nl locale/nl/ -locale resurrect nl-NL locale/nl-NL/ -locale resurrect pl locale/pl/ -locale resurrect pl-PL locale/pl-PL/ -locale resurrect pt-BR locale/pt-BR/ -locale resurrect pt-PT locale/pt-PT/ -locale resurrect ru-RU locale/ru-RU/ -locale resurrect sl-SI locale/sl-SI/ -locale resurrect sr locale/sr/ -locale resurrect sv-SE locale/sv-SE/ -locale resurrect tr locale/tr/ -locale resurrect tr-TR locale/tr-TR/ -locale resurrect uk-UA locale/uk-UA/ -locale resurrect zh-CN locale/zh-CN/ -locale resurrect zh-TW locale/zh-TW/ diff --git a/content/netError.xhtml b/content/netError.xhtml deleted file mode 100644 index 2b900d9..0000000 --- a/content/netError.xhtml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - -
- - - - - - - &resurrect.thispage; - - - - - - - -
- - diff --git a/content/resurrect-overlay.xul b/content/resurrect-overlay.xul deleted file mode 100644 index 12d8e7f..0000000 --- a/content/resurrect-overlay.xul +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content/resurrect-select-mirror.xul b/content/resurrect-select-mirror.xul deleted file mode 100644 index cd477bb..0000000 --- a/content/resurrect-select-mirror.xul +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/content/resurrect.js b/content/resurrect.js deleted file mode 100644 index 108d5a5..0000000 --- a/content/resurrect.js +++ /dev/null @@ -1,191 +0,0 @@ -var resurrect={ - - contextUrl:null, - -// // // // // // // // // // // // // // // // // // // // // // // // // // // - - onLoad:function() { - window.removeEventListener('load', resurrect.onLoad, false); - document.getElementById('contentAreaContextMenu') - .addEventListener('popupshowing', resurrect.toggleContextItems, false); - addEventListener('DOMContentLoaded', resurrect.contentDomLoad, false); - }, - - toggleContextItems:function(event) { - resurrect.contextUrl = gContextMenu.linkURL; - - var onDocument=!( - gContextMenu.isContentSelected || gContextMenu.onTextInput || - gContextMenu.onLink || gContextMenu.onImage); - - document.getElementById('resurrect-page-context') - .setAttribute('hidden', !onDocument); - document.getElementById('resurrect-link-context') - .setAttribute('hidden', !gContextMenu.onLink); - }, - - contentDomLoad:function(event) { - var contentDoc=event.target; - - if (contentDoc.documentURI.indexOf('about:neterror') != 0) return; - - // Inject our content... - var xhr = new XMLHttpRequest(); - xhr.open('GET', 'chrome://resurrect/content/netError.xhtml', true); - xhr.onload = function() { - var fieldset = xhr.responseXML.getElementById('resurrect'); - var xhtml = new XMLSerializer().serializeToString(fieldset); - var container = contentDoc.getElementById('errorPageContainer'); - container.innerHTML += xhtml; - - // ...plus the CSS. - var link = contentDoc.createElement('link'); - link.setAttribute('rel', 'stylesheet'); - link.setAttribute('href', 'chrome://resurrect/skin/netError.css'); - link.setAttribute('type', 'text/css'); - link.setAttribute('media', 'all'); - contentDoc.getElementsByTagName('head')[0].appendChild(link); - - // Add the className that enables it, only when appropriate. - contentDoc.location.href = - 'javascript:if ("nssBadCert" != getErrorCode()) {' - + 'document.body.className += " resurrect";' - + '}; void(0)'; - - // Add event listener. - contentDoc.getElementById('resurrect').addEventListener( - 'click', resurrect.clickedHtml, false); - contentDoc.getElementById('resurrect').addEventListener( - 'keypress', resurrect.clickedHtml, false); - }; - xhr.send(null); - }, - - disableButtons:function(doc) { - var bs=doc.getElementById('resurrect') - .getElementsByTagName('xul:button'); - for (var i=0, b=null; b=bs[i]; i++) { - b.setAttribute('disabled', 'true'); - } - }, - -// // // // // // // // // // // // // // // // // // // // // // // // // // // - - page:function(event) { - var doc=getBrowser().contentWindow.document; - resurrect.showDialog(doc.location.href); - }, - - link:function(event) { - resurrect.showDialog(resurrect.contextUrl); - }, - -// // // // // // // // // // // // // // // // // // // // // // // // // // // - - loadTarget:function() { - var pref=Components.classes['@mozilla.org/preferences-service;1'] - .getService(Components.interfaces.nsIPrefBranch); - var target=pref.getCharPref('extensions.resurrect.target'); - - document.getElementById('targetGroup').selectedItem= - document.getElementById(target); - }, - - saveTarget:function(el) { - var target=document.getElementById('targetGroup').selectedItem.id; - - var pref=Components.classes['@mozilla.org/preferences-service;1'] - .getService(Components.interfaces.nsIPrefBranch); - pref.setCharPref('extensions.resurrect.target', target); - }, - -// // // // // // // // // // // // // // // // // // // // // // // // // // // - - showDialog:function(url) { - window.openDialog( - 'chrome://resurrect/content/resurrect-select-mirror.xul', - '_blank', - 'modal,centerscreen,resizable=no,chrome,dependent', - getBrowser().contentWindow.document, url); - }, - - clickedHtml:function(event) { - if ('true'==event.target.getAttribute('disabled')) { - return; - } - if ('keypress' == event.type) { - if (event.target.parentNode.id != 'resurrect') return; - if (event.charCode != 32 && event.keyCode != 13) return; - } - - return resurrect.clickHandler( - event, - event.target.ownerDocument, - event.target.ownerDocument.location.href); - }, - - clickedXul:function(event) { - resurrect.saveTarget(event.target); - - return resurrect.clickHandler( - event, - window.arguments[0], - window.arguments[1]); - }, - - clickHandler:function(event, contentDoc, rawUrl) { - resurrect.disableButtons(event.target.ownerDocument); - - // Run the actual code. After timeout for UI repaint. - setTimeout( - resurrect.selectMirror, 1, - event.target.getAttribute('value'), - event.target.ownerDocument, - contentDoc, rawUrl); - }, - - selectMirror:function(mirror, ownerDoc, contentDoc, rawUrl) { - var gotoUrl=null; - var encUrl=encodeURIComponent(rawUrl); - - switch (mirror) { - case 'google': - gotoUrl='https://www.google.com/search?q=cache:'+encUrl; - break; - case 'googletext': - gotoUrl='https://www.google.com/search?strip=1&q=cache:'+encUrl; - break; - case 'archive': - var dateStr = (new Date()).toISOString().replace(/-|T|:|\..*/g, ''); - gotoUrl='https://web.archive.org/web/'+dateStr+'/'+rawUrl; - break; - case 'archiveis': - gotoUrl='https://archive.is/'+rawUrl; - break; - case 'webcitation': - gotoUrl='http://webcitation.org/query.php?url='+encUrl; - break; - default: - return false; - break; - } - - if (gotoUrl) { - if (ownerDoc.getElementById('targetTab').getAttribute('selected')) { - window.opener.openUILinkIn(gotoUrl, 'tab'); - } else if (ownerDoc.getElementById('targetWin').getAttribute('selected')) { - // the setTimeout keeps focus from returning to the opener - setTimeout(function(){ - window.opener.openNewWindowWith(gotoUrl, null, null); - }, 10); - } else { - contentDoc.location.assign(gotoUrl); - } - - if ('chrome://resurrect/content/resurrect-select-mirror.xul'==window.document.location) { - // setTimeout avoids errors because the window is gone - setTimeout(window.close, 0); - } - } - } -}; diff --git a/defaults/preferences/resurrect.js b/defaults/preferences/resurrect.js deleted file mode 100644 index c51d0a9..0000000 --- a/defaults/preferences/resurrect.js +++ /dev/null @@ -1,3 +0,0 @@ -pref("extensions.{0c8fbd76-bdeb-4c52-9b24-d587ce7b9dc3}.description", "chrome://resurrect/locale/overlay.properties"); - -pref("extensions.resurrect.target", "targetCurr"); diff --git a/icons/cacheicons/archiveis.png b/icons/cacheicons/archiveis.png new file mode 100644 index 0000000000000000000000000000000000000000..5262759191abe0ed1dc97e884b9732219d64c913 GIT binary patch literal 709 zcmV;$0y_PPP)j2A(%k(-g@vQzGpN%PI#8vJ|L9P!w zP;xnHYHCmv1(V4{Hk;iA0OXX+;Qc|ArY(Xqa~yB4qowBz%TM1B*6X-&+gVVO)oP`n zYolYMwB2okl)%>1H`YFdQE93uKUqurl|F(W{LIhJ79a&cq&kMAu3#;&j=^@CL$!LK zn%_U>QFEBa&Q4xG96K1;2yGI5w9ZB-L22zT#L_5mgy_c=all~vGc=|WKyQmGVfw;NfO>F(~{ rA4sRujE|2aNm9{cnw*^6IV6BT#;x5!&pT4Q00000NkvXXu0mjfkQqPU literal 0 HcmV?d00001 diff --git a/skin/cacheicons/google.png b/icons/cacheicons/google.png similarity index 100% rename from skin/cacheicons/google.png rename to icons/cacheicons/google.png diff --git a/skin/cacheicons/waybackmachine.png b/icons/cacheicons/waybackmachine.png similarity index 100% rename from skin/cacheicons/waybackmachine.png rename to icons/cacheicons/waybackmachine.png diff --git a/skin/cacheicons/webcitation.png b/icons/cacheicons/webcitation.png similarity index 100% rename from skin/cacheicons/webcitation.png rename to icons/cacheicons/webcitation.png diff --git a/icons/page-16.png b/icons/page-16.png new file mode 100644 index 0000000000000000000000000000000000000000..58d965e859d05787c8b7851e1840b1a04b2c1d2c GIT binary patch literal 669 zcmV;O0%HA%P)WtGNKEtT)DS}pO3Zr`SV8% zZ{ECS`2U}Q;m)1wQ)kVdm4nRyCS=aeUFRdeeEC}a`}e0;&tE=@{`u>RpT2?qcLfEd zsNUXQHf#p4pgQN5sfaKu!>!xbW>r;IEn{F{VA!$a - - - {0c8fbd76-bdeb-4c52-9b24-d587ce7b9dc3} - Resurrect Pages - 3 - Resurrect dead pages, by finding their ghosts. - - http://trac.arantius.com/wiki/Extensions/Resurrect - chrome://resurrect/skin/em-icon.png - - Anthony Lieuallen - Translators from BabelZilla.org - - - - {ec8030f7-c20a-464f-9b0e-13a3a9e97384} - 3.0 - 43.* - - - - diff --git a/manifest.json b/manifest.json new file mode 100644 index 0000000..bcafaa9 --- /dev/null +++ b/manifest.json @@ -0,0 +1,29 @@ +{ + + "manifest_version": 2, + "name": "__MSG_extensionName__", + "description": "__MSG_extensionDescription__", + "version": "1.0", + "default_locale": "en", + "applications": { + "gecko": { + "strict_min_version": "56.0b3" + } + }, + + "background": { + "scripts": ["background.js"] + }, + + "permissions": [ + "storage", + "contextMenus", + "activeTab" + ], + + "icons": { + "16": "icons/page-16.png", + "32": "icons/page-32.png" + } + +} diff --git a/skin/cacheicons/archive.png b/skin/cacheicons/archive.png deleted file mode 100644 index 01f20ca7ae69845450668e3d0e9c8c69515eb87a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61SBU+%rFB|Ea{HEjtmUzPnffIy#(?lOI#yL zg7ec#$`gxH85~pclTsBta}(23gHjVyDhp4h+5i4AV0h=N VqHuJk&19f)44$rjF6*2UngCb6H2eSn diff --git a/skin/cacheicons/archiveis.ico b/skin/cacheicons/archiveis.ico deleted file mode 100755 index b7552556c8031e27a9bec60f1836a76cbbcb0706..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5430 zcmc&&3s9BE6~4)YPHSrbO&k@25F!wvAZ??764CM&3|=7>Q62&0DK9S`sPwDJbwLsqnmBlP|1Do|NjiSqJt)YjIbrltm^rKPB@u0}~o3GUy&kMQtt ziJCNL`jXVwJBYmeRD^`OBPlruxw$!b_UxIYdO`i>=4Pao+2Uf0GcMimKvBg9=pP6` zLc(5jc6M<#=Hu_{9)L%@F=8rq!%^@as;;=;Z&#h+?Dhu~ms&$4vRhC;AuR?K5aR6J z!#H-?0o8*(X#BS?azC@hV}zr-$BpKse%}5cPC5kl!VkcY-VV=GmIy7}jd+5q&lco; z%tzr_TV!UQm{&jioDlI4!~ZKcq}>a|XT*7lkX2!iM~K1`L?A!^=6+WAuY2) zb;Si7&qzjkW(vOiqD@*iG&BUUSd5mI77nc9>eZ`=kB^6qjSYf=g64%lAb_5p9_QNy z1qD)@4Gj&*&d!Fjvon|mr$ z^;sb`H5H+upq=Y{gZr{F5yu2j^ z8yBv9U2YIXS`7(h^=?URj$nemAAzDRsQRltaf%2>5ghz3`9|c7KFG?ix?Tmw4yv$n(MJ6bfjC+F zA>xX6;d{hVe?rkm021-1ZEGn%j;w4`ir4F*sVRrLx+ZBKWZ_SZ%Z5kJHrycl#a*7* zN8@C697UTUJYfRSQ4_=@nIbgB2&x(icz5F)__UT!oa~zuiDk>=7sapmrUL#>w#pHV z^K^droaXn>A8Dcfu@D8Hf^%Ovqp{lyjki1ychZ>nVlhVT*;=Hf>Eq0qa;^_A zJN_@4TJgTS7Cxml&nJ7I(E1C?_y{PsqCSaG2LUbJq7XYgQ!Fj&XLd6;27KrcH#7Q{=}OI`ZD7hp@Yy(^*|Q3^BMn10(*}q zBxCDVb;_sW-^;|G{OkfK>Metcu@csAUyBVU%8-BScTnB38tOZgpiVMPf)+uWu-Q}@ z3UB-de|%pFo9W$87O#CS!X%Ig4LM9TBL2Ft-zRfQ*qw`x3sz`Q`WS0s5 zAlxL3BOUgBI(SNTQ{#`N`~<8lRb}EY$tl6kGdmGR`|Aj;evRk);q~i6C!E zgbJ;%+r_=Gh|-5`i~;sUZGn51F~o&d2+r6+>ySjTF@&^ZV6<}$?%e5-nZKjG0}6%; z#F_|$SOch7s$iw|3OMFi<7lrp(kUjLp}h2KZ>)Jo9(#Rtp>Mt(mv6eEy~h=LIy*RS z_ITO-FHsZ+h{0RV!$<9IG_nLlejkWUjv5pf5>P~|a-RI6a>x(c`0vozQ!zkmallvW zxpRc9{Hz}WZvi$0sM8LJrdX7S_uRA**0i5ug9u;JyRz;|v`h+V-ed9kH%?Gcd>vz> zPb5R&^2P8o17|bNLThmFk`Ii)~%bZRPHltUOm@cUIOvKR-XP z^LAw9%=6P+Ixiw)|5zp_Cg@va$~D)~(V0_?@w5A?P$=a7_blbyOKdTp-?wkyocwIe z?7ownoXpj;yTwu@b|3HU?L|~n6goOO;P3B0ui3)FLMSRKE~(#1#y<w*yqc{ s^>KG4_D_ucmskwgo_hN9DLgzp7NV8bb#`|C&&Dq$nO2~A`M;+B0*kgiO8@`> diff --git a/skin/netError.css b/skin/netError.css deleted file mode 100644 index 62efe44..0000000 --- a/skin/netError.css +++ /dev/null @@ -1,46 +0,0 @@ -body.resurrect div#errorPageContainer { - padding-right: 22em; - max-width: 41em; - min-height: 20em; -} - -fieldset#resurrect { - display: none; -} -body.resurrect fieldset#resurrect { - display: block; - - position: absolute; - top: 0; - right: 0; - - background-color: white; - - width: 14em; - padding: 1em; - margin: 1em; - margin-right: 1.5em; - - -moz-border-radius: 10px; -} - -body.resurrect fieldset#resurrect legend img { - vertical-align: middle; - padding-right: 0.25em; -} - -body.resurrect fieldset#resurrect button { - width: 14em; -} -body.resurrect fieldset#resurrect button img { - vertical-align: middle; - margin-top: -6px; -} - -/* Issue #6: Display below this popup. */ -body.resurrect fieldset#resurrect { - z-index: 1; -} -body.resurrect #certificateErrorReportingPanel { - z-index: 2; -} diff --git a/skin/resurrect-overlay.css b/skin/resurrect-overlay.css deleted file mode 100644 index bad4b73..0000000 --- a/skin/resurrect-overlay.css +++ /dev/null @@ -1,6 +0,0 @@ -#resurrect-page-tb { - list-style-image: url("chrome://resurrect/skin/tb-icon-large.png"); -} -toolbar[iconsize="small"] #resurrect-page-tb { - list-style-image: url("chrome://resurrect/skin/tb-icon-small.png"); -} diff --git a/skin/select-mirror.css b/skin/select-mirror.css deleted file mode 100755 index 57c4409..0000000 --- a/skin/select-mirror.css +++ /dev/null @@ -1,3 +0,0 @@ -#resurrect button { - width: 14em; -} diff --git a/skin/tb-icon-small.png b/skin/tb-icon-small.png deleted file mode 100644 index fe20ef32c2ceb268144e35bbe80db131d6b6229f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 719 zcmV;=0x9p-XEEt+s3bAWf72OUj8{E* z@+hfP5|p%9niQcx1C+Mgc9#;{m3Ft=)?I>r$sFc=zsbzJ_lQEF1jm^yxZJMMT>kj+ z%Gb!{YPGTw3O!q-X}SRyA~@~@!r{$@ZW_w(Jqfsfb#mpm767CQChHEaDXG#zRve|5c3L^rf5sMka?%uDZ{%idoM(>P4V)KBv zI~>+-V;5=cHcBK(0;<*6Z=%?m-PzfDno4bdF`1mze4b-07COl=j9@lffMFa!Y;7fB zc{#kO)sR6+5@m!9zZr+keAU_e)0B ziIx(A&1M6vY^xJ$ZofT zMg`QHSK0!``21ZlMjIrFz+&kEm(%k+pU>SUj*gBlObq{j3PF&EhsW7eYQKl)3WC(A z2NBQn=cd~7pOhjg5(&TNxKi2U@qD^D7&!eazyN4m8U^r>V