Remove all i18n.
It's janky and I'm never going to support other languages anyway.
Cette révision appartient à :
Parent
e59d1891a0
révision
9b56884f53
5 fichiers modifiés avec 74 ajouts et 138 suppressions
|
@ -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"
|
||||
}
|
||||
}
|
|
@ -3,41 +3,36 @@ chrome.storage.local.get('openIn', item => {
|
|||
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 => {
|
||||
chrome.contextMenus.create({
|
||||
contexts: [context],
|
||||
id: 'resurrect-' + context,
|
||||
title: chrome.i18n.getMessage('resurrect_' + context),
|
||||
contexts: [context]
|
||||
title: 'Resurrect this ' + context,
|
||||
}, logLastError);
|
||||
|
||||
addResurrectItem(context, 'Google', 'google', 'google');
|
||||
addResurrectItem(context, 'GoogleText', 'googletext', 'google');
|
||||
addResurrectItem(context, 'Archive', 'archive', 'waybackmachine');
|
||||
addResurrectItem(context, 'ArchiveList', 'archivelist', 'waybackmachine');
|
||||
addResurrectItem(context, 'ArchiveIs', 'archiveis', 'archiveis');
|
||||
addResurrectItem(context, 'Webcitation', 'webcitation', 'webcitation');
|
||||
addResurrectItem(context, 'MementoWeb', 'mementoweb', 'mementoweb');
|
||||
chrome.contextMenus.create({
|
||||
enabled: false,
|
||||
id: 'resurrect-with-' + context,
|
||||
parentId: 'resurrect-' + context,
|
||||
title: 'With:',
|
||||
});
|
||||
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({
|
||||
id: 'resurrect-separator-config-' + context,
|
||||
|
@ -46,14 +41,27 @@ chrome.storage.local.get('openIn', item => {
|
|||
parentId: 'resurrect-' + context
|
||||
}, logLastError);
|
||||
|
||||
addConfigItem(
|
||||
context, 'CurrentTab', 'current-tab', openIn == openInEnum.CURRENT_TAB);
|
||||
addConfigItem(
|
||||
context, 'NewTab', 'new-tab', openIn == openInEnum.NEW_TAB);
|
||||
addConfigItem(
|
||||
context, 'BgTab', 'bg-tab', openIn == openInEnum.NEW_BGTAB);
|
||||
addConfigItem(
|
||||
context, 'NewWindow', 'new-window', openIn == openInEnum.NEW_WINDOW);
|
||||
chrome.contextMenus.create({
|
||||
enabled: false,
|
||||
id: 'resurrect-in-' + context,
|
||||
parentId: 'resurrect-' + context,
|
||||
title: 'In:',
|
||||
});
|
||||
for (let [name, where, checked] of [
|
||||
['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
8
manifest.json
Fichier normal → Fichier exécutable
|
@ -1,10 +1,8 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "__MSG_extensionName__",
|
||||
"short_name": "__MSG_extensionName__",
|
||||
"description": "__MSG_extensionDescription__",
|
||||
"name": "Resurrect Pages",
|
||||
"description": "Resurrect dead pages, by finding their ghosts.",
|
||||
"version": "5",
|
||||
"default_locale": "en",
|
||||
"homepage_url": "https://github.com/arantius/resurrect-pages",
|
||||
|
||||
"applications": {
|
||||
|
@ -23,7 +21,7 @@
|
|||
|
||||
"browser_action": {
|
||||
"default_icon": "icons/page-32.png",
|
||||
"default_title": "__MSG_extensionName__",
|
||||
"default_title": "Resurrect Pages",
|
||||
"default_popup": "popup.htm"
|
||||
},
|
||||
|
||||
|
|
37
popup.htm
37
popup.htm
|
@ -22,41 +22,54 @@ img {
|
|||
}
|
||||
</style>
|
||||
<form>
|
||||
<button data-locale="resurrectGoogle" data-gen="genGoogleUrl">
|
||||
<em>With:</em>
|
||||
<button data-gen="genGoogleUrl">
|
||||
<img src="icons/cacheicons/google.png">
|
||||
Google
|
||||
</button>
|
||||
<button data-locale="resurrectGoogleText" data-gen="genGoogleTextUrl">
|
||||
<button data-gen="genGoogleTextUrl">
|
||||
<img src="icons/cacheicons/google.png">
|
||||
Google (text only)
|
||||
</button>
|
||||
<button data-locale="resurrectArchive" data-gen="genIaUrl">
|
||||
<button data-gen="genIaUrl">
|
||||
<img src="icons/cacheicons/waybackmachine.png">
|
||||
The Internet Archive
|
||||
</button>
|
||||
<button data-locale="resurrectArchiveList" data-gen="genIaListUrl">
|
||||
<button data-gen="genIaListUrl">
|
||||
<img src="icons/cacheicons/waybackmachine.png">
|
||||
The Internet Archive (list all)
|
||||
</button>
|
||||
<button data-locale="resurrectArchiveIs" data-gen="genArchiveIsUrl">
|
||||
<button data-gen="genArchiveIsUrl">
|
||||
<img src="icons/cacheicons/archiveis.png">
|
||||
archive.is
|
||||
</button>
|
||||
<button data-locale="resurrectWebcitation" data-gen="genWebCiteUrl">
|
||||
<button data-gen="genWebCiteUrl">
|
||||
<img src="icons/cacheicons/webcitation.png">
|
||||
WebCite
|
||||
</button>
|
||||
<button data-locale="resurrectMementoWeb" data-gen="genMementoUrl">
|
||||
<button data-gen="genMementoUrl">
|
||||
<img src="icons/cacheicons/mementoweb.png">
|
||||
Memento Timetravel
|
||||
</button>
|
||||
|
||||
<br>
|
||||
<div style='line-height: 8px;'> </div>
|
||||
|
||||
<label data-locale="resurrectConfigCurrentTab">
|
||||
<em>In:</em>
|
||||
<label>
|
||||
<input type="radio" name="openIn" value="0">
|
||||
the current tab
|
||||
</label>
|
||||
<label data-locale="resurrectConfigNewTab">
|
||||
<label>
|
||||
<input type="radio" name="openIn" value="1">
|
||||
a new tab (foreground)
|
||||
</label>
|
||||
<label data-locale="resurrectConfigBgTab">
|
||||
<label>
|
||||
<input type="radio" name="openIn" value="2">
|
||||
a new tab (background)
|
||||
</label>
|
||||
<label data-locale="resurrectConfigNewWindow">
|
||||
<label>
|
||||
<input type="radio" name="openIn" value="3">
|
||||
a new window
|
||||
</label>
|
||||
</form>
|
||||
|
||||
|
|
7
popup.js
7
popup.js
|
@ -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() {
|
||||
setOpenIn(document.querySelector('input[name="openIn"]:checked').value);
|
||||
};
|
||||
|
|
Chargement…
Référencer dans un nouveau ticket