PageSourceSearch

https://foodconnections.ca/js/admin/custom.js

js foodconnections.ca collected 2026-09-24 13:30:23 UTC 16,942 bytes, 731 lines download raw bytes

1$(function() {
2	
3	//===== Autocomplete =====//
4	
5	var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ];
6	$( "#ac" ).autocomplete({
7	source: availableTags
8	});	
9	
10	
11	//===== Tags =====//	
12		
13	$('#tags').tagsInput({width:'100%'});
14	
15	
16	//===== Input limiter =====//
17	
18	$('.limit').inputlimiter({
19		limit: 100
20		//boxClass: 'limBox',
21		//boxAttach: false
22	});
23	
24	
25	//===== Masked input =====//
26	
27	$.mask.definitions['~'] = "[+-]";
28	$(".maskDate").mask("9999-99-99 99:99:99",{completed:function(){alert("Remember it's 24 hour time!");}});
29	$(".maskPhone").mask("(999) 999-9999");
30	$(".maskPhoneExt").mask("(999) 999-9999? x99999");
31	$(".maskIntPhone").mask("+33 999 999 999");
32	$(".maskTin").mask("99-9999999");
33	$(".maskSsn").mask("999-99-9999");
34	$(".maskProd").mask("a*-999-a999", { placeholder: " " });
35	$(".maskEye").mask("~9.99 ~9.99 999");
36	$(".maskPo").mask("PO: aaa-999-***");
37	$(".maskPct").mask("99%");
38	
39	
40	//===== Placeholder =====//
41	
42	$('input[placeholder], textarea[placeholder]').placeholder();
43
44	
45	//===== Multiple select with dropdown =====//
46	
47	$(".chzn-select").chosen(); 
48	
49	
50	//===== Usual validation engine=====//
51
52	$("#usualValidate").validate({
53		rules: {
54			firstname: "required",
55			minChars: {
56				required: true,
57				minlength: 3
58			},
59			maxChars: {
60				required: true,
61				maxlength: 6
62			},
63			mini: {
64				required: true,
65				min: 3
66			},
67			maxi: {
68				required: true,
69				max: 6
70			},
71			range: {
72				required: true,
73				range: [6, 16]
74			},
75			emailField: {
76				required: true,
77				email: true
78			},
79			urlField: {
80				required: true,
81				url: true
82			},
83			dateField: {
84				required: true,
85				date: true
86			},
87			digitsOnly: {
88				required: true,
89				digits: true
90			},
91			enterPass: {
92				required: true,
93				minlength: 5
94			},
95			repeatPass: {
96				required: true,
97				minlength: 5,
98				equalTo: "#enterPass"
99			},
100			customMessage: "required",
101			
102	
103			topic: {
104				required: "#newsletter:checked",
105				minlength: 2
106			},
107			agree: "required"
108		},
109		messages: {
110			customMessage: {
111				required: "Bazinga! This message is editable",
112			},
113			agree: "Please accept our policy"
114		}
115	});
116	
117	//===== Form to Wizard plugin =====//
118	
119	$("#wizForm").formwizard({ 
120		formPluginEnabled: false,
121		validationEnabled: true,
122		focusFirstInput : false,
123		formOptions :{
124			success: function(data){$("#status").fadeTo(500,1,function(){ $(this).html("You are now registered!").fadeTo(5000, 0); })},
125			beforeSubmit: function(data){$("#data").html("data sent to the server: " + $.param(data));},
126			dataType: 'json',
127			resetForm: true
128		},
129		disableUIStyles : true,
130		validationOptions : {
131			rules: {
132				req: "required",
133				sel: "required",
134				chb: "required",
135				email: {
136					required: true,
137					email: true
138				}
139			},
140			messages: {
141				req: "This field is required",
142				sel: "Oops, required!",
143				chb: "Check it",
144				email: {
145					required: "Please specify your email",
146					email: "Correct format is [email protected]"
147				}
148			}
149		}
150	 }
151	);
152
153	
154	//===== UI dialog =====//
155	
156	$( "#dialog-message" ).dialog({
157		autoOpen: false,
158		modal: true,
159		buttons: {
160			Ok: function() {
161				$( this ).dialog( "close" );
162			}
163		}
164	});
165	
166	$( "#opener" ).click(function() {
167		$( "#dialog-message" ).dialog( "open" );
168		return false;
169	});	
170	
171	
172	//===== PrettyPhoto lightbox plugin =====//
173	
174	$("a[rel^='prettyPhoto']").prettyPhoto();
175	
176	
177	//===== Dual select boxes =====//
178	
179	$.configureBoxes();
180	
181	
182	//===== Time picker =====//
183	
184	$('.timepicker').timeEntry({
185		show24Hours: true, // 24 hours format
186		showSeconds: true, // Show seconds?
187		spinnerImage: 'images/ui/spinnerUpDown.png', // Arrows image
188		spinnerSize: [17, 26, 0], // Image size
189		spinnerIncDecOnly: true // Only up and down arrows
190		});
191
192
193	//===== File uploader =====//
194	
195	$("#uploader").pluploadQueue({
196		runtimes : 'html5,html4',
197		url : 'php/upload.php',
198		max_file_size : '2mb',
199		unique_names : true,
200		filters : [
201			{title : "Image files", extensions : "jpg,gif,png"},
202			{title : "Zip files", extensions : "zip"}
203		]
204	});
205	
206
207
208	//===== File manager =====//	
209	
210/*	$('#fileManager').elfinder({
211		url : 'php/connector.php',
212	})
213*/	
214
215	//===== Alert windows =====//
216
217	$(".bAlert").click( function() {
218		jAlert('This is a custom alert box. Title and this text can be easily editted', 'Alert Dialog Sample');
219	});
220	
221	$(".bConfirm").click( function(e) {
222		e.preventDefault();
223
224		var url = $(this).attr('href');
225
226		jConfirm('Are you sure you want to do this?', 'Confirmation Needed', function(r) {
227
228			if(r)
229			{
230				document.location.href = url;
231			}
232			else
233			{
234				return false;
235			}
236		});
237	});
238	
239	$(".bPromt").click( function() {
240		jPrompt('Type something:', 'Prefilled value', 'Prompt Dialog', function(r) {
241			if( r ) alert('You entered ' + r);
242		});
243	});
244	
245	$(".bHtml").click( function() {
246		jAlert('You can use HTML, such as <strong>bold</strong>, <em>italics</em>, and <u>underline</u>!');
247	});
248
249
250	//===== Accordion =====//		
251	
252	$('div.menu_body:eq(0)').show();
253	$('.acc .head:eq(0)').show().css({color:"#2B6893"});
254	
255	$(".acc .head").click(function() {	
256		$(this).css({color:"#2B6893"}).next("div.menu_body").slideToggle(300).siblings("div.menu_body").slideUp("slow");
257		$(this).siblings().css({color:"#404040"});
258	});
259	
260	
261	
262	
263	//===== WYSIWYG editor =====//
264	
265	$('.wysiwyg').wysiwyg({
266		iFrameClass: "wysiwyg-input",
267		controls: {
268			bold          : { visible : true },
269			italic        : { visible : true },
270			underline     : { visible : true },
271			strikeThrough : { visible : false },
272			
273			justifyLeft   : { visible : true },
274			justifyCenter : { visible : true },
275			justifyRight  : { visible : true },
276			justifyFull   : { visible : true },
277			
278			indent  : { visible : true },
279			outdent : { visible : true },
280			
281			subscript   : { visible : false },
282			superscript : { visible : false },
283			
284			undo : { visible : true },
285			redo : { visible : true },
286			
287			insertOrderedList    : { visible : true },
288			insertUnorderedList  : { visible : true },
289			insertHorizontalRule : { visible : false },
290
291			h1: {
292			visible: true,
293			className: 'h1',
294			command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
295			arguments: ($.browser.msie || $.browser.safari) ? '<h1>' : 'h1',
296			tags: ['h1'],
297			tooltip: 'Header 1'
298			},
299			h2: {
300			visible: true,
301			className: 'h2',
302			command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
303			arguments: ($.browser.msie || $.browser.safari) ? '<h2>' : 'h2',
304			tags: ['h2'],
305			tooltip: 'Header 2'
306			},
307			h3: {
308			visible: true,
309			className: 'h3',
310			command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
311			arguments: ($.browser.msie || $.browser.safari) ? '<h3>' : 'h3',
312			tags: ['h3'],
313			tooltip: 'Header 3'
314			},
315			h4: {
316			visible: true,
317			className: 'h4',
318			command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
319			arguments: ($.browser.msie || $.browser.safari) ? '<h4>' : 'h4',
320			tags: ['h4'],
321			tooltip: 'Header 4'
322			},
323			h5: {
324			visible: true,
325			className: 'h5',
326			command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
327			arguments: ($.browser.msie || $.browser.safari) ? '<h5>' : 'h5',
328			tags: ['h5'],
329			tooltip: 'Header 5'
330			},
331			h6: {
332			visible: true,
333			className: 'h6',
334			command: ($.browser.msie || $.browser.safari) ? 'formatBlock' : 'heading',
335			arguments: ($.browser.msie || $.browser.safari) ? '<h6>' : 'h6',
336			tags: ['h6'],
337			tooltip: 'Header 6'
338			},
339			
340			cut   : { visible : true },
341			copy  : { visible : true },
342			paste : { visible : true },
343			html  : { visible: true },
344			increaseFontSize : { visible : false },
345			decreaseFontSize : { visible : false },
346			},
347		events: {
348			click: function(event) {
349				if ($("#click-inform:checked").length > 0) {
350					event.preventDefault();
351					alert("You have clicked jWysiwyg content!");
352				}
353			}
354		}
355	});
356	
357	//$('.wysiwyg').wysiwyg("insertHtml", "Sample code");
358
359
360
361
362
363
364
365	
366	//===== ToTop =====//
367
368	$().UItoTop({ easingType: 'easeOutQuart' });	
369	
370	
371	//===== Spinner options =====//
372	
373	var itemList = [
374		{url: "http://ejohn.org", title: "John Resig"},
375		{url: "http://bassistance.de/", title: "J&ouml;rn Zaefferer"},
376		{url: "http://snook.ca/jonathan/", title: "Jonathan Snook"},
377		{url: "http://rdworth.org/", title: "Richard Worth"},
378		{url: "http://www.paulbakaus.com/", title: "Paul Bakaus"},
379		{url: "http://www.yehudakatz.com/", title: "Yehuda Katz"},
380		{url: "http://www.azarask.in/", title: "Aza Raskin"},
381		{url: "http://www.karlswedberg.com/", title: "Karl Swedberg"},
382		{url: "http://scottjehl.com/", title: "Scott Jehl"},
383		{url: "http://jdsharp.us/", title: "Jonathan Sharp"},
384		{url: "http://www.kevinhoyt.org/", title: "Kevin Hoyt"},
385		{url: "http://www.codylindley.com/", title: "Cody Lindley"},
386		{url: "http://malsup.com/jquery/", title: "Mike Alsup"}
387	];
388
389	var opts = {
390		's1': {decimals:2},
391		's2': {stepping: 0.25},
392		's3': {currency: '$'},
393		's4': {},
394		's5': {
395			//
396			// Two methods of adding external items to the spinner
397			//
398			// method 1: on initalisation call the add method directly and format html manually
399			init: function(e, ui) {
400				for (var i=0; i<itemList.length; i++) {
401					ui.add('<a href="'+ itemList[i].url +'" target="_blank">'+ itemList[i].title +'</a>');
402				}
403			},
404
405			// method 2: use the format and items options in combination
406			format: '<a href="%(url)" target="_blank">%(title)</a>',
407			items: itemList
408		}
409	};
410
411	for (var n in opts)
412		$("#"+n).spinner(opts[n]);
413
414	$("button").click(function(e){
415		var ns = $(this).attr('id').match(/(s\d)\-(\w+)$/);
416		if (ns != null)
417			$('#'+ns[1]).spinner( (ns[2] == 'create') ? opts[ns[1]] : ns[2]);
418	});
419
420
421	//===== Contacts list =====//
422	
423	$('#myList').listnav({ 
424		initLetter: 'a', 
425		includeAll: true, 
426		includeOther: true, 
427		flagDisabled: true, 
428		noMatchText: 'Nothing matched your filter, please click another letter.', 
429		prefixes: ['the','a'] ,
430	});
431
432
433	//===== ShowCode plugin for <pre> tag =====//
434
435	$('.showCode').sourcerer('js html css php'); // Display all languages
436	$('.showCodeJS').sourcerer('js'); // Display JS only
437	$('.showCodeHTML').sourcerer('html'); // Display HTML only
438	$('.showCodePHP').sourcerer('php'); // Display PHP only
439	$('.showCodeCSS').sourcerer('css'); // Display CSS only
440
441
442	
443	
444	
445	//===== Dynamic data table =====//
446
447	oTable = $('#example, #example1, #example2').dataTable({
448		"bJQueryUI": true,
449		"sPaginationType": "full_numbers",
450		"sDom": '<""f>t<"F"lp>'
451	});
452	
453	
454	//===== Form elements styling =====//
455	
456	$("select, input:checkbox, input:radio, input:file").uniform();
457	
458	
459	//===== Form validation engine =====//
460
461	$("#valid").validationEngine();
462	
463
464	//===== Datepickers =====//
465
466	$( ".datepicker" ).datepicker({ 
467		defaultDate: +7,
468		autoSize: true,
469		appendText: '(yyyy-mm-dd)',
470		dateFormat: 'yy-mm-dd',
471	});	
472
473	$( ".datepickerInline" ).datepicker({ 
474		defaultDate: +7,
475		autoSize: true,
476		appendText: '(dd-mm-yyyy)',
477		dateFormat: 'dd-mm-yy',
478		numberOfMonths: 1
479	});	
480
481
482	//===== Progressbar (Jquery UI) =====//
483
484	$( "#progressbar" ).progressbar({
485			value: 37
486	});
487		
488		
489	//===== Tooltip =====//
490		
491	$('.leftDir').tipsy({fade: true, gravity: 'e'});
492	$('.rightDir').tipsy({fade: true, gravity: 'w'});
493	$('.topDir').tipsy({fade: true, gravity: 's'});
494	$('.botDir').tipsy({fade: true, gravity: 'n'});
495
496		
497	//===== Information boxes =====//
498		
499	$(".hideit").click(function() {
500		$(this).fadeTo(200, 0.00, function(){ //fade
501			$(this).slideUp(300, function() { //slide up
502				$(this).remove(); //then remove from the DOM
503			});
504		});
505	});	
506	
507
508	//=====Resizable table columns =====//
509	
510	var onSampleResized = function(e){
511		var columns = $(e.currentTarget).find("th");
512		var msg = "columns widths: ";
513		columns.each(function(){ msg += $(this).width() + "px; "; })
514	};	
515
516	$(".resize").colResizable({
517		liveDrag:true, 
518		gripInnerHtml:"<div class='grip'></div>", 
519		draggingClass:"dragging", 
520		onResize:onSampleResized});
521
522
523	//===== Left navigation submenu animation =====//	
524		
525	$("ul.sub li a").hover(function() {
526	$(this).stop().animate({ color: "#3a6fa5" }, 400);
527	},function() {
528	$(this).stop().animate({ color: "#494949" }, 400);
529	});
530	
531	
532	//===== Image gallery control buttons =====//
533
534	 $(".pics ul li").hover(
535		  function() { $(this).children(".actions").show("fade", 200); },
536		  function() { $(this).children(".actions").hide("fade", 200); }
537	 );
538	
539
540	//===== Color picker =====//
541
542	$('#colorpickerField').ColorPicker({
543		onSubmit: function(hsb, hex, rgb, el) {
544			$(el).val(hex);
545			$(el).ColorPickerHide();
546		},
547		onBeforeShow: function () {
548			$(this).ColorPickerSetColor(this.value);
549		}
550	})
551	.bind('keyup', function(){
552		$(this).ColorPickerSetColor(this.value);
553	});	
554	
555	
556	//===== Autogrowing textarea =====//
557	
558	$(".auto").autoGrow();
559	
560
561	//===== Autotabs. Inline data rows =====//
562
563	$('.onlyNums input').autotab_magic().autotab_filter('numeric');
564	$('.onlyText input').autotab_magic().autotab_filter('text');
565	$('.onlyAlpha input').autotab_magic().autotab_filter('alpha');
566	$('.onlyRegex input').autotab_magic().autotab_filter({ format: 'custom', pattern: '[^0-9\.]' });
567	$('.allUpper input').autotab_magic().autotab_filter({ format: 'alphanumeric', uppercase: true });
568	
569	
570	//===== jQuery UI sliders =====//	
571	
572	$( ".uiSlider" ).slider();
573	
574	$( ".uiSliderInc" ).slider({
575		value:100,
576		min: 0,
577		max: 500,
578		step: 50,
579		slide: function( event, ui ) {
580			$( "#amount" ).val( "$" + ui.value );
581		}
582	});
583	$( "#amount" ).val( "$" + $( ".uiSliderInc" ).slider( "value" ) );
584		
585	$( ".uiRangeSlider" ).slider({
586		range: true,
587		min: 0,
588		max: 500,
589		values: [ 75, 300 ],
590		slide: function( event, ui ) {
591			$( "#rangeAmount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
592		}
593	});
594	$( "#rangeAmount" ).val( "$" + $( ".uiRangeSlider" ).slider( "values", 0 ) +" - $" + $( ".uiRangeSlider" ).slider( "values", 1 ));
595			
596	$( ".uiMinRange" ).slider({
597		range: "min",
598		value: 37,
599		min: 1,
600		max: 700,
601		slide: function( event, ui ) {
602			$( "#minRangeAmount" ).val( "$" + ui.value );
603		}
604	});
605	$( "#minRangeAmount" ).val( "$" + $( ".uiMinRange" ).slider( "value" ) );
606	
607	$( ".uiMaxRange" ).slider({
608		range: "max",
609		min: 1,
610		max: 100,
611		value: 20,
612		slide: function( event, ui ) {
613			$( "#maxRangeAmount" ).val( ui.value );
614		}
615	});
616	$( "#maxRangeAmount" ).val( $( ".uiMaxRange" ).slider( "value" ) );	
617	
618	
619	
620	$( "#eq > span" ).each(function() {
621		// read initial values from markup and remove that
622		var value = parseInt( $( this ).text(), 10 );
623		$( this ).empty().slider({
624			value: value,
625			range: "min",
626			animate: true,
627			orientation: "vertical"
628		});
629	});
630	
631	
632	//===== Breadcrumbs =====//	
633
634	$("#breadCrumb").jBreadCrumb();
635	
636	
637	//===== Autofocus =====//	
638	
639	$('.autoF').focus();
640
641
642	//===== Tabs =====//
643		
644	$.fn.simpleTabs = function(){ 
645	
646		//Default Action
647		$(this).find(".tab_content").hide(); //Hide all content
648		$(this).find("ul.tabs li:first").addClass("activeTab").show(); //Activate first tab
649		$(this).find(".tab_content:first").show(); //Show first tab content
650	
651		//On Click Event
652		$("ul.tabs li").click(function() {
653			$(this).parent().parent().find("ul.tabs li").removeClass("activeTab"); //Remove any "active" class
654			$(this).addClass("activeTab"); //Add "active" class to selected tab
655			$(this).parent().parent().find(".tab_content").hide(); //Hide all tab content
656			var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content
657			$(activeTab).show(); //Fade in the active content
658			return false;
659		});
660	
661	};//end function
662
663	$("div[class^='widget']").simpleTabs(); //Run function on any div with class name of "Simple Tabs"
664
665
666	//===== User nav dropdown =====//		
667
668	$('.dd').click(function () {
669		$('ul.menu_body').slideToggle(200);
670	});
671	
672	$(document).bind('click', function(e) {
673	var $clicked = $(e.target);
674	if (! $clicked.parents().hasClass("dd"))
675		$("ul.menu_body").slideUp(200);
676	});
677	
678
679
680
681	
682	$('.acts').click(function () {
683		$('ul.actsBody').slideToggle(100);
684	});
685	
686	
687	//===== Collapsible elements management =====//
688	
689	$('.exp').collapsible({
690		defaultOpen: 'current',
691		cookieName: 'navAct',
692		cssOpen: 'active corner',
693		cssClose: 'inactive',
694		speed: 300
695	});
696
697	$('.opened').collapsible({
698		defaultOpen: 'opened,toggleOpened',
699		cssOpen: 'inactive',
700		cssClose: 'normal',
701		speed: 200
702	});
703
704	$('.closed').collapsible({
705		defaultOpen: '',
706		cssOpen: 'inactive',
707		cssClose: 'normal',
708		speed: 200
709	});
710	
711
712	//===== Redactor =====//
713	
714	$('#redactor, .redactor, #edit_redactor, .edit_redactor').redactor(
715		{ 
716			imageUpload: '/admin/redactor/image-upload',
717			fileUpload: '/admin/redactor/file-upload'
718		}
719	);
720
721	/*
722	$('#edit_redactor, .edit_redactor').redactor(
723		{ 
724			imageUpload: '/admin/post_image_upload' ,
725			fileUpload: '/admin/redactor_file_upload'
726		}
727	);
728	*/
729
730	
731});

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.