<commit_before>	/**
		Project: Next Step
		Filename: nextstep.js
		Description: A jQuery extension that lets a developer
		turn a lengthy form/presentation into slides.
		Author: <NAME>
		Example: http://everbranded.com/order
	*/

	$(document).ready(function() {

		// DOM is ready for manipulation
		// find out how many steps there are in this sequence
		var total_steps = 1;
		while($(".step-"+total_steps).length) total_steps++;

		// sets the progress bar level
		function set_progress(curr_step)
		{
			// calculate the progress on a 
			var progress = (100 / total_steps) * curr_step;
			$(".step-progress").val(progress);
		}



		// set step counter to 1
		var current_step = 1;
		// set progress bar to current step
		set_progress(current_step);

		// move to NEXT step
		$(".step-next").on("click",function() {


			// toggle current step
			$(".step-"+current_step).fadeOut(function() {

				// find next step and toggle
				current_step++;
				$(".step-"+current_step).show();

				// set progress forward one step
				set_progress(current_step);

				// if current step isn't first, show back button
				if(current_step > 1) { $(".step-prev").show(); }

			});



		});


		// move to PREV step
		$(".step-prev").on("click",function() {

			// toggle current step
			$(".step-"+current_step).fadeOut(function() {

				// find previous step and toggle
				current_step--;
				$(".step-"+current_step).show();

				// set progress back one step
				set_progress(current_step);

				// if current step is first, hide back button
				if(current_step == 1) { $(".step-prev").hide(); }
			});

		});


	});<commit_msg>adds optional callback before proceeding<commit_after>/**
	Project: Next Step
	Filename: nextstep.js
	Description: A jQuery extension that turns a series of 
	hidden div layers into transitionable slides.
	Author: <NAME>
	Example: http://everbranded.com/order
*/

$(document).ready(function() {

	// DOM is ready for manipulation
	// find out how many steps there are in this sequence
	var total_steps = 1;
	while($(".step-"+total_steps).length) total_steps++;


	// sets the progress bar level
	function set_progress(curr_step)
	{
		// calculate the % complete for <progress> tag.
		var progress = (100 / total_steps) * curr_step;
		$(".step-progress").val(progress);
	}


	// set step counter to 1
	var current_step = 1;
	// set progress bar to current step
	set_progress(current_step);

	// move to NEXT step
	$(".step-next").on("click",function() {

		// check if callback exists, if one does execute it.
		// the callback must return true to continue with progress.
		var proceed = true;
		var callback = $(".step-"+current_step).attr("data-callback");
		if(callback) proceed = window[callback](); 

		if(proceed)
		{
			// we can proceed with the transition.
			$(".step-"+current_step).slideUp(function() {

				// find next step and toggle
				current_step++;
				$(".step-"+current_step).slideDown();

				// set progress forward one step
				set_progress(current_step);

				// if current step isn't first, show back button
				if(current_step > 1) { $(".step-prev").show(); }

			});

		} 

	});


	// move to PREV step
	$(".step-prev").on("click",function() {

		// toggle current step
		$(".step-"+current_step).slideUp(function() {

			// find previous step and toggle
			current_step--;
			$(".step-"+current_step).slideDown();

			// set progress back one step
			set_progress(current_step);

			// if current step is first, hide back button
			if(current_step == 1) { $(".step-prev").hide(); }
		});

	});

});
{'fraction_non_alphanumeric': 0.1511398817900366, 'fraction_numerical': 0.004503236701379116, 'mean_word_length': 3.085057471264368, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '706173', 'n_tokens_mistral': 1283, 'n_tokens_neox': 1076, 'n_words': 325}