PageSourceSearch

https://www.afsic.net/wp-content/themes/theme.pink/miramedia-base-2026/assets/js/main.js?ver=1.0.5

js afsic.net collected 2026-10-02 14:40:14 UTC 8,306 bytes, 271 lines download raw bytes

1/**
2 * Miramedia Base 2026 - Main Scripts
3 *
4 * Combined and refactored from:
5 *   - miramedia-base/library/js/scripts.js (parent theme)
6 *   - miramedia-child-byzantium/library/js/scripts.js (child theme)
7 *
8 * This file is loaded in the footer for optimal page performance.
9 */
10
11/* ----------------------------------------------------------------
12   Utility Functions (available globally)
13   ---------------------------------------------------------------- */
14
15/**
16 * Get Viewport Dimensions
17 * Returns an object with viewport width and height properties.
18 * Source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript
19 */
20function updateViewportDimensions() {
21	var w = window,
22		d = document,
23		e = d.documentElement,
24		g = d.getElementsByTagName('body')[0],
25		x = w.innerWidth  || e.clientWidth  || g.clientWidth,
26		y = w.innerHeight || e.clientHeight || g.clientHeight;
27	return { width: x, height: y };
28}
29
30// Setting the viewport width
31var viewport = updateViewportDimensions();
32
33/**
34 * Throttle Resize-triggered Events
35 * Wrap actions in this function to throttle the frequency of firing them off.
36 * Source: http://stackoverflow.com/questions/2854407/
37 */
38var waitForFinalEvent = (function() {
39	var timers = {};
40	return function(callback, ms, uniqueId) {
41		if (!uniqueId) {
42			uniqueId = "Don't call this twice without a uniqueId";
43		}
44		if (timers[uniqueId]) {
45			clearTimeout(timers[uniqueId]);
46		}
47		timers[uniqueId] = setTimeout(callback, ms);
48	};
49})();
50
51// Delay (in ms) before deciding a resize has stopped. 50-100 works well.
52var timeToWaitForLast = 100;
53
54/**
55 * Load Gravatars
56 * Swap data-gravatar attributes into src on viewports >= 768px.
57 */
58function loadGravatars() {
59	viewport = updateViewportDimensions();
60	if (viewport.width >= 768) {
61		jQuery('.comment img[data-gravatar]').each(function() {
62			jQuery(this).attr('src', jQuery(this).attr('data-gravatar'));
63		});
64	}
65}
66
67
68/* ----------------------------------------------------------------
69   Main jQuery Block (noConflict safe)
70   ---------------------------------------------------------------- */
71(function($) {
72
73	$(document).ready(function() {
74
75		/* ---------------------------------------------------
76		   Gravatars
77		   --------------------------------------------------- */
78		loadGravatars();
79
80
81		/* ---------------------------------------------------
82		   ScrollToFixed - Sticky Navigation
83		   --------------------------------------------------- */
84			if ($.fn.scrollToFixed && $('.nav-container').length) {
85				$('.nav-container').scrollToFixed();
86			}
87
88
89		/* ---------------------------------------------------
90		   Mobile Navigation Toggle
91		   Handled by pink.js (child theme) using the .nav-drawer
92		   slide-in pattern. No toggle logic here.
93		   --------------------------------------------------- */
94
95
96		/* ---------------------------------------------------
97		   Owl Carousel Initialization
98		   --------------------------------------------------- */
99		if ($.fn.owlCarousel && $('.owl-carousel').length) {
100			$('.owl-carousel').each(function() {
101				var $carousel = $(this);
102				// Default options - child themes can override via data attributes
103				var defaults = {
104					items: 1,
105					loop: true,
106					nav: true,
107					dots: true,
108					autoplay: false,
109					responsive: {
110						0:    { items: 1 },
111						600:  { items: 2 },
112						1000: { items: 3 }
113					}
114				};
115				// Allow per-element overrides via data-owl-options attribute
116				var customOptions = $carousel.data('owl-options');
117				var options = $.extend({}, defaults, customOptions || {});
118				$carousel.owlCarousel(options);
119			});
120		}
121
122
123		/* ---------------------------------------------------
124		   jQuery Ticker Initialization
125		   --------------------------------------------------- */
126		if ($.fn.ticker && $('#ticker').length) {
127			$('#ticker').ticker();
128		}
129
130
131		/* ---------------------------------------------------
132		   Cookie Prompt (uses js.cookie / Cookies global)
133		   --------------------------------------------------- */
134		if ($('#cookie-prompt-wrapper').length) {
135			if (typeof Cookies !== 'undefined' && !Cookies.get('cw-firstvisit')) {
136				$('#cookie-prompt-wrapper').fadeIn('slow');
137				$('#cookie-dismiss').on('click', function() {
138					$('#cookie-prompt-wrapper').slideUp('slow');
139				});
140				Cookies.set('cw-firstvisit', 'done', { expires: 365, path: '/' });
141			}
142		}
143
144
145		/* ---------------------------------------------------
146		   WP Activate Page - Hide header/footer
147		   --------------------------------------------------- */
148		if (window.location.href.indexOf('wp-activate') > -1) {
149			$('header').hide();
150			$('.client-footer-wrapper').hide();
151			$('body').addClass('wp-activate-page');
152		}
153
154		$('#signup-content').addClass('wrap');
155
156
157		/* ---------------------------------------------------
158		   Exhibitor List Dropdown Resets
159		   --------------------------------------------------- */
160		$('#category_dropdown_1').on('change', function() {
161			$('#hall_dropdown_1').prop('selectedIndex', 0);
162			$('#country_dropdown_1').prop('selectedIndex', 0);
163			$('#exhibitor-list--text-search').val('');
164		});
165
166		$('#hall_dropdown_1').on('change', function() {
167			$('#category_dropdown_1').prop('selectedIndex', 0);
168			$('#country_dropdown_1').prop('selectedIndex', 0);
169			$('#exhibitor-list--text-search').val('');
170		});
171
172		$('#country_dropdown_1').on('change', function() {
173			$('#category_dropdown_1').prop('selectedIndex', 0);
174			$('#hall_dropdown_1').prop('selectedIndex', 0);
175			$('#exhibitor-list--text-search').val('');
176		});
177
178		$('#exhibitor-list--text-search').on('change', function() {
179			$('#category_dropdown_1').prop('selectedIndex', 0);
180			$('#hall_dropdown_1').prop('selectedIndex', 0);
181			$('#country_dropdown_1').prop('selectedIndex', 0);
182		});
183
184
185		/* ---------------------------------------------------
186		   Countdown Timer Label Text
187		   --------------------------------------------------- */
188		$('.hours_dash span.dash_title').text('Hrs');
189		$('.minutes_dash span.dash_title').text('Mins');
190		$('.seconds_dash span.dash_title').text('Secs');
191
192
193		/* ---------------------------------------------------
194		   Speaker Group Ordering (Sortable)
195		   --------------------------------------------------- */
196		if ($.fn.sortable && $('#sortable').length) {
197			$('#sortable').sortable({
198				create: function() {
199					$('#theorder').val($('#sortable').sortable('toArray').join(','));
200				},
201				update: function() {
202					$('#theorder').val($('#sortable').sortable('toArray').join(','));
203					$('#speaker-group-ordering-form').submit();
204				}
205			});
206			$('#sortable').disableSelection();
207		}
208
209		// Reset custom speaker order
210		$('.custom-speaker-order-reset').on('click', function() {
211			var group_id = $(this).attr('group');
212			if (confirm('Are you sure?')) {
213				$.post(
214					ajaxurl,
215					{
216						action: 'confweb_reset_custom_speaker_group_order',
217						group: group_id
218					},
219					function(data) {
220						if (data === 'SUCCESS') {
221							location.href = location.href;
222						}
223					}
224				);
225			}
226		});
227
228
229		/* ---------------------------------------------------
230		   Animate Numbers on In-View (Facts & Figures)
231		   Uses jquery.inview and jquery.animateNumber plugins.
232		   --------------------------------------------------- */
233		if ($.fn.animateNumber) {
234
235			$('[data-animate-number]').on('inview', function(event, isInView) {
236				if (isInView) {
237					var $el     = $(this);
238					var target  = parseInt($el.data('animate-number'), 10) || 0;
239					var fadeSel = $el.data('animate-fadein') || null;
240
241					$el.animateNumber({ number: target, easing: 'swing' }, 1000, function() {
242						if (fadeSel) {
243							$(fadeSel).fadeIn();
244						}
245					});
246
247					// Only fire once
248					$el.off('inview');
249				}
250			});
251		}
252
253
254		/* ---------------------------------------------------
255		   Extranet Logged-In Margin Fix
256		   --------------------------------------------------- */
257		$('.extranet-member-logged-in').parent('html').css({ 'margin-top': '0px' });
258
259
260		/* ---------------------------------------------------
261		   jQuery Validate - Auto-init forms with .validate-form
262		   --------------------------------------------------- */
263		if ($.fn.validate && $('.validate-form').length) {
264			$('.validate-form').each(function() {
265				$(this).validate();
266			});
267		}
268
269	}); // end document.ready
270
271})(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.