1
1
Bifurcation 0

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
Cette révision appartient à :
girst 2017-08-19 18:32:36 +02:00
Parent 0c56087320
révision 4f124ee566
24 fichiers modifiés avec 516 ajouts et 457 suppressions

Voir le fichier

@ -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.

72
_locales/en/messages.json Fichier normal
Voir le fichier

@ -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"
}
}

412
background.js Fichier normal
Voir le fichier

@ -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;
}
}
});

Voir le fichier

@ -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/

Voir le fichier

@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html SYSTEM "chrome://resurrect/locale/overlay.dtd">
<html
xmlns="http://www.w3.org/1999/xhtml"
>
<body class="resurrect">
<fieldset id='resurrect'>
<!-- fake elements so getElementById() in selectMirror() doesn't die -->
<div id='targetTab' style='display: none;'></div>
<div id='targetWin' style='display: none;'></div>
<legend>
<img src='chrome://resurrect/skin/tb-icon-small.png' />
&resurrect.thispage;
</legend>
<button value='google'>
<img src='chrome://resurrect/skin/cacheicons/google.png' />
&resurrect.google;
</button>
<button value='googletext'>
<img src='chrome://resurrect/skin/cacheicons/google.png' />
&resurrect.google;&resurrect.textonly;
</button>
<button value='archive'>
<img src='chrome://resurrect/skin/cacheicons/archive.png' />
&resurrect.archive;
</button>
<button value='archiveis'>
<img src='chrome://resurrect/skin/cacheicons/archiveis.ico' />
&resurrect.archiveis;
</button>
<button value='webcitation'>
<img src='chrome://resurrect/skin/cacheicons/webcitation.png' />
&resurrect.webcitation;
</button>
</fieldset>
</body>
</html>

Voir le fichier

@ -1,41 +0,0 @@
<?xml version='1.0'?>
<!DOCTYPE overlay SYSTEM "chrome://resurrect/locale/overlay.dtd">
<?xml-stylesheet href='chrome://resurrect/skin/resurrect-overlay.css' type='text/css'?>
<overlay id='resurrect-overlay' xmlns='http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul'>
<script type='application/x-javascript' src='chrome://resurrect/content/resurrect.js'></script>
<script type='application/x-javascript'>
window.addEventListener('load', resurrect.onLoad, false);
</script>
<toolbarpalette id='BrowserToolbarPalette'>
<toolbarbutton id='resurrect-page-tb'
type=""
class="toolbarbutton-1"
oncommand="resurrect.page();"
label='&resurrect.thispage;'
tooltiptext='&resurrect.thispage;'
>
</toolbarbutton>
</toolbarpalette>
<popup id="contentAreaContextMenu">
<menuitem id="resurrect-page-context" insertafter="context-bookmarkpage"
label="&resurrect.thispage;" accesskey="&resurrect.accesskey;"
oncommand="resurrect.page(event);"
/>
<menuitem id="resurrect-link-context" insertafter="context-bookmarklink"
label="&resurrect.thislink;" accesskey="&resurrect.accesskey;"
oncommand="resurrect.link(event);"
/>
</popup>
<keyset id="mainKeyset">
<key id='resurrect-key-shortcut'
modifiers='control shift'
key='&resurrect.accesskey;'
oncommand='resurrect.page();'
/>
</keyset>
</overlay>

Voir le fichier

@ -1,59 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay SYSTEM "chrome://resurrect/locale/overlay.dtd">
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://resurrect/skin/select-mirror.css" type="text/css"?>
<!-- "B" in the ID is to lose the (wrong) persisted height from old versions -->
<dialog id="resurrect-select-mirrorB"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&resurrect.title;"
buttons="cancel"
persist="screenX screenY"
>
<script type='application/x-javascript' src='chrome://resurrect/content/resurrect.js'></script>
<script type='application/x-javascript'>
window.addEventListener('load', resurrect.loadTarget, false);
</script>
<vbox>
<groupbox>
<caption label='&resurrect.this;' />
<radiogroup id='targetGroup'>
<radio id='targetCurr' label='&resurrect.inCurrTab;' />
<radio id='targetTab' label='&resurrect.inNewTab;' />
<radio id='targetWin' label='&resurrect.inNewWin;' />
</radiogroup>
</groupbox>
<groupbox id='resurrect' oncommand='resurrect.clickedXul(event);'>
<caption label='&resurrect.fromMirror;' />
<xul:button
value='google' label=' &resurrect.google;'
image='chrome://resurrect/skin/cacheicons/google.png'
/>
<xul:button
value='googletext' label=' &resurrect.google;&resurrect.textonly;'
image='chrome://resurrect/skin/cacheicons/google.png'
/>
<xul:button
value='archive' label=' &resurrect.archive;'
image='chrome://resurrect/skin/cacheicons/archive.png'
/>
<xul:button
value='archiveis' label=' &resurrect.archiveis;'
image='chrome://resurrect/skin/cacheicons/archiveis.ico'
/>
<xul:button
value='webcitation' label=' &resurrect.webcitation;'
image='chrome://resurrect/skin/cacheicons/webcitation.png'
/>
</groupbox>
</vbox>
</dialog>

Voir le fichier

@ -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);
}
}
}
};

Voir le fichier

@ -1,3 +0,0 @@
pref("extensions.{0c8fbd76-bdeb-4c52-9b24-d587ce7b9dc3}.description", "chrome://resurrect/locale/overlay.properties");
pref("extensions.resurrect.target", "targetCurr");

BIN
icons/cacheicons/archiveis.png Fichier normal

Fichier binaire non affiché.

Après

Largeur:  |  Hauteur:  |  Taille: 709 o

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 781 o

Après

Largeur:  |  Hauteur:  |  Taille: 781 o

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 468 o

Après

Largeur:  |  Hauteur:  |  Taille: 468 o

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 537 o

Après

Largeur:  |  Hauteur:  |  Taille: 537 o

BIN
icons/page-16.png Fichier normal

Fichier binaire non affiché.

Après

Largeur:  |  Hauteur:  |  Taille: 669 o

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 1,9 Kio

Après

Largeur:  |  Hauteur:  |  Taille: 1,9 Kio

Voir le fichier

Avant

Largeur:  |  Hauteur:  |  Taille: 1 011 o

Après

Largeur:  |  Hauteur:  |  Taille: 1 011 o

Voir le fichier

@ -1,23 +0,0 @@
<?xml version="1.0"?>
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>{0c8fbd76-bdeb-4c52-9b24-d587ce7b9dc3}</em:id>
<em:name>Resurrect Pages</em:name>
<em:version>3</em:version>
<em:description>Resurrect dead pages, by finding their ghosts.</em:description>
<em:homepageURL>http://trac.arantius.com/wiki/Extensions/Resurrect</em:homepageURL>
<em:iconURL>chrome://resurrect/skin/em-icon.png</em:iconURL>
<em:creator>Anthony Lieuallen</em:creator>
<em:contributor>Translators from BabelZilla.org</em:contributor>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>43.*</em:maxVersion>
</Description>
</em:targetApplication>
</Description>
</RDF>

29
manifest.json Fichier normal
Voir le fichier

@ -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"
}
}

Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 177 o

Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 5,3 Kio

Voir le fichier

@ -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;
}

Voir le fichier

@ -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");
}

Voir le fichier

@ -1,3 +0,0 @@
#resurrect button {
width: 14em;
}

Fichier binaire non affiché.

Avant

Largeur:  |  Hauteur:  |  Taille: 719 o