PageSourceSearch

https://edecampusvirtual.com/wp-content/plugins/sfwd-lms/themes/ld30/assets/js/learndash_ver-3.6.0.3.js

js edecampusvirtual.com collected 2026-09-30 17:52:33 UTC 32,067 bytes, 930 lines download raw bytes

1var _____WB$wombat$assign$function_____=function(name){return (globalThis._wb_wombat && globalThis._wb_wombat.local_init && globalThis._wb_wombat.local_init(name))||globalThis[name];};if(!globalThis.__WB_pmw){globalThis.__WB_pmw=function(obj){this.__WB_source=obj;return this;}}{
2let window = _____WB$wombat$assign$function_____("window");
3let self = _____WB$wombat$assign$function_____("self");
4let document = _____WB$wombat$assign$function_____("document");
5let location = _____WB$wombat$assign$function_____("location");
6let top = _____WB$wombat$assign$function_____("top");
7let parent = _____WB$wombat$assign$function_____("parent");
8let frames = _____WB$wombat$assign$function_____("frames");
9let opener = _____WB$wombat$assign$function_____("opener");
10jQuery( function( $ ) {
11	var hash = window.location.hash;
12
13	learndashFocusModeSidebarAutoScroll();
14
15	initLoginModal();
16	if ( '#login' == hash ) {
17		openLoginModal();
18	}
19
20	if ( 'undefined' !== typeof ldGetUrlVars().login ) {
21		var loginStatus = ldGetUrlVars().login;
22
23		if ( 'failed' == loginStatus ) {
24			openLoginModal();
25		}
26	}
27
28	if ( 'undefined' !== typeof ldGetUrlVars()['ld-topic-page'] ) {
29		var topicPage = ldGetUrlVars()['ld-topic-page'];
30		var topicIds = topicPage.split( '-' );
31		var topicId = Object.values( topicIds )[0];
32
33		var lesson = $( '#ld-expand-' + topicId );
34		var button = $( lesson ).find( '.ld-expand-button' );
35
36		ld_expand_element( button );
37
38		$( 'html, body' ).animate( {
39			scrollTop: ( $( lesson ).offset().top ),
40		}, 500 );
41	}
42
43	$( 'body' ).on( 'click', 'a[href="#login"]', function( e ) {
44		e.preventDefault();
45		openLoginModal();
46	} );
47
48	$( 'body' ).on( 'click', '.ld-modal-closer', function( e ) {
49		e.preventDefault();
50		closeLoginModal();
51	} );
52
53	$( 'body' ).on( 'click', '#ld-comments-post-button', function( e ) {
54		$( this ).addClass( 'ld-open' );
55		$( '#ld-comments-form' ).removeClass( 'ld-collapsed' );
56		$( 'textarea#comment' ).focus();
57	} );
58
59	// Close modal if clicking away
60	/*
61	$('body').on('click', function(e) {
62		if ($('.learndash-wrapper').hasClass('ld-modal-open')) {
63			if ( ! $(e.target).parents('.ld-modal').length && (! $(e.target).is('a'))) {
64				closeLoginModal();
65			}
66		}
67	});
68	*/
69
70	// Close modal on Esc key
71	$( document ).on( 'keyup', function( e ) {
72		if ( 27 === e.keyCode ) {
73			closeLoginModal();
74		}
75	} );
76
77	$( '.learndash-wrapper' ).on( 'click', 'a.user_statistic', learndash_ld30_show_user_statistic );
78
79	focusMobileCheck();
80
81	$( 'body' ).on( 'click', '.ld-focus-sidebar-trigger', function( e ) {
82		if ( $( '.ld-focus' ).hasClass( 'ld-focus-sidebar-collapsed' ) ) {
83			openFocusSidebar();
84		} else {
85			closeFocusSidebar();
86		}
87	} );
88
89	$( 'body' ).on( 'click', '.ld-mobile-nav a', function( e ) {
90		e.preventDefault();
91		if ( $( '.ld-focus' ).hasClass( 'ld-focus-sidebar-collapsed' ) ) {
92			openFocusSidebar();
93		} else {
94			closeFocusSidebar();
95		}
96	} );
97
98	$( '.ld-js-register-account' ).on( 'click', function( e ) {
99		e.preventDefault();
100
101		$( '.ld-login-modal-register .ld-modal-text' ).slideUp( 'slow' );
102		$( '.ld-login-modal-register .ld-alert' ).slideUp( 'slow' );
103		$( this ).slideUp( 'slow', function() {
104			$( '#ld-user-register' ).slideDown( 'slow' );
105		} );
106	} );
107
108	var windowWidth = $( window ).width();
109
110	$( window ).on( 'orientationchange', function() {
111		windowWidth = $( window ).width();
112	} );
113
114	$( window ).on( 'resize', function() {
115		if ( $( this ).width() !== windowWidth && 1024 >= $( this ).width() ) {
116			setTimeout( function() {
117				focusMobileResizeCheck();
118			}, 50 );
119		}
120	} );
121
122	if ( $( '.ld-course-status-content' ).length ) {
123		var tallest = 0;
124
125		$( '.ld-course-status-content' ).each( function() {
126			if ( $( this ).height() > tallest ) {
127				tallest = $( this ).height();
128			}
129		} );
130
131		$( '.ld-course-status-content' ).height( tallest );
132	}
133
134	function focusMobileCheck() {
135		if ( 1024 > $( window ).width() ) {
136			closeFocusSidebarPageLoad();
137		}
138	}
139
140	function focusMobileResizeCheck() {
141		if ( 1024 > $( window ).width() && ! $( '.ld-focus' ).hasClass( 'ld-focus-sidebar-collapsed' ) ) {
142			closeFocusSidebar();
143		} else if ( 1024 <= $( window ).width() && $( '.ld-focus' ).hasClass( 'ld-focus-sidebar-filtered' ) ) {
144			closeFocusSidebar();
145		} else if ( 1024 <= $( window ).width() &&
146			! $( '.ld-focus' ).hasClass( 'ld-focus-sidebar-filtered' ) &&
147			$( '.ld-focus' ).hasClass( 'ld-focus-sidebar-collapsed' ) ) {
148			openFocusSidebar();
149		}
150	}
151
152	function focusMobileHandleOrientationChange( e ) {
153		if ( e.matches ) {
154			if ( 1024 <= $( window ).width() &&
155			! $( '.ld-focus' ).hasClass( 'ld-focus-sidebar-filtered' ) &&
156			$( '.ld-focus' ).hasClass( 'ld-focus-sidebar-collapsed' ) ) {
157				openFocusSidebar();
158			}
159		}
160	}
161	window.matchMedia( '(orientation: landscape)' ).addListener( focusMobileHandleOrientationChange );
162
163	function closeFocusSidebarPageLoad() {
164		$( '.ld-focus' ).addClass( 'ld-focus-sidebar-collapsed' );
165		$( '.ld-mobile-nav' ).removeClass( 'expanded' );
166		positionTooltips();
167	}
168
169	function closeFocusSidebar() {
170		$( '.ld-focus' ).addClass( 'ld-focus-sidebar-collapsed' );
171		$( '.ld-mobile-nav' ).removeClass( 'expanded' );
172
173		if ( $( '.ld-focus-sidebar-trigger .ld-icon' ).hasClass( 'ld-icon-arrow-left' ) ) {
174			$( '.ld-focus-sidebar-trigger .ld-icon' ).removeClass( 'ld-icon-arrow-left' );
175			$( '.ld-focus-sidebar-trigger .ld-icon' ).addClass( 'ld-icon-arrow-right' );
176		} else if ( $( '.ld-focus-sidebar-trigger .ld-icon' ).hasClass( 'ld-icon-arrow-right' ) ) {
177			$( '.ld-focus-sidebar-trigger .ld-icon' ).removeClass( 'ld-icon-arrow-right' );
178			$( '.ld-focus-sidebar-trigger .ld-icon' ).addClass( 'ld-icon-arrow-left' );
179		}
180
181		positionTooltips();
182	}
183
184	function openFocusSidebar() {
185		$( '.ld-focus' ).removeClass( 'ld-focus-sidebar-collapsed' );
186		$( '.ld-mobile-nav' ).addClass( 'expanded' );
187
188		if ( $( '.ld-focus-sidebar-trigger .ld-icon' ).hasClass( 'ld-icon-arrow-left' ) ) {
189			$( '.ld-focus-sidebar-trigger .ld-icon' ).removeClass( 'ld-icon-arrow-left' );
190			$( '.ld-focus-sidebar-trigger .ld-icon' ).addClass( 'ld-icon-arrow-right' );
191		} else if ( $( '.ld-focus-sidebar-trigger .ld-icon' ).hasClass( 'ld-icon-arrow-right' ) ) {
192			$( '.ld-focus-sidebar-trigger .ld-icon' ).removeClass( 'ld-icon-arrow-right' );
193			$( '.ld-focus-sidebar-trigger .ld-icon' ).addClass( 'ld-icon-arrow-left' );
194		}
195
196		positionTooltips();
197	}
198
199	$( '.ld-file-input' ).each( function() {
200		var $input	 = $( this ),
201			$label	 = $input.next( 'label' ),
202			labelVal = $label.html();
203
204		$input.on( 'change', function( e ) {
205			var fileName = '';
206			if ( this.files && 1 < this.files.length ) {
207				fileName = ( this.getAttribute( 'data-multiple-caption' ) || '' ).replace( '{count}', this.files.length );
208			} else if ( e.target.value ) {
209				fileName = e.target.value.split( '\\' ).pop();
210			}
211			if ( fileName ) {
212				$label.find( 'span' ).html( fileName );
213				$label.addClass( 'ld-file-selected' );
214				$( '#uploadfile_btn' ).attr( 'disabled', false );
215			} else {
216				$label.html( labelVal );
217				$label.removeClass( 'ld-file-selected' );
218				$( '#uploadfile_btn' ).attr( 'disabled', true );
219			}
220		} );
221
222		$( '#uploadfile_form' ).on( 'submit', function() {
223			$label.removeClass( 'ld-file-selected' );
224			$( '#uploadfile_btn' ).attr( 'disabled', true );
225		} );
226
227		// Firefox bug fix
228		$input
229			.on( 'focus', function() {
230				$input.addClass( 'has-focus' );
231			} )
232			.on( 'blur', function() {
233				$input.removeClass( 'has-focus' );
234			} );
235	} );
236
237	$( 'body' ).on( 'click', '.ld-expand-button', function( e ) {
238		e.preventDefault();
239
240		ld_expand_element( $( this ) );
241
242		positionTooltips();
243	} );
244
245	$( 'body' ).on( 'click', '.ld-search-prompt', function( e ) {
246		e.preventDefault();
247
248		$( '#course_name_field' ).focus();
249
250		ld_expand_element( $( this ) );
251	} );
252
253	function ld_expand_button_state( state, elm ) {
254		var $expandText = ( $( elm )[0].hasAttribute( 'data-ld-expand-text' ) ) ? $( elm ).attr( 'data-ld-expand-text' ) : 'Expand';
255		var $collapseText = ( $( elm )[0].hasAttribute( 'data-ld-collapse-text' ) ) ? $( elm ).attr( 'data-ld-collapse-text' ) : 'Collapse';
256
257		if ( 'collapse' == state ) {
258			$( elm ).removeClass( 'ld-expanded' );
259			if ( 'false' !== $collapseText ) {
260				$( elm ).find( '.ld-text' ).text( $expandText );
261			}
262		} else {
263			$( elm ).addClass( 'ld-expanded' );
264			if ( 'false' !== $collapseText ) {
265				$( elm ).find( '.ld-text' ).text( $collapseText );
266			}
267		}
268	}
269
270	function ld_expand_element( elm, collapse ) {
271		if ( collapse === undefined ) {
272			collapse = false;
273		}
274
275		// Get the button's state
276		var $expanded = $( elm ).hasClass( 'ld-expanded' );
277
278		// Get the element to expand
279		if ( $( elm )[0] && $( elm )[0].hasAttribute( 'data-ld-expands' ) ) {
280			var $expands 		= $( elm ).attr( 'data-ld-expands' );
281			var $expandElm 		= $( '#' + $expands );
282			var $expandsChild 	= $( '#' + $expands ).find( '.ld-item-list-item-expanded' );
283
284			if ( $expandsChild.length ) {
285				$expandElm = $expandsChild;
286			}
287
288			var totalHeight = 0;
289
290			$expandElm.find( '> *' ).each( function() {
291				totalHeight += $( this ).outerHeight();
292			} );
293
294			$expandElm.attr( 'data-height', '' + ( totalHeight + 50 ) + '' );
295
296			// If the element expands a list
297
298			if ( $( '#' + $expands )[0].hasAttribute( 'data-ld-expand-list' ) ) {
299				var $container = $( '#' + $expands );
300				var innerButtons = $container.find( '.ld-expand-button' );
301				if ( $expanded ) {
302					ld_expand_button_state( 'collapse', elm );
303					innerButtons.each( function() {
304						ld_expand_element( $( this ), true );
305					} );
306				} else {
307					ld_expand_button_state( 'expand', elm );
308					innerButtons.each( function() {
309						ld_expand_element( $( this ) );
310					} );
311				}
312
313				// If the element expands an item
314			} else if ( $( '#' + $expands ).length ) {
315				if ( $expanded || true == collapse ) {
316					ld_expand_singular_item( elm, $( '#' + $expands ), $expandElm );
317				} else {
318					ld_collapse_singular_item( elm, $( '#' + $expands ), $expandElm );
319				}
320			} else {
321				console.log( 'LearnDash: No expandable content was found' );
322			}
323			positionTooltips();
324		}
325	}
326
327	function ld_expand_singular_item( elm, $containerElm, $expandElm ) {
328		$containerElm.removeClass( 'ld-expanded' );
329		ld_expand_button_state( 'collapse', elm );
330
331		$expandElm.css( {
332			'max-height': 0,
333		} );
334	}
335
336	function ld_collapse_singular_item( elm, $containerElm, $expandElm ) {
337		$containerElm.addClass( 'ld-expanded' );
338
339		ld_expand_button_state( 'expand', elm );
340
341		$expandElm.css( {
342			'max-height': $expandElm.data( 'height' ),
343		} );
344	}
345
346	$( 'body' ).on( 'click', '.ld-closer', function( e ) {
347		ld_expand_element( $( '.ld-search-prompt' ), true );
348	} );
349
350	$( 'body' ).on( 'click', '.ld-tabs-navigation .ld-tab', function() {
351		var $tab = $( '#' + $( this ).attr( 'data-ld-tab' ) );
352		if ( $tab.length ) {
353			$( '.ld-tabs-navigation .ld-tab.ld-active' ).removeClass( 'ld-active' );
354			$( this ).addClass( 'ld-active' );
355			$( '.ld-tabs-content .ld-tab-content.ld-visible' ).removeClass( 'ld-visible' );
356			$tab.addClass( 'ld-visible' );
357		}
358		positionTooltips();
359	} );
360
361	var $tooltips = $( '*[data-ld-tooltip]' );
362
363	initTooltips();
364
365	function initTooltips() {
366		// Clear out old tooltips
367
368		if ( $( '#learndash-tooltips' ).length ) {
369			$( '#learndash-tooltips' ).remove();
370			$tooltips = $( '*[data-ld-tooltip]' );
371		}
372
373		if ( $tooltips.length ) {
374			$( 'body' ).prepend( '<div id="learndash-tooltips"></div>' );
375			var $ctr = 1;
376			$tooltips.each( function() {
377				var anchor = $( this );
378				if ( anchor.hasClass( 'ld-item-list-item' ) ) {
379					anchor = anchor.find( '.ld-item-title' );
380				}
381				var elementOffsets = {
382					top: anchor.offset().top,
383					left: anchor.offset().left + ( anchor.outerWidth() / 2 ),
384				};
385				var $content = $( this ).attr( 'data-ld-tooltip' );
386				var $rel_id = Math.floor( ( Math.random() * 99999 ) );
387
388				//var $tooltip = '<span id="ld-tooltip-' + $rel_id + '" class="ld-tooltip" style="top:' + elementOffsets.top + 'px; left:' + elementOffsets.left + 'px;">' + $content + '</span>';
389				var $tooltip = '<span id="ld-tooltip-' + $rel_id + '" class="ld-tooltip">' + $content + '</span>';
390				$( this ).attr( 'data-ld-tooltip-id', $rel_id );
391				$( '#learndash-tooltips' ).append( $tooltip );
392				$ctr++;
393				var $tooltip = $( '#ld-tooltip-' + $rel_id );
394				$( this ).on( 'mouseenter', function() {
395					$tooltip.addClass( 'ld-visible' );
396				} ).on( 'mouseleave', function() {
397					$tooltip.removeClass( 'ld-visible' );
398				} );
399			} );
400
401			$( window ).on( 'resize', function() {
402				// Reposition tooltips after resizing
403				positionTooltips();
404			} );
405
406			$( window ).add( '.ld-focus-sidebar-wrapper' ).on( 'scroll', function() {
407				// Hide tooltips so they don't persist while scrolling
408				$( '.ld-visible.ld-tooltip' ).removeClass( 'ld-visible' );
409
410				// Reposition tooltips after scrolling
411				positionTooltips();
412			} );
413
414			positionTooltips();
415		}
416	}
417
418	function initLoginModal() {
419		var modal_wrapper = $( '.learndash-wrapper-login-modal' );
420		if ( ( 'undefined' !== typeof modal_wrapper ) && ( modal_wrapper.length ) ) {
421			// Move the model to be first element of the body. See LEARNDASH-3503
422			$( modal_wrapper ).prependTo( 'body' );
423		}
424	}
425
426	function openLoginModal() {
427		var modal_wrapper = $( '.learndash-wrapper-login-modal' );
428		if ( ( 'undefined' !== typeof modal_wrapper ) && ( modal_wrapper.length ) ) {
429			$( modal_wrapper ).addClass( 'ld-modal-open' );
430			$( modal_wrapper ).removeClass( 'ld-modal-closed' );
431
432			// Removed LEARNDASH-3867 #4
433			$( 'html, body' ).animate( {
434				scrollTop: $( '.ld-modal', modal_wrapper ).offset().top,
435			}, 50 );
436		}
437	}
438
439	function closeLoginModal() {
440		var modal_wrapper = $( '.learndash-wrapper-login-modal' );
441		if ( ( 'undefined' !== typeof modal_wrapper ) && ( modal_wrapper.length ) ) {
442			$( modal_wrapper ).removeClass( 'ld-modal-open' );
443			$( modal_wrapper ).addClass( 'ld-modal-closed' );
444		}
445	}
446
447	function positionTooltips() {
448		if ( 'undefined' !== typeof $tooltips ) {
449			setTimeout( function() {
450				$tooltips.each( function() {
451					var anchor = $( this );
452					var $rel_id = anchor.attr( 'data-ld-tooltip-id' );
453					$tooltip = $( '#ld-tooltip-' + $rel_id );
454
455					if ( anchor.hasClass( 'ld-item-list-item' ) ) {
456						//anchor = anchor.find('.ld-item-title');
457						anchor = anchor.find( '.ld-status-icon' );
458					}
459
460					var parent_focus = jQuery( anchor ).parents( '.ld-focus-sidebar' );
461					var left_post = anchor.offset().left + ( anchor.outerWidth() + 10 );
462					if ( parent_focus.length ) {
463						left_post = anchor.offset().left + ( anchor.outerWidth() - 18 );
464					}
465
466					// Get the main content height
467					var focusModeMainContentHeight = $( '.ld-focus-main' ).height();
468
469					// Current tooltip height
470					var focusModeCurrentTooltipHeight = anchor.offset().top + -3;
471
472					// Position tooltip depending on focus mode or not
473					if ( ! focusModeMainContentHeight ) {
474						var anchorTop = anchor.offset().top + -3;
475						var anchorLeft = anchor.offset().left;
476					} else {
477						anchorTop = focusModeCurrentTooltipHeight < focusModeMainContentHeight ? focusModeCurrentTooltipHeight : focusModeMainContentHeight;
478						anchorLeft = left_post;
479					}
480
481					$tooltip.css( {
482						top: anchorTop,
483
484						//'left' : anchor.offset().left + (anchor.outerWidth() / 2),
485						//'left': left_post, //anchor.offset().left + (anchor.outerWidth() +10),
486						left: anchorLeft, //anchor.offset().left + (anchor.outerWidth() +10),
487						'margin-left': 0,
488						'margin-right': 0,
489					} ).removeClass( 'ld-shifted-left ld-shifted-right' );
490					if ( $tooltip.offset().left <= 0 ) {
491						$tooltip.css( { 'margin-left': Math.abs( $tooltip.offset().left ) } ).addClass( 'ld-shifted-left' );
492					}
493					var $tooltipRight = $( window ).width() - ( $tooltip.offset().left + $tooltip.outerWidth() );
494					if ( 0 >= $tooltipRight ) {
495						$tooltip.css( { 'margin-right': Math.abs( $tooltipRight ) } ).addClass( 'ld-shifted-right' );
496					}
497				} );
498			}, 500 );
499		}
500	}
501
502	$( 'body' ).on( 'click', '#ld-profile .ld-reset-button', function( e ) {
503		e.preventDefault();
504
505		$( '#ld-profile #course_name_field' ).val('');
506
507		var searchVars = {
508			shortcode_instance: $( '#ld-profile' ).data( 'shortcode_instance' ),
509		};
510
511		searchVars['ld-profile-search'] = $( this ).parents( '.ld-item-search-wrapper' ).find( '#course_name_field' ).val();
512		searchVars['ld-profile-search-nonce'] = $( this ).parents( '.ld-item-search-wrapper' ).find( 'form.ld-item-search-fields' ).data( 'nonce' );
513
514		$( '#ld-profile #ld-main-course-list' ).addClass( 'ld-loading' );
515
516		$.ajax( {
517			type: 'GET',
518			url: ldVars.ajaxurl + '?action=ld30_ajax_profile_search',
519			data: searchVars,
520			success: function( response ) {
521				if ( 'undefined' !== typeof response.data.markup ) {
522					$( '#ld-profile' ).html( response.data.markup );
523					ld_expand_element( '#ld-profile .ld-search-prompt', false );
524				}
525			},
526		} );
527	} );
528
529	$( 'body' ).on( 'submit', '.ld-item-search-fields', function( e ) {
530		e.preventDefault();
531
532		var searchVars = {
533			shortcode_instance: $( '#ld-profile' ).data( 'shortcode_instance' ),
534		};
535
536		searchVars['ld-profile-search'] = $( this ).parents( '.ld-item-search-wrapper' ).find( '#course_name_field' ).val();
537		searchVars['ld-profile-search-nonce'] = $( this ).parents( '.ld-item-search-wrapper' ).find( 'form.ld-item-search-fields' ).data( 'nonce' );
538
539		$( '#ld-profile #ld-main-course-list' ).addClass( 'ld-loading' );
540
541		$.ajax( {
542			type: 'GET',
543			url: ldVars.ajaxurl + '?action=ld30_ajax_profile_search',
544			data: searchVars,
545			success: function( response ) {
546				if ( 'undefined' !== typeof response.data.markup ) {
547					$( '#ld-profile' ).html( response.data.markup );
548					ld_expand_element( '#ld-profile .ld-search-prompt', false );
549				}
550			},
551		} );
552	} );
553
554	$( 'body' ).on( 'click', '.ld-pagination a', function( e ) {
555		e.preventDefault();
556
557		var linkVars = {};
558		var parentVars = {};
559
560		$( this ).attr( 'href' ).replace( /[?&]+([^=&]+)=([^&]*)/gi, function( m, key, value ) {
561			linkVars[key] = value;
562		} );
563
564		linkVars.pager_nonce = $( this ).parents( '.ld-pagination' ).data( 'pager-nonce' );
565
566		linkVars.pager_results = $( this ).parents( '.ld-pagination' ).data( 'pager-results' );
567
568		linkVars.context = $( this ).data( 'context' );
569		console.log( 'linkVars[%o]', linkVars );
570
571		parentVars.currentTarget = e.currentTarget;
572
573		if ( 'profile' != linkVars.context ) {
574			linkVars.lesson_id = $( this ).data( 'lesson_id' );
575			linkVars.course_id = $( this ).data( 'course_id' );
576
577			if ( $( '.ld-course-nav-' + linkVars.course_id ).length ) {
578				linkVars.widget_instance = $( '.ld-course-nav-' + linkVars.course_id ).data( 'widget_instance' );
579			}
580		}
581
582		if ( 'course_topics' == linkVars.context ) {
583			$( '#ld-topic-list-' + linkVars.lesson_id ).addClass( 'ld-loading' );
584			$( '#ld-nav-content-list-' + linkVars.lesson_id ).addClass( 'ld-loading' );
585		}
586
587		if ( 'course_content_shortcode' == linkVars.context ) {
588			parentVars.parent_container = $( parentVars.currentTarget ).closest( '.ld-course-content-' + linkVars.course_id );
589			if ( ( 'undefined' !== typeof parentVars.parent_container ) && ( parentVars.parent_container.length ) ) {
590				$( parentVars.parent_container ).addClass( 'ld-loading' );
591				linkVars.shortcode_instance = $( parentVars.parent_container ).data( 'shortcode_instance' );
592			} else {
593				$( '.ld-course-content-' + linkVars.course_id ).addClass( 'ld-loading' );
594				linkVars.shortcode_instance = $( '.ld-course-content-' + linkVars.course_id ).data( 'shortcode_instance' );
595			}
596		} else if ( 'course_lessons' == linkVars.context ) {
597			var parent_container;
598
599			// Check if we are within the Course Navigation Widget.
600			if ( ( 'undefined' === typeof parentVars.parent_container ) || ( ! parentVars.parent_container.length ) ) {
601				parent_container = $( parentVars.currentTarget ).parents( '.ld-lesson-navigation' );
602				if ( ( 'undefined' !== typeof parent_container ) && ( parent_container.length ) ) {
603					parentVars.context_sub = 'course_navigation_widget';
604					parentVars.parent_container = $( parentVars.currentTarget ).parents( '#ld-lesson-list-' + linkVars.course_id );
605				}
606			}
607
608			// Check if we are within the Focus Mode Sidebar.
609			if ( ( 'undefined' === typeof parentVars.parent_container ) || ( ! parentVars.parent_container.length ) ) {
610				parent_container = $( parentVars.currentTarget ).parents( '.ld-focus-sidebar-wrapper' );
611				if ( ( 'undefined' !== typeof parent_container ) && ( parent_container.length ) ) {
612					parentVars.context_sub = 'focus_mode_sidebar';
613					parentVars.parent_container = $( parentVars.currentTarget ).parents( '#ld-lesson-list-' + linkVars.course_id );
614				}
615			}
616
617			if ( ( 'undefined' === typeof parentVars.parent_container ) || ( ! parentVars.parent_container.length ) ) {
618				parentVars.parent_container = $( parentVars.currentTarget ).closest( '#ld-item-list-' + linkVars.course_id, '#ld-lesson-list-' + linkVars.course_id );
619			}
620			if ( ( 'undefined' !== typeof parentVars.parent_container ) && ( parentVars.parent_container.length ) ) {
621				$( parentVars.parent_container ).addClass( 'ld-loading' );
622			} else {
623				// Fallback solution.
624				$( '#ld-item-list-' + linkVars.course_id ).addClass( 'ld-loading' );
625				$( '#ld-lesson-list-' + linkVars.course_id ).addClass( 'ld-loading' );
626			}
627		}
628
629		if ( 'profile' == linkVars.context ) {
630			$( '#ld-profile #ld-main-course-list' ).addClass( 'ld-loading' );
631			linkVars.shortcode_instance = $( '#ld-profile' ).data( 'shortcode_instance' );
632		}
633
634		if ( 'course_info_courses' == linkVars.context ) {
635			$( '.ld-user-status' ).addClass( 'ld-loading' );
636			linkVars.shortcode_instance = $( '.ld-user-status' ).data( 'shortcode-atts' );
637		}
638
639		if ( 'group_courses' == linkVars.context ) {
640			linkVars.group_id = $( this ).data( 'group_id' );
641			if ( 'undefined' !== typeof linkVars.group_id ) {
642				parent_container = $( parentVars.currentTarget ).parents( '.ld-group-courses-' + linkVars.group_id );
643				if ( ( 'undefined' !== typeof parent_container ) && ( parent_container.length ) ) {
644					$( parent_container ).addClass( 'ld-loading' );
645					parentVars.parent_container = parent_container;
646				}
647			}
648		}
649
650		$.ajax( {
651			type: 'GET',
652			url: ldVars.ajaxurl + '?action=ld30_ajax_pager',
653			data: linkVars,
654			success: function( response ) {
655				// If we have a course listing, update
656
657				if ( 'course_topics' == linkVars.context ) {
658					if ( $( '#ld-topic-list-' + linkVars.lesson_id ).length ) {
659						if ( 'undefined' !== typeof response.data.topics ) {
660							$( '#ld-topic-list-' + linkVars.lesson_id ).html( response.data.topics );
661						}
662
663						if ( 'undefined' !== typeof response.data.pager ) {
664							$( '#ld-expand-' + linkVars.lesson_id ).find( '.ld-table-list-footer' ).html( response.data.pager );
665						}
666
667						learndashSetMaxHeight( $( '.ld-lesson-item-' + linkVars.lesson_id ).find( '.ld-item-list-item-expanded' ) );
668
669						$( '#ld-topic-list-' + linkVars.lesson_id ).removeClass( 'ld-loading' );
670					}
671
672					if ( $( '#ld-nav-content-list-' + linkVars.lesson_id ).length ) {
673						if ( 'undefined' !== typeof response.data.nav_topics ) {
674							$( '#ld-nav-content-list-' + linkVars.lesson_id ).find( '.ld-table-list-items' ).html( response.data.topics );
675						}
676
677						if ( 'undefined' !== typeof response.data.pager ) {
678							$( '#ld-nav-content-list-' + linkVars.lesson_id ).find( '.ld-table-list-footer' ).html( response.data.pager );
679						}
680
681						$( '#ld-nav-content-list-' + linkVars.lesson_id ).removeClass( 'ld-loading' );
682					}
683				}
684
685				if ( 'course_content_shortcode' == linkVars.context ) {
686					if ( 'undefined' !== typeof response.data.markup ) {
687						if ( ( 'undefined' !== typeof parentVars.parent_container ) && ( parentVars.parent_container.length ) ) {
688							$( parentVars.parent_container ).replaceWith( response.data.markup );
689						} else {
690							$( '#learndash_post_' + linkVars.course_id ).replaceWith( response.data.markup );
691						}
692					}
693				} else if ( 'course_lessons' == linkVars.context ) {
694					if ( ( 'undefined' !== typeof parentVars.parent_container ) && ( parentVars.parent_container.length ) ) {
695						if ( 'course_navigation_widget' == parentVars.context_sub ) {
696							if ( 'undefined' !== typeof response.data.nav_lessons ) {
697								$( parentVars.parent_container ).html( response.data.nav_lessons ).removeClass( 'ld-loading' );
698							}
699						} else if ( 'focus_mode_sidebar' == parentVars.context_sub ) {
700							if ( 'undefined' !== typeof response.data.nav_lessons ) {
701								$( parentVars.parent_container ).html( response.data.nav_lessons ).removeClass( 'ld-loading' );
702							}
703						} else if ( 'undefined' !== typeof response.data.lessons ) {
704							$( parentVars.parent_container ).html( response.data.lessons ).removeClass( 'ld-loading' );
705						}
706					} else {
707						if ( $( '#ld-item-list-' + linkVars.course_id ).length ) {
708							if ( 'undefined' !== typeof response.data.lessons ) {
709								$( '#ld-item-list-' + linkVars.course_id ).html( response.data.lessons ).removeClass( 'ld-loading' );
710							}
711						}
712
713						if ( $( '#ld-lesson-list-' + linkVars.course_id ).length ) {
714							if ( 'undefined' !== typeof response.data.nav_lessons ) {
715								$( '#ld-lesson-list-' + linkVars.course_id ).html( response.data.nav_lessons ).removeClass( 'ld-loading' );
716							}
717						}
718					}
719				}
720
721				if ( 'group_courses' == linkVars.context ) {
722					if ( ( 'undefined' !== typeof parentVars.parent_container ) && ( parentVars.parent_container.length ) ) {
723						if ( 'undefined' !== typeof response.data.markup ) {
724							$( parentVars.parent_container ).html( response.data.markup ).removeClass( 'ld-loading' );
725						}
726					}
727				}
728
729				if ( 'profile' == linkVars.context ) {
730					if ( 'undefined' !== typeof response.data.markup ) {
731						$( '#ld-profile' ).html( response.data.markup );
732					}
733				}
734
735				if ( 'course_info_courses' == linkVars.context ) {
736					if ( 'undefined' !== typeof response.data.markup ) {
737						$( '.ld-user-status' ).replaceWith( response.data.markup );
738					}
739				}
740
741				$( 'body' ).trigger( 'ld_has_paginated' );
742
743				initTooltips();
744			},
745		} );
746	} );
747
748	if ( $( '#learndash_timer' ).length ) {
749		var timer_el 		= jQuery( '#learndash_timer' );
750		var timer_seconds 	= timer_el.attr( 'data-timer-seconds' );
751		var timer_button_el = jQuery( timer_el.attr( 'data-button' ) );
752
753		var cookie_key = timer_el.attr( 'data-cookie-key' );
754
755		if ( 'undefined' !== typeof cookie_key ) {
756			var cookie_name = 'learndash_timer_cookie_' + cookie_key;
757		} else {
758			var cookie_name = 'learndash_timer_cookie';
759		}
760
761		cookie_timer_seconds = jQuery.cookie( cookie_name );
762
763		if ( 'undefined' !== typeof cookie_timer_seconds ) {
764			timer_seconds = parseInt( cookie_timer_seconds );
765		}
766
767		if ( 0 == timer_seconds ) {
768			$( timer_el ).hide();
769		}
770
771		$( timer_button_el ).on( 'learndash-time-finished', function() {
772			$( timer_el ).hide();
773		} );
774	}
775
776	$( document ).on( 'learndash_video_disable_assets', function( event, status ) {
777		if ( 'undefined' === typeof learndash_video_data ) {
778			return false;
779		}
780
781		if ( 'BEFORE' == learndash_video_data.videos_shown ) {
782			if ( true == status ) {
783				$( '.ld-lesson-topic-list' ).hide();
784				$( '.ld-lesson-navigation' ).find( '#ld-nav-content-list-' + ldVars.postID ).addClass( 'user_has_no_access' );
785				$( '.ld-quiz-list' ).hide();
786			} else {
787				$( '.ld-lesson-topic-list' ).slideDown();
788				$( '.ld-quiz-list' ).slideDown();
789				$( '.ld-lesson-navigation' ).find( '#ld-nav-content-list-' + ldVars.postID ).removeClass( 'user_has_no_access' );
790			}
791		}
792	} );
793
794	$( '.learndash-wrapper' ).on( 'click', '.wpProQuiz_questionListItem input[type="radio"]', function( e ) {
795		$( this ).parents( '.wpProQuiz_questionList' ).find( 'label' ).removeClass( 'is-selected' );
796		$( this ).parents( 'label' ).addClass( 'is-selected' );
797	} );
798
799	$( '.learndash-wrapper' ).on( 'click', '.wpProQuiz_questionListItem input[type="checkbox"]', function( e ) {
800		if ( jQuery( e.currentTarget ).is( ':checked' ) ) {
801			$( this ).parents( 'label' ).addClass( 'is-selected' );
802		} else {
803			$( this ).parents( 'label' ).removeClass( 'is-selected' );
804		}
805	} );
806
807	function learndash_ld30_show_user_statistic( e ) {
808		e.preventDefault();
809
810		var refId 				= 	jQuery( this ).data( 'ref-id' );
811		var quizId 				= 	jQuery( this ).data( 'quiz-id' );
812		var userId 				= 	jQuery( this ).data( 'user-id' );
813		var statistic_nonce 	= 	jQuery( this ).data( 'statistic-nonce' );
814		var post_data = {
815			action: 'wp_pro_quiz_admin_ajax_statistic_load_user',
816			func: 'statisticLoadUser',
817			data: {
818				quizId: quizId,
819				userId: userId,
820				refId: refId,
821				statistic_nonce: statistic_nonce,
822				avg: 0,
823			},
824		};
825
826		jQuery( '#wpProQuiz_user_overlay, #wpProQuiz_loadUserData' ).show();
827		var content = jQuery( '#wpProQuiz_user_content' ).hide();
828
829		//console.log('- learndash.js');
830
831		jQuery.ajax( {
832			type: 'POST',
833			url: ldVars.ajaxurl,
834			dataType: 'json',
835			cache: false,
836			data: post_data,
837			error: function( jqXHR, textStatus, errorThrown ) {
838			},
839			success: function( reply_data ) {
840				if ( 'undefined' !== typeof reply_data.html ) {
841					content.html( reply_data.html );
842					jQuery( '#wpProQuiz_user_content' ).show();
843
844					//console.log('trigger event change - learndash.js');
845					jQuery( 'body' ).trigger( 'learndash-statistics-contentchanged' );
846
847					jQuery( '#wpProQuiz_loadUserData' ).hide();
848
849					content.find( '.statistic_data' ).on( 'click', function() {
850						jQuery( this ).parents( 'tr' ).next().toggle( 'fast' );
851
852						return false;
853					} );
854				}
855			},
856		} );
857
858		jQuery( '#wpProQuiz_overlay_close' ).on( 'click', function() {
859			jQuery( '#wpProQuiz_user_overlay' ).hide();
860		} );
861	}
862
863	function learndashSetMaxHeight( elm ) {
864		var totalHeight = 0;
865
866		elm.find( '> *' ).each( function() {
867			totalHeight += $( this ).outerHeight();
868		} );
869
870		elm.attr( 'data-height', '' + ( totalHeight + 50 ) + '' );
871
872		elm.css( {
873			'max-height': totalHeight + 50,
874		} );
875	}
876
877	/**
878	 * Will scroll the position of the Focus Mode sidebar
879	 * to the active step.
880	 */
881	function learndashFocusModeSidebarAutoScroll() {
882		if ( jQuery( '.learndash-wrapper .ld-focus' ).length ) {
883			var sidebar_wrapper = jQuery( '.learndash-wrapper .ld-focus .ld-focus-sidebar-wrapper' );
884
885			var sidebar_curent_topic = jQuery( '.learndash-wrapper .ld-focus .ld-focus-sidebar-wrapper .ld-is-current-item' );
886			if ( ( 'undefined' !== typeof sidebar_curent_topic ) && ( sidebar_curent_topic.length ) ) {
887				var sidebar_scrollTo = sidebar_curent_topic;
888			} else {
889				var sidebar_curent_lesson = jQuery( '.learndash-wrapper .ld-focus .ld-focus-sidebar-wrapper .ld-is-current-lesson' );
890				if ( ( 'undefined' !== typeof sidebar_curent_lesson ) && ( sidebar_curent_lesson.length ) ) {
891					var sidebar_scrollTo = sidebar_curent_lesson;
892				}
893			}
894
895			if ( ( 'undefined' !== typeof sidebar_scrollTo ) && ( sidebar_scrollTo.length ) ) {
896				var offset_top = 0;
897				if ( jQuery( '.learndash-wrapper .ld-focus .ld-focus-header' ).length ) {
898					var logo_height = jQuery( '.learndash-wrapper .ld-focus .ld-focus-header' ).height();
899					offset_top += logo_height;
900				}
901				if ( jQuery( '.learndash-wrapper .ld-focus .ld-focus-sidebar .ld-course-navigation-heading' ).length ) {
902					var heading_height = jQuery( '.learndash-wrapper .ld-focus .ld-focus-sidebar .ld-course-navigation-heading' ).height();
903					offset_top += heading_height;
904				}
905				if ( jQuery( '.learndash-wrapper .ld-focus .ld-focus-sidebar .ld-focus-sidebar-wrapper' ).length ) {
906					var container_height = jQuery( '.learndash-wrapper .ld-focus .ld-focus-sidebar .ld-focus-sidebar-wrapper' ).height();
907					offset_top += container_height;
908				}
909
910				var current_item_height = jQuery( sidebar_scrollTo ).height();
911				offset_top -= current_item_height;
912
913				sidebar_wrapper.animate( {
914					scrollTop: sidebar_scrollTo.offset().top - offset_top,
915				}, 1000 );
916			}
917		}
918	}
919} );
920
921function ldGetUrlVars() {
922	var vars = {};
923	var parts = window.location.href.replace( /[?&]+([^=&]+)=([^&]*)/gi, function( m, key, value ) {
924		vars[key] = value;
925	} );
926
927	return vars;
928}
929
930}

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.