PageSourceSearch

https://thebluewhale.ai/wp-content/themes/edu-press/assets/js/thim-custom.js?ver=1.0.4

js thebluewhale.ai collected 2026-10-05 12:47:18 UTC 6,947 bytes, 258 lines download raw bytes

1/**
2 * Script custom for theme
3 *
4 * TABLE OF CONTENT
5 *
6 * Header: main menu
7 * Header: main menu mobile
8 * Sidebar: sticky sidebar
9 * Feature: Preloading
10 * Feature: Back to top
11 * Custom select.
12 */
13
14(function ($) {
15	"use strict";
16
17	$(document).ready(function () {
18		Edu_Press.ready();
19	});
20
21	$(window).load(function () {
22		Edu_Press.load();
23	});
24
25	var Edu_Press = {
26
27		/**
28		 * Call functions when document ready
29		 */
30		ready: function () {
31			this.header_menu();
32			this.back_to_top();
33			this.feature_preloading();
34			this.sticky_sidebar();
35			this.thim_social_share();
36			this.header_menu_mobile();
37			this.close_top_bar();
38		},
39
40		/**
41		 * Call functions when window load.
42		 */
43		load: function () {
44			// this.header_menu_mobile();
45			this.thim_post_gallery();
46		},
47
48		thim_social_share: function () {
49			$(document).on('click', '.social-share-single', function (e) {
50				e.stopPropagation();
51				$('.social-share-single').addClass('open');
52			})
53
54			$(document).on('click', '#main-content, .social-share-single.open', function (e) {
55				e.stopPropagation();
56				$('.social-share-single').removeClass('open');
57			})
58
59		},
60
61		// CUSTOM FUNCTION IN BELOW
62		thim_post_gallery: function () {
63 			if (jQuery().flexslider) {
64				$('.flexslider').flexslider({
65					slideshow     : true,
66					animation     : 'fade',
67					pauseOnHover  : true,
68					animationSpeed: 400,
69					smoothHeight  : true,
70					directionNav  : true,
71					controlNav    : false
72				});
73			}
74 		},
75
76 		/**
77		 * Mobile menu
78		 */
79
80		 header_menu_mobile: function () {
81			$(document).on('click', '.menu-mobile-effect', function (e) {
82				e.stopPropagation();
83				$('body').toggleClass('mobile-menu-open')
84			})
85
86			$(document).on('click', '#main-content, .main-navigation .thim-ekits-menu__mobile__close, .elementor', function (e) {
87				e.stopPropagation();
88				$('body').removeClass('mobile-menu-open')
89			})
90
91			$('.navbar-main-menu li.menu-item-has-children > a, .main-navigation .menu li.menu-item-has-children > a').after('<span class="icon-toggle"><i class="tk tk-angle-right"></i></span>');
92			$("span").remove(".thim-ekits-menu__icon");
93			$('.navbar-main-menu > li.menu-item-has-children .icon-toggle, .main-navigation .menu > li.menu-item-has-children .icon-toggle').on('click', function () {
94				if ($(this).next('ul.sub-menu').is(':hidden')) {
95					$(this).next('ul.sub-menu').slideDown(200, 'linear');
96				}
97			});
98
99			// $('.main-navigation > .inner-navigation').after('<li class="thim-ekits-menu__mobile__close"><i class="tk tk-times"></i></li>');
100			$('.navbar-main-menu .sub-menu > li:first-child, .main-navigation .menu .sub-menu > li:first-child').before('<li class="thim-ekits-menu__mobile__backlink"><i class="tk tk-angle-left"></i>Back</li>');
101
102			$(document).on('click', '.navbar-main-menu > li.menu-item-has-children .icon-toggle, .main-navigation .menu > li.menu-item-has-children .icon-toggle', function (e) {
103				e.stopPropagation();
104				$(this).next('ul.sub-menu').addClass('show');
105			})
106
107			$(document).on('click', '.thim-ekits-menu__mobile__backlink', function (e) {
108				e.preventDefault();
109				$(this).parent('ul.sub-menu').removeClass('show').slideUp(200, 'linear');
110			})
111		},
112
113		/**
114		 * Header menu sticky, scroll, v.v.
115		 */
116		header_menu: function () {
117			var $header = $('.sticky-header #masthead'),
118				off_Top = ($('#wrapper-container').length > 0) ? $('#wrapper-container').offset().top : 0,
119				$topbar = $('#thim-header-topbar'),
120				menuH = $header.outerHeight(),
121				latestScroll = 0,
122				startFixed = 2;
123			var $imgLogo = $('.site-header .thim-logo img'),
124				srcLogo = $($imgLogo).attr('src'),
125				dataRetina = $($imgLogo).data('retina'),
126				dataSticky = $($imgLogo).data('sticky'),
127				dataMobile = $($imgLogo).data('mobile'),
128				dataStickyMobile = $($imgLogo).data('sticky_mobile');
129			if ($topbar.length) {
130				if ($topbar.hasClass('style-overlay')) {
131					$header.css({
132						top: $topbar.outerHeight() + 'px'
133					});
134				}
135				startFixed = $topbar.outerHeight();
136			}
137			if ($(window).scrollTop() > 2) {
138				$header.removeClass('affix-top').addClass('affix')
139			}
140			if ($(window).outerWidth() < 769) {
141				if (dataMobile != null) {
142					$($imgLogo).attr('src', dataMobile);
143				}
144			} else {
145				if (window.devicePixelRatio > 1 && dataRetina != null) {
146					$($imgLogo).attr('src', dataRetina);
147				}
148			}
149			$(window).scroll(function () {
150				var current = $(this).scrollTop();
151				if (current > startFixed) {
152					$header.removeClass('affix-top').addClass('affix');
153					if ($(window).outerWidth() < 769) {
154						if (dataStickyMobile != null) {
155							$($imgLogo).attr('src', dataStickyMobile);
156						}
157					} else {
158						if (dataSticky != null) {
159							$($imgLogo).attr('src', dataSticky);
160						}
161					}
162				} else {
163					$header.removeClass('affix').addClass('affix-top');
164					if ($(window).outerWidth() < 769) {
165						if (dataMobile != null) {
166							$($imgLogo).attr('src', dataMobile);
167						}
168					} else {
169						if (window.devicePixelRatio > 1 && dataRetina != null) {
170							$($imgLogo).attr('src', dataRetina);
171						} else if (srcLogo != null) {
172							$($imgLogo).attr('src', srcLogo);
173						}
174					}
175				}
176
177				if (current > latestScroll && current > menuH + off_Top) {
178					if (!$header.hasClass('menu-hidden')) {
179						$header.addClass('menu-hidden');
180					}
181				} else {
182					if ($header.hasClass('menu-hidden')) {
183						$header.removeClass('menu-hidden');
184					}
185				}
186
187				latestScroll = current;
188			});
189		},
190
191		/**
192		 * Back to top
193		 */
194		back_to_top: function () {
195			var $element = $('#back-to-top');
196			$(window).scroll(function () {
197				if ($(this).scrollTop() > 100) {
198					$element.addClass('scrolldown').removeClass('scrollup');
199				} else {
200					$element.addClass('scrollup').removeClass('scrolldown');
201				}
202			});
203
204			$element.on('click', function () {
205				$('html,body').animate({scrollTop: '0px'}, 800);
206				return false;
207			});
208		},
209
210		/**
211		 * Sticky sidebar
212		 */
213		sticky_sidebar: function () {
214			var offsetTop = 20;
215
216			if ($("#wpadminbar").length) {
217				offsetTop += $("#wpadminbar").outerHeight();
218			}
219			if ($("#masthead.affix").length) {
220				offsetTop += $("#masthead.affix").outerHeight();
221			}
222
223			if ($('.sticky-sidebar').length > 0) {
224				$("aside.sticky-sidebar").theiaStickySidebar({
225					"containerSelector"     : "",
226					"additionalMarginTop"   : offsetTop,
227					"additionalMarginBottom": "0",
228					"updateSidebarHeight"   : false,
229					"minWidth"              : "768",
230					"sidebarBehavior"       : "modern"
231				});
232			}
233
234		},
235
236		/**
237		 * feature: Preloading
238		 */
239		feature_preloading: function () {
240			var $preload = $('#thim-preloading');
241			if ($preload.length > 0) {
242				$preload.fadeOut(1000, function () {
243					$preload.remove();
244				});
245			}
246		},
247
248		// close top bar
249		close_top_bar: function(){
250			$(document).on('click', '.close-topbar', function (e) {
251				e.stopPropagation();
252				$('body').toggleClass('close-topbar')
253			})
254		}
255
256	};
257
258})(jQuery);

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.