Tour stops if there are no results (closes #189).
Change-Id: I2ed9cab9ac47b7494feddd167c15926bd541e5cc
diff --git a/dev/js/src/tour/tours.js b/dev/js/src/tour/tours.js
index 43ceea1..9490780 100644
--- a/dev/js/src/tour/tours.js
+++ b/dev/js/src/tour/tours.js
@@ -51,6 +51,7 @@
loc.TOUR_seargo = loc.TOUR_seargo || "Start the search by clicking the magnifying glass.";
//localization guided Tour gTshowResults
+ loc.TOUR_nokwicti = loc.TOUR_nokwicti || "The search has no results, therefore the tour ends here.";
loc.TOUR_kwicti = loc.TOUR_kwicti || "Results";
loc.TOUR_kwic = loc.TOUR_kwic || "The results of the query are displayed as KWIC (keyword in context). On the left side, you can see the according text sigle.";
loc.TOUR_snippetti = loc.TOUR_snippetti || "KWIC (2)";
@@ -406,13 +407,16 @@
tourR.setOption('scrollToElement', true);
tourR.setOption('scrollTo','tooltip');
this.testPrerequ(StepsSR, tourR);
-
- //TODO see also: introJS.totalSteps() merge requested: //github.com/usablica/intro.js/pull/268/files
+
tourR.onbeforechange(function(targetedElement){
-
- if(this._currentStep == 1){
- KorAP.session.set("tour", false);
- }
+ if(this._currentStep == 0){
+ KorAP.session.set("tour", false);
+ if(doe.querySelector("#search + p.no-results")){
+ tourR._introItems[0].intro = loc.TOUR_nokwicti;
+ tourR.goToStepNumber(10);
+ document.querySelector(".introjs-prevbutton").style.visibility = "hidden";
+ }
+ }
if(this._currentStep == 2){
doe.querySelector("#search > ol > li").click();