PageSourceSearch

https://brokenriver.co.nz/_resources/themes/simple/javascript/custom.js?id=4&m=1699871694

js brokenriver.co.nz collected 2026-09-29 15:22:48 UTC 17,569 bytes, 608 lines download raw bytes

1jQuery.noConflict();
2
3(function ($) {
4	$(document).ready(function () {
5		$('li.menu-parent').click(function (event) {
6			if ($(window).width() < 1200) {
7				if (!$(this).hasClass('open')) { //open
8					//close others
9					$('li.menu-parent').removeClass('open');
10					$('li.menu-parent span.open-button').html('+');
11
12					$(this).removeClass('open');
13					$(this).hide().addClass('open').slideDown();
14					$(this).find('.open-button').html('-');
15				} else { //close
16					$(this).removeClass('open');
17					$(this).find('.open-button').html('+');
18				}
19			}
20		});
21
22		$('.open-contacts').click(function (event) {
23			//$('.header-contact').toggle();
24		});
25
26		/* Tables */
27		//responsive tables
28		$('table').each(function () {
29			$(this).css({
30				"maxWidth": $(this).width()
31			});
32			$(this).width('100%');
33			if (!$(this).hasClass('clear-table') > 0) {
34				$(this).css({
35					"minHeight": $(this).height()
36				});
37			}
38			$(this).height('auto');
39		});
40
41		$('.table1, .table2, .table3').each(function () {
42			$(this).find('tbody td').each(function () {
43				var index = $(this).index();
44				var content = $(this).closest('.table1, .table2, .table3').find('thead td').eq(index).text();
45				$(this).prepend("<div class='cell-title'>" + content + "</div>");
46			});
47		});
48
49		/* EmploymentPage */
50		$('.job .short').click(function (event) {
51			event.preventDefault();
52			$(this).children('.expand').toggleClass('expanded');
53			$(this).parent().find('.more').toggle();
54		});
55
56		/* EventsPage */
57		$('.event-more').click(function (event) {
58			$(this).closest('.event').find('.content').slideToggle();
59			event.preventDefault();
60		});
61
62		$('.events-header').click(function () {
63			alert('a')
64		});
65
66		/* VideoPage */
67		$('.video-thumb.video-nav a').click(function (event) {
68			event.preventDefault();
69			var videoID = $(this).parent().attr('id').substring(1, 4);
70			var current = $(this).closest('.video-category').find('.video.current');
71			var currentID = $(this).closest('.video-category').find('.video.current').data('id');
72			if (videoID != currentID) {
73				current.removeClass('current');
74
75				//crude but effective way to mute a video in an iframe
76				current.clone().insertAfter(current);
77				current.remove();
78
79				$('.v' + videoID).addClass('current');
80			}
81
82			$('html, body').animate({
83				scrollTop: $(this).closest('.video-category').find('.player').offset().top - 200
84			}, 2000);
85		});
86
87		/* GalleryPage */
88		$('.gallery .photos').each(function () { // the containers for all your galleries
89			$(this).magnificPopup({
90				delegate: 'a', // child items selector, by clicking on it popup will open
91				type: 'image',
92				gallery: {
93					enabled: true
94				},
95				image: {
96					titleSrc: function (item) {
97						return '<div class="open-caption"></div><span class="caption">' + item.el.attr('title') + '</span>';
98					}
99				}
100				// other options
101			});
102		});
103
104		renderFees();
105
106		$(window).trigger('resize');
107	});
108
109
110	/* BlogPage */
111	/* ArchAugust edits */
112	function loadMasonry() {
113		$('.blogs').masonry({
114			// options
115			itemSelector: '.blog',
116			columnWidth: '.blog-sizer',
117			percentPosition: true,
118			fitWidth: true
119		});
120	}
121
122	/* Webcam */
123	function loadSlider() {
124		$('.archslider').each(function() {
125			var parent = $(this).closest('.br-webcam');					
126			var max = parent.find('.webcam-image').length;
127			$(this).slider({
128				range: "max",
129				min: -max,
130				max: -1,
131				value: -1,
132				slide: function (event, ui) {
133					parent.find('.webcam-image').hide();
134					parent.find('.webcam-image#i' + Math.abs(ui.value)).show();
135				}
136			});
137		})
138
139		$('.archmobile-slider').each(function() {
140			$(this).on('input change', function (event) {
141				var parent = $(this).closest('.br-webcam');
142				parent.find('.webcam-image').hide();
143				parent.find('.webcam-image#i' + Math.abs($(this).val())).show();
144			});
145		});
146	}
147
148	$('.blogs').imagesLoaded(function () {
149		loadMasonry();
150	});
151
152	$('.no-link').click(function (event) {
153		event.preventDefault();
154	});
155
156	$('.blog').click(function (event) {
157		var e = $(this),
158			open = e.hasClass('open');
159
160		$('.blog').each(function () {
161			$(this).removeClass('open');
162			$(this).find('.blog-short').removeClass('u-hidden');
163			$(this).find('.blog-full').addClass('u-hidden');
164		});
165
166		if (open == false) {
167			e.addClass('open');
168			e.find('.blog-short').addClass('u-hidden');
169			e.find('.blog-full').removeClass('u-hidden');
170		}
171
172		loadMasonry();
173	});
174
175	$('.slide').click(function () {
176		if ($(window).width() < 960) {
177			$(this).find('.image-overlay').toggle();
178		}
179	});
180
181	$('a[href*=\\#]').on('click', function (event) {
182		if ($(this.hash).length > 0)
183			$('html,body').animate({
184				scrollTop: $(this.hash).offset().top - 200
185			}, 500);
186	});
187
188	$(window).resize(function () {
189		if ($(this).width() < 1200) {
190			if ($(".o-webcam-mobile").html() == "") {
191				$(".o-webcam-mobile").html($(".o-webcam-desktop").html());
192				$(".o-webcam-desktop").html("");
193				loadSlider();
194			}
195		} else {
196			if ($(".o-webcam-desktop").html() == "") {
197				$(".o-webcam-desktop").html($(".o-webcam-mobile").html());
198				$(".o-webcam-mobile").html("");
199				loadSlider();
200			} else
201				loadSlider();
202		}
203	});
204
205	$('.show-registration-form').click(function (e) {
206		e.preventDefault();
207		$('#form-register-main').slideDown();
208		addDateOfBirthChangeEvent();
209		numberInputs(0);		
210	});
211
212	$('#form_membershipType').change(function () {
213		if ($(this).val() == 'Family') {
214			$('.family-only').removeClass('hidden');
215			$('.family-hide').addClass('hidden');
216		} else {
217			$('.family-only').addClass('hidden');
218			$('.family-hide').removeClass('hidden');
219		}
220	});
221
222	function newSwitcher() {
223		$(".o-new-account .o-new").change(function () {
224			var parent = $(this).closest('.o-new-account');
225			if ($(this).val() == 'New') {
226				parent.find('.o-membership-number').addClass('hidden');
227			} else {
228				parent.find('.o-membership-number').removeClass('hidden');
229			}
230		});
231	}
232	newSwitcher();
233
234	var members = 0;
235
236	$('#add-more').click(function (event) {
237		members++;
238		var url = $(this).attr('href').replace('#bottom-forms-anchor', '');
239
240		$.ajax(url+'?memberIndex='+members)
241			.done(function (response) {
242				$('#additional-forms').append('<br /><div class="o-new-account">'+response+'</div>');
243				addDateOfBirthChangeEvent();
244				numberInputs(members);
245				renderFees();
246			})
247			.fail(function (xhr) {
248				alert('Error: ' + xhr.responseText);
249			});
250
251		renderFees();
252		newSwitcher();
253		$('.o-confirmation').addClass('hidden');
254		$('.o-summary').html('');
255		$('#form_membershipType').val('Family').change();
256	});
257
258	// form prices
259	function renderFees() {
260		$('.price-season-pass-adult').html($('[name=AllSeasonPassAdult]').val());
261		$('.price-season-pass-junior').html($('[name=AllSeasonPassJunior]').val());
262		$('.price-ski-locker').html($('[name=SkiLocker]').val());
263		$('.price-boot-locker').html($('[name=BootLocker]').val());
264	}
265
266	function addDateOfBirthChangeEvent() {
267		$('.form_dob').each(function () {
268			$(this).datepicker({
269				changeMonth: true,
270				changeYear: true,
271				yearRange: "-100:+0",
272				dateFormat: 'dd/mm/yy'
273			});
274			$(this).change(updateMembershipType);
275		});
276	}	
277	addDateOfBirthChangeEvent();
278
279	function numberInputs(index) {
280		var formInputCount = 0;
281		var selector = '.input-counter'+index;
282
283		$('div>label').each(function(){
284			if($(this).find(selector)[0]) {
285				formInputCount++;				
286				$(this).find(selector).html(formInputCount+'.');
287			}
288		});
289	}	
290    numberInputs(0);
291
292	function updateMembershipType() {
293		var parent = $(this).closest('.o-new-account');
294		var dob = $(this).val();
295		//        var dob_day_month = dob.substring(0, 5);
296		var age;
297
298		age = calculateAge(dob);
299		if (age <= 11) {
300			parent.find('.o-form-membership-type').val('Child');
301		} else if (age <= 18) {
302			parent.find('.o-form-membership-type').val('Youth');
303		} else {
304			parent.find('.o-form-membership-type').val('Adult');
305		}
306	}
307
308	var total_fees = 0;
309
310	$('.o-pre-submit').click(function () {
311		// reset fees
312		total_fees = 0;
313
314		// check all required fields
315		var form = $('#form-register');
316
317		if (form.find('.required').filter(function () {
318				return this.value === ''
319			}).length > 0) {
320			alert("Please complete all required fields.");
321			return false;
322		} else {
323			// fees 
324			var fee_new = parseInt($('[name=RegistrationFee]').val());
325			var fee_adult = parseInt($('[name=Adult]').val());
326			var fee_youth = parseInt($('[name=Youth]').val());
327			var fee_child = parseInt($('[name=Child]').val());
328			var fee_boot_locker = parseInt($('[name=BootLocker]').val());
329			var fee_key_locker = parseInt($('[name=SkiLocker]').val());
330			var fee_all_season_adult = parseInt($('[name=AllSeasonPassAdult]').val());
331			var fee_all_season_junior = parseInt($('[name=AllSeasonPassJunior]').val());
332
333			// summary
334			var html = '',
335				ctr = 1,
336				registrationType = $('#form_membershipType').val(),
337				fees = 0;
338			adult = 0;
339			youth = 0;
340			var total_adults = 0;
341			var total_junior = 0;
342			$('.o-new-account').each(function () {
343				var e = $(this);
344				if (e.find(".o-form-membership-type").val() == 'Adult') {
345					total_adults++;
346				} else {
347					total_junior++;
348				}
349			});
350
351			$('.o-confirmation').removeClass('hidden');
352			$('.o-summary').html('');
353			$('.o-new-account').each(function () {
354				var e = $(this),
355					applicant,
356					html_fees;
357
358				// add email requirement if Individual registration
359				if (total_adults === 1 && total_junior === 0)
360					e.find('.o-form-email').prop('required', 'required');
361				else
362					e.find('.o-form-email').removeProp('required');
363
364				// calculate fees 
365				if (e.find(".o-form-membership-type").val() == 'Adult') {
366					adult++;
367
368					// joining fee
369					fees = fee_new;
370					html_fees = "<tr><td>Joining Fee:</td><td class='text-right'>$" + fee_new + "</td></tr>";
371
372					// annual fee 
373					// if family, first adult = half annual fee, succeeding adults full fee
374					if (registrationType == "Family" && adult == 1) {
375						var fee_adult_discounted = fee_adult / 2;
376						fees += fee_adult_discounted; // half annual fee
377						html_fees += "<tr><td>Annual Fee - Adult (Discounted):</td><td class='text-right'>$" + fee_adult_discounted + "</td></tr>";
378					} else {
379						html_fees += "<tr><td>Annual Fee - Adult:</td><td class='text-right'>$" + fee_adult + "</td></tr>";
380						fees += fee_adult;
381					}
382				} else {
383					// youth have no joining fee
384					youth++;
385					html_fees = "<tr><td>Joining Fee:</td><td class='text-right'>NONE</td></tr>";
386
387					// annual fees, if family, 3rd youth is free
388					if (registrationType == "Family") {
389						if (youth < 3) {
390							fees = fee_youth;
391							html_fees += "<tr><td>Annual Fee - Junior:</td><td class='text-right'>$" + fee_youth + "</td></tr>";
392						} else {
393							fees = 0;
394							html_fees += "<tr><td>Annual Fee - Junior:</td><td class='text-right'>NONE</td></tr>";
395						}
396					} else {
397						fees = fee_youth;
398						html_fees += "<tr><td>Annual Fee - Junior:</td><td class='text-right'>$" + fee_youth + "</td></tr>";
399					}
400				}
401
402				if (ctr == 1) {
403					if (registrationType == "Family")
404						applicant = 'Lead Applicant';
405					else
406						applicant = 'Applicant 1';
407				} else
408					applicant = ('Applicant ' + ctr);
409				var emptyIfNull = function(value) {
410					return value === undefined ? '' : value;
411				} 
412
413				html = '<div class="u-1/4"><strong class="u-uppercase">' + applicant + '</strong><br />';
414				html += 'New Member';
415				html += '<br />Name: ' + e.find(".o-form-fname").val() + ' ' + e.find(".o-form-lname").val();
416				html += '<br />Email: ' + e.find(".o-form-email").val();
417				html += '<br />Phone: ' + e.find(".o-form-phone").val();
418				html += '<br />City: ' + e.find(".o-form-city").val();
419				html += '<br />Country: ' + e.find(".o-form-country").val();
420				html += '<br />DOB: ' + e.find(".o-form-dob").val();
421				html += '<br />Sex: ' + emptyIfNull(e.find(".o-form-sex input[type='radio']:checked").val());
422				html += '<br />Occupation: ' + e.find(".o-form-occupation").val();
423				html += '<br />' + e.find(".o-form-membership-type").val();
424				html += '<br />Boot Locker: ';
425				if (e.find(".o-form-boot-locker").is(':checked')) {
426					html += 'Y';
427					fees += fee_boot_locker;
428					html_fees += "<tr><td>Boot Locker:</td><td class='text-right'>$" + fee_boot_locker + "</td></tr>";
429				} else
430					html += 'N';
431				html += '<br />Ski Locker: ';
432				if (e.find(".o-form-ski-locker").is(':checked')) {
433					html += 'Y';
434					fees += fee_key_locker;
435					html_fees += "<tr><td>Ski Locker:</td><td class='text-right'>$" + fee_key_locker + "</td></tr>";
436				} else
437					html += 'N';
438				html += '<br />Season Pass: ';
439				if (e.find(".o-form-season-pass").is(':checked')) {
440					html += 'Y';
441					if (e.find(".o-form-membership-type").val() == "Adult") {
442						fees += fee_all_season_adult;
443						html_fees += "<tr><td>Season Pass - Adult:</td><td class='text-right'>$" + fee_all_season_adult + "</td></tr>";
444					} else {
445						fees += fee_all_season_junior;
446						html_fees += "<tr><td>Season Pass - Junior:</td><td class='text-right'>$" + fee_all_season_junior + "</td></tr>";
447					}
448				} else
449					html += 'N';
450
451				html += '<br /><br /><table class="table">' + html_fees + '<tr><td><strong>Subtotal:</strong></td><td class="text-right"><strong>$' + fees + '</strong></td></tr></table>';
452				html += '</div>';
453
454				ctr++;
455				total_fees += fees;
456
457				$('.o-summary').append(html);
458			});
459
460			$('.o-summary').append('<br /><br /><div class="o-total">Total Fees: $' + total_fees + '</div>');
461		}
462	});
463
464	$("#form-register").submit(function (event) {
465		$('.o-submit-button').html('Sending Application');
466		var recaptcha = grecaptcha.getResponse();
467		var data = $(this).serialize();
468
469		$.ajax({
470			url: "/about-br/of-interest/membership/Register",
471			data: data + "&g-recaptcha-response=" + recaptcha,
472			type: "POST",
473			success: function (data) {
474				if (data == true) {					
475					$('#error-container').html('');
476
477					$('.o-submit-button').html('Application Sent');
478					$('.o-success').removeClass('hidden').slideDown();
479
480					// set PxPay variables
481					$("#px_name").val($(".o-form-fname").first().val() + ' ' + $(".o-form-lname").first().val());
482					$("#px_email").val($(".o-form-email").first().val());
483					$("#px_membership_type").val($(".o-form-membership-type").first().val());
484					$("#px_total").val(total_fees * 1.025);
485				} else {
486					$('.o-submit-button').html('Submit Application').removeAttr('disabled');
487					grecaptcha.reset();
488					$('#error-container').html(data);
489					console.error(data);
490				}
491			}
492		})
493		event.preventDefault();
494	});
495
496	$("#form-login-new").submit(function (event) {
497		var e = $(this);
498		if (e.find("[name=Password]").val() != e.find("[name=Password2]").val() || e.find("[name=Password]").val() == '' || e.find("[name=Password2]").val() == '') {
499			$("#msgDivNew").html("Passwords do not match.");
500		} else {
501			e.find('.button').html('Verifying Account').prop('disabled', 'true');
502			var data = $(this).serialize();
503			$.ajax({
504				url: "/members-area/LoginNew",
505				data: data,
506				type: "POST",
507				success: function (data) {
508					if (data == true) {
509						// redirect
510						window.location.replace('/members-area/');
511					} else {
512						e.find('.button').html('Create Account').removeAttr('disabled');
513						$("#msgDivNew").html(data);
514					}
515				}
516			});
517		}
518		event.preventDefault();
519	});
520
521	$("#form-login-member").submit(function (event) {
522		var e = $(this);
523
524		e.find('.button').html('Verifying Account').prop('disabled', 'true');
525		var data = $(this).serialize();
526		$.ajax({
527			url: "/members-area/LoginMember",
528			data: data,
529			type: "POST",
530			success: function (data) {
531				if (data == true) {
532					// redirect
533					window.location.replace('/members-area/');
534				} else {
535					e.find('.button').html('Login').removeAttr('disabled');
536					$("#msgDivMember").html(data);
537				}
538			}
539		});
540		event.preventDefault();
541	});
542
543	$("#form-reset").submit(function (event) {
544		var e = $(this);
545
546		e.find('.button').html('Verifying Account').prop('disabled', 'true');
547		var data = $(this).serialize();
548		$.ajax({
549			url: "/members-area/password-reset/PasswordReset",
550			data: data,
551			type: "POST",
552			success: function (data) {
553				if (data == true) {
554					e.find('.button').html('Password Sent');
555					$("#msgDiv").html('Please check your email, then <a href="/members-area#form-login-member">login here</a>');
556				} else {
557					e.find('.button').html('Send Request').removeAttr('disabled');
558					$("#msgDiv").html(data);
559				}
560			}
561		});
562		event.preventDefault();
563	});
564
565	$("#form-change").submit(function (event) {
566		var e = $(this);
567
568		e.find('.button').html('Verifying Password').prop('disabled', 'true');
569		var data = $(this).serialize();
570		$.ajax({
571			url: "/members-area/password-change/PasswordChange",
572			data: data,
573			type: "POST",
574			success: function (data) {
575				if (data == true) {
576					e.find('.button').html('Password updated');
577					$("#msgDiv").html("");
578				} else {
579					e.find('.button').html('Change Password').removeAttr('disabled');
580					$("#msgDiv").html(data);
581				}
582			}
583		});
584		event.preventDefault();
585	});
586}(jQuery));
587
588function calculateAge(dob) {
589	var date = new Date();
590	var year = parseInt(date.getFullYear());
591	var dob_year = parseInt(dob.substring(6));
592	var age = year - dob_year;
593	return age;
594}
595
596var width = jQuery(window).width();
597var adult, junior;
598
599jQuery(window).load(function () {
600	jQuery('.section').imagesLoaded(function () {
601		if (window.location.hash) {
602			jQuery('html,body').animate({
603				scrollTop: jQuery(window.location.hash).offset().top - 200
604			}, 500);
605			jQuery(window.location.hash).trigger('click');
606		}
607	});
608});

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.