1
1
Bifurcation 0

Remove all i18n.

It's janky and I'm never going to support other languages anyway.
Cette révision appartient à :
Anthony Lieuallen 2018-02-25 13:33:03 -05:00
Parent e59d1891a0
révision 9b56884f53
5 fichiers modifiés avec 74 ajouts et 138 suppressions

Voir le fichier

@ -1,76 +0,0 @@
{
"extensionName": {
"message": "Resurrect Pages",
"description": "Name of the extension."
},
"extensionDescription": {
"message": "Resurrect dead pages, by finding their ghosts.",
"description": "Description of the add-on."
},
"resurrect_page": {
"message": "Resurrect this page",
"description": "Resurrect this page"
},
"resurrect_link": {
"message": "Resurrect this link",
"description": "Resurrect this link"
},
"resurrectGoogle": {
"message": "with Google",
"description": "with Google"
},
"resurrectGoogleText": {
"message": "with Google (text only)",
"description": "with Google (text only)"
},
"resurrectArchive": {
"message": "with The Internet Archive",
"description": "with The Internet Archive"
},
"resurrectArchiveList": {
"message": "with The Internet Archive (list all)",
"description": "with The Internet Archive (list all)"
},
"resurrectArchiveIs": {
"message": "with archive.is",
"description": "with archive.is"
},
"resurrectWebcitation": {
"message": "with WebCite",
"description": "with WebCite"
},
"resurrectMementoWeb": {
"message": "with Memento Timetravel",
"description": "with Memento Timetravel"
},
"resurrectConfigCurrentTab": {
"message": "in the current tab",
"description": "in the current tab"
},
"resurrectConfigNewTab": {
"message": "in a new tab (foreground)",
"description": "in a new tab (foreground)"
},
"resurrectConfigBgTab": {
"message": "in a new tab (background)",
"description": "in a new tab (background)"
},
"resurrectConfigNewWindow": {
"message": "in a new window",
"description": "in a new window"
}
}

Voir le fichier

@ -3,41 +3,36 @@ chrome.storage.local.get('openIn', item => {
openIn = item.openIn; openIn = item.openIn;
} }
function addResurrectItem(context, i18n, id, icon) {
chrome.contextMenus.create({
id: 'resurrect-' + id + '-' + context,
title: chrome.i18n.getMessage('resurrect' + i18n),
icons: {16: 'icons/cacheicons/' + icon + '.png'},
contexts: [context],
parentId: 'resurrect-' + context
}, logLastError);
}
function addConfigItem(context, i18n, where, checked) {
chrome.contextMenus.create({
id: 'resurrect-' + where + '-' + context,
type: 'radio',
title: chrome.i18n.getMessage('resurrectConfig' + i18n),
contexts: [context],
checked: checked,
parentId: 'resurrect-' + context
}, logLastError);
}
['page', 'link'].forEach(context => { ['page', 'link'].forEach(context => {
chrome.contextMenus.create({ chrome.contextMenus.create({
contexts: [context],
id: 'resurrect-' + context, id: 'resurrect-' + context,
title: chrome.i18n.getMessage('resurrect_' + context), title: 'Resurrect this ' + context,
contexts: [context]
}, logLastError); }, logLastError);
addResurrectItem(context, 'Google', 'google', 'google'); chrome.contextMenus.create({
addResurrectItem(context, 'GoogleText', 'googletext', 'google'); enabled: false,
addResurrectItem(context, 'Archive', 'archive', 'waybackmachine'); id: 'resurrect-with-' + context,
addResurrectItem(context, 'ArchiveList', 'archivelist', 'waybackmachine'); parentId: 'resurrect-' + context,
addResurrectItem(context, 'ArchiveIs', 'archiveis', 'archiveis'); title: 'With:',
addResurrectItem(context, 'Webcitation', 'webcitation', 'webcitation'); });
addResurrectItem(context, 'MementoWeb', 'mementoweb', 'mementoweb'); for (let [name, id, icon] of [
['Google', 'google', 'google'],
['Google (text only)', 'googletext', 'google'],
['The Internet Archive', 'archive', 'waybackmachine'],
['The Internet Archive (list all)', 'archivelist', 'waybackmachine'],
['archive.is', 'archiveis', 'archiveis'],
['WebCite', 'webcitation', 'webcitation'],
['Memento Timetravel', 'mementoweb', 'mementoweb'],
]) {
chrome.contextMenus.create({
contexts: [context],
icons: {16: 'icons/cacheicons/' + icon + '.png'},
id: 'resurrect-' + id + '-' + context,
parentId: 'resurrect-' + context,
title: name,
}, logLastError);
}
chrome.contextMenus.create({ chrome.contextMenus.create({
id: 'resurrect-separator-config-' + context, id: 'resurrect-separator-config-' + context,
@ -46,14 +41,27 @@ chrome.storage.local.get('openIn', item => {
parentId: 'resurrect-' + context parentId: 'resurrect-' + context
}, logLastError); }, logLastError);
addConfigItem( chrome.contextMenus.create({
context, 'CurrentTab', 'current-tab', openIn == openInEnum.CURRENT_TAB); enabled: false,
addConfigItem( id: 'resurrect-in-' + context,
context, 'NewTab', 'new-tab', openIn == openInEnum.NEW_TAB); parentId: 'resurrect-' + context,
addConfigItem( title: 'In:',
context, 'BgTab', 'bg-tab', openIn == openInEnum.NEW_BGTAB); });
addConfigItem( for (let [name, where, checked] of [
context, 'NewWindow', 'new-window', openIn == openInEnum.NEW_WINDOW); ['the current tab', 'current-tab', openIn == openInEnum.CURRENT_TAB],
['a new tab (foreground)', 'new-tab', openIn == openInEnum.NEW_TAB],
['a new tab (background)', 'bg-tab', openIn == openInEnum.NEW_BGTAB],
['a new window', 'new-window', openIn == openInEnum.NEW_WINDOW],
]) {
chrome.contextMenus.create({
id: 'resurrect-' + where + '-' + context,
type: 'radio',
title: name,
contexts: [context],
checked: checked,
parentId: 'resurrect-' + context
}, logLastError);
}
}); });
}); });

