<commit_before>var sakaiTutorialSkin = 'sakaiTutorial';
var sakaiTutorialStartUrl = "/direct/tutorial/introToSakai_p1.json";
var sakaiTutorialLocationUrl = '/direct/tutorial/introToSakai_pTutorialLocation.json';
var optsCache;
var maxWidth = 500;
var previousClicked = false;
var dialogPosition = {
		my: 'center',
		at: 'center',
		target: $(window), // Position it via the document body...
		viewport: $(window)
};


function startTutorial(opts){
	showTutorialPage(sakaiTutorialStartUrl, opts);
	if (!$PBJQ(".Mrphs-userNav__subnav").hasClass("is-hidden")) {
		// Hide the user dropdown menu so it doesn't obstruct the tutorial
		$('.Mrphs-userNav__submenuitem--username').trigger('click');
	}
}

function showTutorialPage(url, opts){
	//store options in cache so we can use the same options from start to end of the tutorial:
	if(opts != null)
		optsCache = opts;
	else if(optsCache != null)
		opts = optsCache;
	else{
		opts = {};
		optsCache = opts;
	}
	
	$.getJSON(url, 
			function(response){
				//Current fix for Sakai 10
				try{
				if(response.data.dialog == 'true'){
					response.data.selection = 'div#tutorial';
				}
				if(!$(response.data.selection).length 
						&& ((!previousClicked && response.data.nextUrl) 
								|| (previousClicked && response.data.previousUrl))){
					//this item doesn't exist, go to the next page if it exists
					if(previousClicked){
						showTutorialPage(response.data.previousUrl);
					}else{
						showTutorialPage(response.data.nextUrl);
					}
				}else{
					previousClicked = false;
					var mxWidth = maxWidth;
					var totalWidth = $(document).width();
					var totalHeight = $(document).height();
					if(totalWidth < mxWidth){
						mxWidth = totalWidth;
					}

					$(response.data.selection).qtip(
							{ 
								content: {
									title: response.data.title,<commit_msg>SAK-30900 Tutorial stops after Step 2<commit_after>var sakaiTutorialSkin = 'sakaiTutorial';
var sakaiTutorialStartUrl = "/direct/tutorial/introToSakai_p1.json";
var sakaiTutorialLocationUrl = '/direct/tutorial/introToSakai_pTutorialLocation.json';
var optsCache;
var maxWidth = 500;
var previousClicked = false;
var dialogPosition = {
		my: 'center',
		at: 'center',
		target: $(window), // Position it via the document body...
		viewport: $(window)
};


function startTutorial(opts){
	showTutorialPage(sakaiTutorialStartUrl, opts);
	if (!$PBJQ(".Mrphs-userNav__subnav").hasClass("is-hidden")) {
		// Hide the user dropdown menu so it doesn't obstruct the tutorial
		$('.Mrphs-userNav__submenuitem--username').trigger('click');
	}
}

function showTutorialPage(url, opts){
	//store options in cache so we can use the same options from start to end of the tutorial:
	if(opts != null)
		optsCache = opts;
	else if(optsCache != null)
		opts = optsCache;
	else{
		opts = {};
		optsCache = opts;
	}
	
	$.getJSON(url, 
			function(response){
				//Current fix for Sakai 10
				try{
				if(response.data.dialog == 'true'){
					response.data.selection = 'div#tutorial';
				}
				if( (!$(response.data.selection).length || $(response.data.selection).offset().left < 0 || $(response.data.selection).offset().top < 0)
						&& ((!previousClicked && response.data.nextUrl) 
								|| (previousClicked && response.data.previousUrl))){
					//This item doesn't exist or it´s outside the viewport, go to the next page if it exists
					if(previousClicked){
						showTutorialPage(response.data.previousUrl);
					}else{
						showTutorialPage(response.data.nextUrl);
					}
				}else{
					previousClicked = false;
					var mxWidth = maxWidth;
					var totalWidth = $(document).width();
					var totalHeight = $(document).height();
					if(totalWidth < mxWidth){
						mxWidth = totalWidth;
					}

					$(response.data.selection).qtip(
							{ 
								content: {
									title: response.data.title,
{'fraction_non_alphanumeric': 0.13479623824451412, 'fraction_numerical': 0.00522466039707419, 'mean_word_length': 3.515330188679245, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4260525', 'n_tokens_mistral': 1534, 'n_tokens_neox': 1223, 'n_words': 290}