PageSourceSearch

https://goalsforyourlife.com/wp-content/plugins/DAP-WP-LiveLinks/includes/js/dap_lesson_complete.js?ver=24.3.1

js goalsforyourlife.com collected 2026-09-24 20:27:45 UTC 7,583 bytes, 210 lines download raw bytes

1var user_active_progress = 0;
2var checkajax_is_run = 1;
3jQuery(document).ready(function(){
4
5	var startDateTime = jQuery('#start_date_hidden').val();
6	//check_user_are_in_screen();
7	var lesson_id_hidden = jQuery('#lesson_id_hidden').val();
8	var course_id_hidden = jQuery('#course_id_hidden').val();
9	random_id = 'mycoursepage_'+course_id_hidden+'_'+lesson_id_hidden;
10	TimeMe.initialize({
11		currentPageName: random_id
12	});
13	TimeMe.callWhenUserLeaves(function(){
14		//console.log("The user is not currently viewing the page!");
15		TimeMe.stopTimer(random_id);
16		DAPcountStopTimer(random_id);
17		update_dap_lession_time();
18	});
19
20	// Executes every time a user returns
21	TimeMe.callWhenUserReturns(function(){
22		TimeMe.startTimer(random_id);
23		//console.log("The user has come back!");
24		if (jQuery.isFunction(window.DAPcountStartTimer)) {
25			DAPcountStartTimer(random_id);
26		}
27	});
28
29	setInterval((function() {
30		update_dap_lession_time(1);
31	}), 60000);
32
33	jQuery(".markas_completed_btn").click(function(event) {  
34		update_dap_lession_time();
35	});
36
37
38	 	jQuery(document).on('click', ".dap-xp-sticky-opener", function(){
39	    jQuery('.dap-xp-sticky-opener').parents('.dap-xp-sticky').toggleClass('dap-xp-sticky-active');	    
40		});
41
42		jQuery(document).on('click', ".cancel-animation-popup", function(){
43	    jQuery(".animation_container").hide();
44	    jQuery(".dap_lesson_player_audio").remove();
45	    jQuery("html").removeClass("dap-celebration-animation-on");    
46		});
47
48		/*setTimeout(function() { 
49       jQuery('.dap-xp-sticky-opener').parents('.dap-xp-sticky').removeClass('dap-xp-sticky-active');
50    }, 5000);*/
51
52    jQuery(".dap-btn-mark-as-complate").on("click", function(){
53		jQuery(".markas_completed_btn_outer .markas_completed_btn, .dap-next-or-mark-btn-wrapper .markas_completed_btn").click();
54	});
55
56	jQuery(".dap-btn-mark-as-complate-next").on("click", function(e){
57		e.preventDefault();
58		var next_btn_lesson = jQuery(".next_btn_cont").css('display');
59		if (next_btn_lesson != 'none' && (typeof next_btn_lesson !== 'undefined')) {
60			jQuery(".next_btn_cont").click();
61			
62		}
63	});
64
65		var prev_url_lesson = jQuery("#prev_url_lesson").val();
66		if (prev_url_lesson != '') {
67			jQuery('#dap_header_back_brn').show();
68			jQuery('#dap_header_back_brn').attr('href', prev_url_lesson);
69		}
70
71
72
73		/*var next_btn_lesson = jQuery(".next_btn_cont").css('display');
74		var markas_completed_btn = jQuery(".markas_completed_btn").css('display');
75		if (next_btn_lesson != 'none' && (typeof next_btn_lesson !== 'undefined')) {
76			var next_btn_lesson_link = jQuery(".next_btn_cont").attr('href');
77			var next_btn_lesson_text = jQuery(".next_btn_cont").text();
78
79			next_btn_lesson_text = next_btn_lesson_text.replace('»', '');
80
81			jQuery('#dap_header_lesson_complete_button_next').attr('href', next_btn_lesson_link);
82			jQuery('#dap_header_lesson_complete_button_next .dap-course-header-navigation-btn-text').text(next_btn_lesson_text);
83			jQuery('#dap_header_lesson_complete_button_next').show();
84		}else if (markas_completed_btn != 'none' && (typeof markas_completed_btn !== 'undefined')) {
85			jQuery('#dap_header_lesson_complete_button').show();
86		}*/
87
88});
89
90jQuery(window).on("load", function () {
91    var next_btn_lesson = jQuery(".next_btn_cont").css('display');
92	var markas_completed_btn = jQuery(".markas_completed_btn").css('display');
93	if (next_btn_lesson != 'none' && (typeof next_btn_lesson !== 'undefined')) {
94		var next_btn_lesson_link = jQuery(".next_btn_cont").attr('href');
95		var next_btn_lesson_text = jQuery(".next_btn_cont").text();
96
97		next_btn_lesson_text = next_btn_lesson_text.replace('»', '');
98
99		jQuery('#dap_header_lesson_complete_button_next').attr('href', next_btn_lesson_link);
100		jQuery('#dap_header_lesson_complete_button_next .dap-course-header-navigation-btn-text').text(next_btn_lesson_text);
101		jQuery('#dap_header_lesson_complete_button_next').show();
102	}else if (markas_completed_btn != 'none' && (typeof markas_completed_btn !== 'undefined')) {
103	    
104	    if(jQuery('.dap-next-or-mark-btn-msg-wrapper .lesson_container').is(':visible')){
105            //jQuery('.dap-course-header-navigation-btn.dap-btn-mark-as-complate').hide();
106        }else{
107		    jQuery('#dap_header_lesson_complete_button').show();
108        }
109	}
110});
111//TimeMe.getTimeOnCurrentPageInSeconds();
112
113
114function update_dap_lession_time(checkrunforcefully = 0){
115	
116	if (jQuery('.dap-timer-wrapper').hasClass('dap-timer-wrapper')) {
117		if(checkrunforcefully == 1){
118			checkajax_is_run = 1;
119		}
120		var ajaxurl = dap_course.ajaxurl;
121		var course_id = jQuery('#course_id_hidden').val();
122		var module_id = jQuery('#module_id_hidden').val();
123		var lesson_id = jQuery('#lesson_id_hidden').val();
124		var user_id = jQuery('#user_id_hidden').val();
125		var start_date = jQuery('#start_date_hidden').val();
126		if(user_id != ''){
127			var total_in_second = TimeMe.getTimeOnCurrentPageInSeconds().toFixed(0);
128			if(checkajax_is_run == 1){
129				checkajax_is_run = 0;
130				jQuery.post(ajaxurl, {
131						action: "dap_lesson_time_spent_update",
132						course_id: course_id,
133						module_id: module_id,
134						lesson_id: lesson_id,
135						user_id: user_id,			
136						start_date: start_date,
137						total_second: total_in_second,
138						pre_sec: user_active_progress
139					}, function(response) {	
140						//jQuery('#start_date_hidden').val(response)
141						user_active_progress = response;
142						checkajax_is_run = 1;
143				}).fail(function(jqXHR, textStatus, error){
144				   checkajax_is_run = 1;
145				});;
146			}
147		}
148	}
149}
150
151function makeid(length) {
152    var result           = '';
153    var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
154    var charactersLength = characters.length;
155    for ( var i = 0; i < length; i++ ) {
156      result += characters.charAt(Math.floor(Math.random() * 
157 charactersLength));
158   }
159   return result;
160}
161
162function dap_confetti_animation(){
163	for(i=0; i<100; i++) {
164		// Random rotation
165		var randomRotation = Math.floor(Math.random() * 360);
166		  // Random Scale
167		var randomScale = Math.random() * 1;
168		// Random width & height between 0 and viewport
169		var randomWidth = Math.floor(Math.random() * Math.max(document.documentElement.clientWidth, window.innerWidth || 0));
170		var randomHeight =  Math.floor(Math.random() * Math.max(document.documentElement.clientHeight, window.innerHeight || 500));
171
172		// Random animation-delay
173		var randomAnimationDelay = Math.floor(Math.random() * 15);
174		console.log(randomAnimationDelay);
175
176		// Random colors
177		var colors = ['#0CD977', '#FF1C1C', '#FF93DE', '#5767ED', '#FFC61C', '#8497B0']
178		var randomColor = colors[Math.floor(Math.random() * colors.length)];
179
180		// Create confetti piece
181		var confetti = document.createElement('div');
182		confetti.className = 'dap-modal-animation-confetti';
183		confetti.style.top=randomHeight + 'px';
184		confetti.style.right=randomWidth + 'px';
185		confetti.style.backgroundColor=randomColor;
186		// confetti.style.transform='scale(' + randomScale + ')';
187		confetti.style.obacity=randomScale;
188		confetti.style.transform='skew(15deg) rotate(' + randomRotation + 'deg)';
189		confetti.style.animationDelay=randomAnimationDelay + 's';
190
191		var confettiWrapper = document.getElementById("dap-modal-animation-confetti-wrapper");
192		if(confettiWrapper){
193			confettiWrapper.appendChild(confetti);
194		}
195	}
196}
197
198window.onload = function() {
199
200jQuery.fn.DAPScrollTo = function(elem, speed) { 
201	if (jQuery(this).length && jQuery(elem).length) {
202		 jQuery(this).animate({
203	        scrollTop:  jQuery(this).scrollTop() - jQuery(this).offset().top + jQuery(elem).offset().top 
204	    }, speed == undefined ? 1000 : speed); 
205	    return this; 
206	}
207   
208};
209
210}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.