1
1
Bifurcation 0
resurrect-pages-isup-edition/popup.js
Anthony Lieuallen 9b56884f53 Remove all i18n.
It's janky and I'm never going to support other languages anyway.
2018-02-25 13:35:25 -05:00

32 lignes
832 o
JavaScript

chrome.storage.local.get('openIn', res => {
document.querySelectorAll('input[type=radio]').forEach(el => {
el.checked = el.value == res.openIn;
});
});
function onOpenInChange() {
setOpenIn(document.querySelector('input[name="openIn"]:checked').value);
};
document.querySelectorAll('input[type=radio]').forEach(el => {
el.addEventListener('click', onOpenInChange, true);
});
function resurrect(gen) {
return function() {
chrome.tabs.query({active: true, currentWindow: true}, tabObj => {
logLastError();
let url = gen(tabObj[0].url);
console.info('Resurrecting via URL', url);
goToUrl(url, openIn);
window.close();
});
}
}
document.querySelectorAll('button').forEach(el => {
el.addEventListener(
'click', resurrect(window[el.getAttribute('data-gen')]), true);
});