var tourObject = { completed_default: true, hasnewupdates: false } var tours = []; function startTour(groupName, addThisStepFirst) { var intro = introJs(); intro.setOptions({ 'overlayOpacity': '0.5', 'showStepNumbers': 'false', 'prevLabel': 'Vorige', 'nextLabel': 'Volgende', 'prevLabel': '', 'nextLabel': '', 'skipLabel': '', 'doneLabel': '' }); var stepsToUse = tours[groupName]; if (addThisStepFirst != undefined) stepsToUse.unshift(addThisStepFirst); intro.setOptions({ steps: stepsToUse}); if(groupName == "first") { intro.onbeforechange(function(nextStep) { if(intro.currentStep() == intro.totalSteps()) { $.ajax({ url: "/Public/Tour/Complete", type: 'POST', dataType: "json", contentType: "application/json; charset=UTF-8" }); } }); } intro.start(); } function showDashboardToursIfNeeded() { if (tourObject.completed_default && tourObject.hasnewupdates) { startTour("update"); } if (!tourObject.completed_default) { startTour("first"); } } $(document).ready(function() { });