runet-censorship-bypass/extensions/chromium/pac-generator-extension/pages/popup.js
2016-05-08 21:14:08 +05:00

22 lines
845 B
JavaScript
Executable File

chrome.runtime.getBackgroundPage(
background => {
var RKN = background.RKN;
var switchButton = document.querySelector('#switch-button');
var switchText = document.querySelector('#switch-button-text');
var updateButton = document.querySelector('#update-button');
var updateText = document.querySelector('#update-button-text');
var renderSwitchButton = () => switchText.innerText = RKN.ifEnabled ? 'Отключить' : 'Включить';
renderSwitchButton();
switchButton.onclick = () => {
switchText.innerText = 'Ждите...';
RKN.switch( renderSwitchButton );
};
updateButton.onclick = () => {
updateText.innerText = 'Ждите...';
RKN.checkForUpdates( () => {updateText.innerText = new Date(RKN.lastUpdate).toLocaleTimeString() } );
};
}
);