diff --git a/_locales/en/messages.json b/_locales/en/messages.json index 50649128..7e4ca834 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -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", diff --git a/popup/search-results.js b/popup/search-results.js index d49cf82c..abf619cf 100755 --- a/popup/search-results.js +++ b/popup/search-results.js @@ -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); } }