show busy indicator in menu when triggered from shortcut

This commit is contained in:
Alex Adam 2018-02-24 21:19:51 +02:00
parent 50dd1c3150
commit 39b66f2f8c
3 changed files with 19 additions and 0 deletions

View file

@ -433,5 +433,8 @@ footer, canvas {
if (request.type === 'set include style') { if (request.type === 'set include style') {
chrome.storage.local.set({'includeStyle': request.includeStyle}); chrome.storage.local.set({'includeStyle': request.includeStyle});
} }
if (request.type === 'is busy?') {
sendResponse({isBusy: isBusy})
}
return true; return true;
}); });

View file

@ -13,6 +13,14 @@ document.getElementById('selectionChapterLabel').innerHTML = chrome.i18n.getMess
document.getElementById('editChapters').innerHTML = chrome.i18n.getMessage('editChapters'); document.getElementById('editChapters').innerHTML = chrome.i18n.getMessage('editChapters');
document.getElementById('waitMessage').innerHTML = chrome.i18n.getMessage('waitMessage'); document.getElementById('waitMessage').innerHTML = chrome.i18n.getMessage('waitMessage');
checkIfBusy((result) => {
if (result.isBusy) {
document.getElementById('busy').style.display = 'block';
} else {
document.getElementById('busy').style.display = 'none';
}
})
getStyles(createStyleList); getStyles(createStyleList);
function createStyleList(styles) { function createStyleList(styles) {

View file

@ -83,6 +83,14 @@ function removeEbook() {
}, function(response) {}); }, function(response) {});
} }
function checkIfBusy(callback) {
chrome.runtime.sendMessage({
type: "is busy?"
}, function(response) {
callback(response);
});
}
///// /////
function getCurrentUrl() { function getCurrentUrl() {
var url = window.location.href; var url = window.location.href;