8
manifest.json Fichier normal → Fichier exécutable
Voir le fichier

@ -1,10 +1,8 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "__MSG_extensionName__", "name": "Resurrect Pages",
"short_name": "__MSG_extensionName__", "description": "Resurrect dead pages, by finding their ghosts.",
"description": "__MSG_extensionDescription__",
"version": "5", "version": "5",
"default_locale": "en",
"homepage_url": "https://github.com/arantius/resurrect-pages", "homepage_url": "https://github.com/arantius/resurrect-pages",
"applications": { "applications": {
@ -23,7 +21,7 @@
"browser_action": { "browser_action": {
"default_icon": "icons/page-32.png", "default_icon": "icons/page-32.png",
"default_title": "__MSG_extensionName__", "default_title": "Resurrect Pages",
"default_popup": "popup.htm" "default_popup": "popup.htm"
}, },

Voir le fichier

@ -22,41 +22,54 @@ img {
} }
</style> </style>
<form> <form>
<button data-locale="resurrectGoogle" data-gen="genGoogleUrl"> <em>With:</em>
<button data-gen="genGoogleUrl">
<img src="icons/cacheicons/google.png"> <img src="icons/cacheicons/google.png">
Google
</button> </button>
<button data-locale="resurrectGoogleText" data-gen="genGoogleTextUrl"> <button data-gen="genGoogleTextUrl">
<img src="icons/cacheicons/google.png"> <img src="icons/cacheicons/google.png">
Google (text only)
</button> </button>
<button data-locale="resurrectArchive" data-gen="genIaUrl"> <button data-gen="genIaUrl">
<img src="icons/cacheicons/waybackmachine.png"> <img src="icons/cacheicons/waybackmachine.png">
The Internet Archive
</button> </button>
<button data-locale="resurrectArchiveList" data-gen="genIaListUrl"> <button data-gen="genIaListUrl">
<img src="icons/cacheicons/waybackmachine.png"> <img src="icons/cacheicons/waybackmachine.png">
The Internet Archive (list all)
</button> </button>
<button data-locale="resurrectArchiveIs" data-gen="genArchiveIsUrl"> <button data-gen="genArchiveIsUrl">
<img src="icons/cacheicons/archiveis.png"> <img src="icons/cacheicons/archiveis.png">
archive.is
</button> </button>
<button data-locale="resurrectWebcitation" data-gen="genWebCiteUrl"> <button data-gen="genWebCiteUrl">
<img src="icons/cacheicons/webcitation.png"> <img src="icons/cacheicons/webcitation.png">
WebCite
</button> </button>
<button data-locale="resurrectMementoWeb" data-gen="genMementoUrl"> <button data-gen="genMementoUrl">
<img src="icons/cacheicons/mementoweb.png"> <img src="icons/cacheicons/mementoweb.png">
Memento Timetravel
</button> </button>
<br> <div style='line-height: 8px;'>&nbsp;</div>
<label data-locale="resurrectConfigCurrentTab"> <em>In:</em>
<label>
<input type="radio" name="openIn" value="0"> <input type="radio" name="openIn" value="0">
the current tab
</label> </label>
<label data-locale="resurrectConfigNewTab"> <label>
<input type="radio" name="openIn" value="1"> <input type="radio" name="openIn" value="1">
a new tab (foreground)
</label> </label>
<label data-locale="resurrectConfigBgTab"> <label>
<input type="radio" name="openIn" value="2"> <input type="radio" name="openIn" value="2">
a new tab (background)
</label> </label>
<label data-locale="resurrectConfigNewWindow"> <label>
<input type="radio" name="openIn" value="3"> <input type="radio" name="openIn" value="3">
a new window
</label> </label>
</form> </form>

Voir le fichier

@ -5,13 +5,6 @@ chrome.storage.local.get('openIn', res => {
}); });
document.querySelectorAll('*[data-locale]').forEach(el => {
el.appendChild(document.createTextNode(
' ' + chrome.i18n.getMessage(el.getAttribute('data-locale'))
));
});
function onOpenInChange() { function onOpenInChange() {
setOpenIn(document.querySelector('input[name="openIn"]:checked').value); setOpenIn(document.querySelector('input[name="openIn"]:checked').value);
}; };