From 14fedb04cfd58e6ebbd743949440947cf286aa17 Mon Sep 17 00:00:00 2001 From: mossroy Date: Sun, 4 Aug 2013 15:29:46 +0200 Subject: [PATCH] Fix behavior of search field when no archive is set. Fixes #49 --- js/app.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/app.js b/js/app.js index 186cbd0e..b7509a50 100644 --- a/js/app.js +++ b/js/app.js @@ -26,7 +26,9 @@ define(function(require) { return false; }); $('#prefix').on('keyup', function(e) { - onKeyUpPrefix(e); + if (localArchive !== null && localArchive.titleFile !== null) { + onKeyUpPrefix(e); + } }); // Bottome bar : $('#btnBack').on('click', function(e) { @@ -211,10 +213,11 @@ define(function(require) { $('#searchingForTitles').show(); $('#configuration').hide(); $('#articleContent').empty(); - if (localArchive.titleFile) { + if (localArchive !== null && localArchive.titleFile !== null) { localArchive.findTitlesWithPrefix(prefix.trim(), MAX_SEARCH_RESULT_SIZE, populateListOfTitles); } else { - alert("Title file not set"); + $('#searchingForTitles').hide(); + alert("Archive not set : please select an archive in the 'Configure' section"); } }