PageSourceSearch

https://www.knf.org.za/default/theme/js/scripts.js

js knf.org.za collected 2026-10-04 13:24:08 UTC 6,948 bytes, 267 lines download raw bytes

1// catch all document.write() calls
2(function(doc){
3	var write = doc.write;
4	doc.write = function(q){ 
5		log('document.write(): ',arguments); 
6		if (/docwriteregexwhitelist/.test(q)) write.apply(doc,arguments);  
7	};
8})(document);
9
10
11
12jQuery.fn.uniform.language = {
13    required      : '<em>%s</em> is required',
14    req_radio     : 'Please make a selection',
15    req_checkbox  : 'You must select this checkbox to continue',
16    minlength     : '<em>%s</em> should be at least %d characters long',
17    min           : '<em>%s</em> should be greater than or equal to %d',
18    maxlength     : '<em>%s</em> should not be longer than %d characters',
19    max           : '<em>%s</em> should be less than or equal to %d',
20    same_as       : '<em>%s</em> is expected to be same as <em><em>%s</em></em>',
21    email         : '<em>%s</em> is not a valid email address',
22    url           : '<em>%s</em> is not a valid URL',
23    number        : '<em>%s</em> needs to be a number',
24    integer       : '<em>%s</em> needs to be a whole number',
25    alpha         : '<em>%s</em> should contain only letters (without special characters or numbers)',
26    alphanum      : '<em>%s</em> should contain only numbers and letters (without special characters)',
27    phrase        : '<em>%s</em> should contain only alphabetic characters, numbers, spaces, and the following: . , - _ () * # :',
28    phone         : '<em>%s</em> should be a phone number',
29    date          : '<em>%s</em> should be a date (mm/dd/yyyy)',
30    callback      : 'Failed to validate <em>%s</em> field. Validator function (<em>%s</em>) is not defined!',
31    on_leave      : 'Are you sure you want to leave this page without submitting this form?',
32    submit_msg    : 'Sorry, this form needs to be corrected.',
33    submit_help   : 'Please see the items marked below.',
34    submit_success: 'Thank you, this form has been sent.'
35};
36
37
38jQuery.fn.uniform.defaults = {
39    prevent_submit          : true,
40    prevent_submit_callback : false,
41    ask_on_leave            : false,
42    on_leave_callback       : false,
43    valid_class             : 'valid',
44    invalid_class           : 'invalid',
45    error_class             : 'error',
46    focused_class           : 'focused',
47    holder_class            : 'ctrlHolder',
48    field_selector          : 'input, textarea, select',
49    default_value_color     : "#AFAFAF"
50};
51
52
53
54
55	
56// -------------------------------
57// AJAX LOGIN AND LOGOUT FUNCTIONS
58// -------------------------------
59
60// Logout Function
61
62$(document).ready(function() {
63	
64	$('a#loginLink').click(function(e) {
65		e.preventDefault();
66
67		$('#loginbox').show('slow', function() {
68			// Animation complete.
69		});
70	});
71	$('form.uniForm').uniform();
72
73	$('form.uniForm').uniform();
74
75	function member_logout() {
76
77		$("#logout").click(function(e) {
78
79			$.get('{path=LOGOUT}', function(data) {
80
81				$('#login_status')
82				.html('You are logged out!')
83				.removeClass('loggedin')
84				.addClass('loggedout');
85				$('#member_loggedin').hide();
86				$('#loginForm').fadeIn('slow');
87
88			});
89
90			e.preventDefault();
91
92		});
93	}
94		
95	member_logout();
96		
97	// // Login Function 
98
99	$("#btnLogin").click(function(e){
100
101		$.post($('#loginForm').attr('action'), $("#loginForm").serializeArray(), function(data){
102
103			var title = $(data).filter(function(){ return $(this).is('title') });
104
105			title.each(function() {
106
107				// Check if the login page returns an error.
108				if($(this).html() == "Error") {
109					$('#login_status').html('Username or password incorrect. Please try again. <a href="{path=user/forgot_password}">Forgot password?</a>');
110				}
111
112				// If no error, you are logged in 
113				if($(this).html() != "Error") {
114					$('#login_status').html('You are logged in! <a href="{path=user/edit_account}">Edit Profile</a>. <a id="logout" href="#">Logout</a>').fadeIn('500');
115
116					// Change class of box
117
118					$('#login_status').removeClass('loggedout').addClass('loggedin');
119
120					// remove login form when person is logged in
121					$('#loginForm').fadeOut();
122
123					// bind a logout function so that it can be used 
124					member_logout();
125
126				}
127
128			})
129
130
131		});
132
133		e.preventDefault();
134
135	}); /*end click*/
136
137
138	//GLOBAL NOTIFICATIONS
139	$(".notification").removeClass('noScript').addClass('hasScript').slideDown();
140
141	$(".notification div").append("<a href='#' class='closethis'>&times;</a>");
142
143	$(".notification").click(function(){
144		$(".notification").fadeOut();
145	});
146
147	if(!$(".notification").hasClass('sticky'))
148	{
149	}
150		
151
152	//LIGHTBOX
153	$('a.lightbox').lightBox({
154		fixedNavigation : true
155	}); // Select all links with lightbox class
156
157	//SUPERFISH
158	$('ul.sf-menu').superfish({
159		// pathClass:     'current', // enable if you use horizontal "sticky" menus
160		delay: 200,
161		autoArrows: false
162	}); 
163	
164	$('.tabs-box').tabs();
165	
166
167	//SLIDESHOWS
168	$('.promoSlide').each(function(e){
169		makeSlideShow($(this), {pager : ".promoSlidePager"+e});
170	});
171	
172	// makeSlideShow($('.flickr-feed'));
173	
174	function makeSlideShow(promoSlide, options){
175		
176		var h = promoSlide.find('img').height();
177		var w = promoSlide.find('img').width();
178		promoSlide.height(h);
179		promoSlide.width(w);
180		
181		promoSlideCSS =	{
182							'overflow': 'hidden',
183							'height': h+'px',
184							'position' : 'relative',
185							'z-index' : '5'
186							
187						};
188
189		promoSlide.css(promoSlideCSS);	
190
191		// $('#promoSlide .slideItem').height(h).width(w);
192
193		SlideCaptionCSS =	{
194								'bottom': -1*$(this).height(),
195								'opacity' : '0.7',
196								'width' : '100%',
197								'position' : 'absolute'
198							};
199					
200		$('#promoSlide .slideCaption').each(function(){
201			$(this).css(SlideCaptionCSS);
202		});
203
204		function onBefore() {
205		}
206
207		function onAfter() {
208			sCaption = $(this).find('.slideCaption');
209			sCaptionH = -1*sCaption.height();
210			sCaption.show()
211				.animate({opacity: 0.7}, 500)
212				.animate({bottom: "0px"}, { queue:false, duration: 500 })
213				.animate({opacity: 0.7}, 2000)
214				.animate({opacity: 0.0, bottom: sCaptionH}, 500);
215		}
216
217		function initSlideshow(slideShow)
218		{
219			// slideShow.find('img').fadeIn();
220			slideShow.find(".hidden").removeClass('hidden');
221
222			if(options.pager) slideShow.after("<div class='"+options.pager.substr(1)+"'></div>");
223			
224			defaultOptions = {
225			    timeout: 5000, 
226				fx: 'fade',
227				speed: 1000,
228				//before: onBefore,
229				//after: onAfter,
230				pause:   1
231			}
232			
233			if(typeof(options) != 'undefined'){
234				var cycleOptions = $.extend(defaultOptions, options);
235			}
236			
237			slideShow.cycle(cycleOptions);
238		}
239		
240		function is_image_loaded(image) {
241			if(!image.complete) {
242				return false;
243			}
244			if(typeof image.naturalWidth != "undefined" && image.naturalWidth == 0) {
245				return false;
246			}
247			return true;
248		};
249
250		var first_slide = $(promoSlide).find('img:first');
251
252		if(first_slide.length > 0){
253			if(is_image_loaded(first_slide.get(0))){
254				initSlideshow($(promoSlide));
255			} else {
256				first_slide.load(function(e) {
257					$('#loading').hide();
258					initSlideshow($(promoSlide));
259				});
260			}
261		}
262		
263	}
264	
265
266});
267

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.