From 80926c8d7ea50d71cc3a022b4505e3325c316ca2 Mon Sep 17 00:00:00 2001 From: tophf Date: Tue, 19 Dec 2017 05:29:21 +0300 Subject: [PATCH] show download errors inline --- popup/search-results.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/popup/search-results.js b/popup/search-results.js index c3234f6f..70e23c31 100755 --- a/popup/search-results.js +++ b/popup/search-results.js @@ -200,15 +200,12 @@ window.addEventListener('showStyles:done', function _() { * @param {string} message Message to display to user. */ function error(reason) { - dom.error.textContent = - reason === 404 ? - t('searchResultNoneFound') : - t('genericErrorOccurred') + '\n' + reason; + dom.error.textContent = reason === 404 ? t('searchResultNoneFound') : reason; dom.error.classList.remove('hidden'); dom.container.classList.toggle('hidden', !processedResults.length); document.body.classList.toggle('search-results-shown', processedResults.length > 0); - if (dom.error.getBoundingClientRect().bottom > window.innerHeight) { - dom.error.scrollIntoView(); + if (dom.error.getBoundingClientRect().bottom < 0) { + dom.error.scrollIntoView({behavior: 'smooth', block: 'start'}); } } @@ -573,7 +570,7 @@ window.addEventListener('showStyles:done', function _() { .catch(reason => { const usoId = result.id; console.debug('install:saveStyleSafe(usoID:', usoId, ') => [ERROR]: ', reason); - alert('Error while downloading usoID:' + usoId + '\nReason: ' + reason); + error('Error while downloading usoID:' + usoId + '\nReason: ' + reason); }) .then(() => { $.remove('.lds-spinner', entry);