typos and code cosmetics

This commit is contained in:
tophf 2017-12-11 23:45:21 +03:00
parent 50b489478c
commit c3d9e8030b
2 changed files with 8 additions and 10 deletions

View File

@ -202,9 +202,9 @@
"message": "Cannot function properly because of a known bug in this version of Firefox: chrome.extension.getBackgroundPage() doesn't return a valid result",
"description": "Displayed in style manager when unable to connect to the background page"
},
"genericErrorOccurred": {
"message": "An error occured:",
"description": "Used in various places to indicate some error occured. The error message is shown on the next line."
"genericError": {
"message": "Error",
"description": "Used in various places to indicate some error occurred."
},
"genericDisabledLabel": {
"message": "Disabled",

View File

@ -238,18 +238,16 @@ window.addEventListener('showStyles:done', function _() {
}
function loadMoreIfNeeded(event) {
let prefetchPages = 0;
let pageToPrefetch = displayedPage;
if (event instanceof Event) {
const scroller = document.scrollingElement;
if (scroller.scrollTop > scroller.scrollHeight / 2 &&
(loadMoreIfNeeded.prefetchedPage || 0) <= displayedPage) {
prefetchPages = 1;
loadMoreIfNeeded.prefetchedPage = displayedPage + 1;
if ((loadMoreIfNeeded.prefetchedPage || 0) <= pageToPrefetch &&
document.scrollingElement.scrollTop > document.scrollingElement.scrollHeight / 2) {
loadMoreIfNeeded.prefetchedPage = ++pageToPrefetch;
} else {
return;
}
}
if (processedResults.length < (displayedPage + prefetchPages) * DISPLAY_PER_PAGE) {
if (processedResults.length < pageToPrefetch * DISPLAY_PER_PAGE) {
setTimeout(load, DELAY_BEFORE_SEARCHING_STYLES);
}
}