PageSourceSearch

https://www.nawma.sa.gov.au/wp-content/themes/nawma/assets/js/scripts.js?ver=1.0

js nawma.sa.gov.au collected 2026-10-09 00:17:47 UTC 21,576 bytes, 627 lines download raw bytes

1var $ = jQuery.noConflict();
2
3/* Script on ready
4------------------------------------------------------------------------------*/
5jQuery(document).ready(function($){
6
7    $("#send-email-button").on("click", function () {
8
9        let selectedEmails = [];
10
11            // Collect all checked emails
12            $("input[name='email_users[]']:checked").each(function () {
13                selectedEmails.push($(this).val());
14            });
15
16            // No selection → show message
17            if (selectedEmails.length === 0) {
18                $("#email-status").text("Please select at least one member.");
19                return;
20            }
21
22            // UI feedback
23            $("#email-status").text("Sending...");
24            $("#send-email-button").prop("disabled", true);
25
26            // AJAX call
27            $.ajax({
28                url: ajaxurl,
29                method: "POST",
30                data: {
31                    action: "send_member_email",
32                    emails: selectedEmails,
33                    security: $("#send_email_nonce").val()
34                },
35
36                success: function (response) {
37                    if (response.success) {
38                        $("#email-status").text(response.data);
39                    } else {
40                        $("#email-status").text("Error: " + response.data);
41                    }
42                },
43
44                error: function () {
45                    $("#email-status").text("A server error occurred.");
46                },
47
48                complete: function () {
49                    $("#send-email-button").prop("disabled", false);
50                }
51            });
52
53    });
54
55    var templateUrl = '<?= get_bloginfo("template_url"); ?>';
56
57	// $.ajax({
58	//     type:       "GET",
59	//     url:        "https://www.nawma.sa.gov.au/ajaxcomplete.php",
60	//     success:    function(response) {
61	//         $("#collection-area").autocomplete({ source: response });
62	//     }
63	// });
64
65	// $( "#collection-area" ).autocomplete({
66    //     source: function( request, response ) {
67	// 		console.log(request);
68    //         $.ajax({
69    //             url: "https://www.nawma.sa.gov.au/ajaxcomplete.php",
70    //             type: 'post',
71    //             dataType: "json",
72    //             data: {
73    //                 search: request.term
74    //             },
75    //             success: function( data ) {
76    //                 response( data );
77	// 				$('#collection-area').val(data); // display the selected text
78    //             }
79    //         });
80    //     }
81    // });
82	
83	$( "#collection-area" ).autocomplete({
84       source: 'https://www.nawma.sa.gov.au/ajaxcomplete.php',
85     });
86
87    $("#collection-search").on('click', function(){
88        $('.collection-result').css("opacity", 0.5);
89        $('.loader-wrap').show();
90        var ajaxurl = my_ajax_object.ajax_url;
91        var search_term = $('#collection-area').val();
92        var final_search = search_term.split('  ');
93        var cnt_term = final_search.length;
94        var pid = $("#pid").val();
95        if(cnt_term == 2){
96            var fdata = {
97                action: 'collection_day',
98                street: final_search[0],
99                area: final_search[1],
100                pid: pid
101            };
102        }else if(cnt_term = 3){
103            var fdata = {
104                action: 'collection_day',
105                street_no: final_search[0],
106                street: final_search[1],
107                area: final_search[2],
108                pid: pid
109            };
110        }
111        $.ajax({
112            type: "POST",
113            url: ajaxurl,
114            data : fdata,
115            success: function(data){
116                $('.collection-result').css("opacity", 1);
117                $(".collection-result").empty();
118                $(".collection-result").html(data);
119            }
120        });
121        return false;
122    });
123
124    $( ".hard-waste-title.gallery_click" ).click(function() {
125        $(this).parents('.wpb_text_column').next(".wpb_gallery" ).find('ul li:first-child a.prettyphoto').trigger( "click" );
126        return false;
127    });
128
129    $(".services-section .home-services").each(function(){
130        $(this).click(function() {
131            window.location = $(this).find("a").attr("href");
132            return false;
133        });
134    })
135
136    //---- cart open script ----- //
137    $('.social-icons li:first-child a').click(function(){
138        $(this).parent().addClass('open');
139        $('body').addClass('overlay');
140    })
141    $('.close-btn').click(function(){
142        $(this).parent().removeClass('open');
143        $('body').removeClass('overlay');
144    })
145
146    /* Responsive Jquery Navigation */
147    jQuery(document).on('click','.hamburger', function(event){
148        jQuery('#mobilenav').toggleClass('is-open');
149    });
150    jQuery(document).on('click','#mobilenav.is-open .nav-backdrop', function(event){
151        jQuery('#mobilenav').removeClass('is-open');
152    });
153
154    jQuery(document).on('keyup',function(evt) {
155        if (evt.keyCode == 27) {
156            jQuery('.hamburger.is-active').removeClass('is-active');
157            jQuery('#mobilenav.is-show').removeClass('is-show');
158        }
159    });
160
161    var clickable = $('#menu').attr('link-clickable');
162    jQuery('#mobilenav li:has(ul)').addClass('has-sub');
163    jQuery('#mobilenav .has-sub>a').after('<em class="caret">');
164    if(clickable == 'true'){
165        jQuery('#mobilenav .has-sub>a').addClass('trigger-caret').attr('href','javascript:;');
166    }else{
167        jQuery('#mobilenav .has-sub>.caret').addClass('trigger-caret');
168    }
169
170    /* menu open and close on single click */
171    jQuery(document).on('click','#mobilenav .has-sub>.trigger-caret',function(event){
172        var element = $(this).parent('li');
173        if (element.hasClass('is-open')) {
174            element.removeClass('is-open');
175            element.find('li').removeClass('is-open');
176            element.find('ul').slideUp(200);
177        }
178        else {
179            element.addClass('is-open');
180            element.children('ul').slideDown(200);
181            element.siblings('li').children('ul').slideUp(200);
182            element.siblings('li').removeClass('is-open');
183            element.siblings('li').find('li').removeClass('is-open');
184            element.siblings('li').find('ul').slideUp(200);
185        }
186    });
187
188
189
190    ///--------------------------------///
191    jQuery(document).on('click','.any-selector', function(event){
192
193    });
194
195    // As per Gravity form content hide
196    jQuery('#input_5_28 li input[type=radio]').click(function() {
197        if($('#input_5_28 li input[type=radio]').is(':checked')) {
198            jQuery('.hide-content').hide();
199        }
200    });
201
202    jQuery('#input_23_28 li input[type=radio]').click(function() {
203        if($('#input_23_28 li input[type=radio]').is(':checked')) {
204            jQuery('.hide-content').hide();
205        }
206    });
207
208    jQuery('#input_22_28 li input[type=radio]').click(function() {
209        if($('#input_22_28 li input[type=radio]').is(':checked')) {
210            jQuery('.hide-content').hide();
211        }
212    });
213
214    jQuery('#input_18_28 li input[type=radio]').click(function() {
215        if($('#input_18_28 li input[type=radio]').is(':checked')) {
216            jQuery('.hide-content').hide();
217        }
218    });
219    
220     jQuery('#choice_44_28_0').click(function() {
221        if($('#choice_44_28_0').is(':checked')) {
222            jQuery('.hide-content').hide();
223        }
224    });
225    jQuery('#choice_44_28_0').click(function() {
226        if($('#choice_44_28_0').is(':checked')) {
227            jQuery('.our-councils-block').hide();
228        }
229    });
230     jQuery('#choice_44_43_1').click(function() {
231        if($('#choice_44_43_1').is(':checked')) {
232            jQuery('.our-councils-block').hide();
233        }
234    });
235    
236    jQuery('#choice_44_28_1').click(function() {
237        if($('#choice_44_28_1').is(':checked')) {
238            jQuery('.our-councils-block').show();
239        }
240    });
241     jQuery('#choice_44_43_0').click(function() {
242        if($('#choice_44_43_0').is(':checked')) {
243            jQuery('.our-councils-block').show();
244        }
245    });
246       jQuery('#choice_44_43_0').click(function() {
247        if($('#choice_44_43_0').is(':checked')) {
248            jQuery('.hide-content').hide();
249        }
250    });
251    
252    
253    
254    jQuery('#choice_44_43_1').click(function() {
255        if($('#choice_44_43_1').is(':checked')) {
256            jQuery('.hide-content-form').hide();
257        }
258    });
259    jQuery('#choice_44_64_1').click(function() {
260        if($('#choice_44_64_1').is(':checked')) {
261            jQuery('.hide-content-form').hide();
262        }
263    });
264    jQuery('#choice_44_64_0').click(function() {
265        if($('#choice_44_64_0').is(':checked')) {
266            jQuery('.hide-content-form').show();
267        }
268    });
269    
270    //  jQuery('#choice_49_43_0').click(function() {
271    //     if($('#choice_49_43_0').is(':checked')) {
272    //         jQuery('.hide-content-form').show();
273    //     }
274    // });
275    
276      jQuery('#choice_49_28_1').click(function() {
277        if($('#choice_49_28_1').is(':checked')) {
278            jQuery('.hide-content-form').hide();
279        }
280    });
281       jQuery('#choice_49_43_1').click(function() {
282        if($('#choice_49_43_1').is(':checked')) {
283            jQuery('.hide-content-form').hide();
284        }
285    });
286    jQuery('#choice_49_67_0').click(function() {
287        if($('#choice_49_67_0').is(':checked')) {
288            jQuery('.hide-content-form').show();
289        }
290    })
291     jQuery('#choice_49_67_1').click(function() {
292        if($('#choice_49_67_1').is(':checked')) {
293            jQuery('.hide-content-form').hide();
294        }
295    })
296    
297    
298      jQuery('#choice_49_28_1').click(function() {
299        if($('#choice_49_28_1').is(':checked')) {
300            jQuery('.hide-content').show();
301        }
302    });
303       jQuery('#choice_49_28_0').click(function() {
304        if($('#choice_49_28_0').is(':checked')) {
305            jQuery('.hide-content').hide();
306        }
307    });
308    
309    //   jQuery('#choice_48_43_0').click(function() {
310    //     if($('#choice_48_43_0').is(':checked')) {
311    //         jQuery('.hide-content-form').show();
312    //     }
313    // });
314      jQuery('#choice_48_70_0').click(function() {
315        if($('#choice_48_70_0').is(':checked')) {
316            jQuery('.hide-content-form').show();
317        }
318    });
319    
320     jQuery('#choice_48_43_1').click(function() {
321        if($('#choice_48_43_1').is(':checked')) {
322            jQuery('.hide-content-form').hide();
323        }
324    });
325       jQuery('#choice_48_70_1').click(function() {
326        if($('#choice_48_70_1').is(':checked')) {
327            jQuery('.hide-content-form').hide();
328        }
329    });
330    
331    
332     jQuery('#choice_44_43_1').click(function() {
333        if($('#choice_44_43_1').is(':checked')) {
334            jQuery('.hide-content').hide();
335        }
336    });
337
338    
339    //   jQuery('#choice_44_43_0').click(function() {
340    //     if($('#choice_44_43_0').is(':checked')) {
341    //         jQuery('.hide-content-form').show();
342    //     }
343    // });
344         jQuery('#choice_48_28_1').click(function() {
345        if($('#choice_48_28_1').is(':checked')) {
346            jQuery('.hide-content-form').hide();
347        }
348    });
349  
350   
351      jQuery('#choice_44_43_1').click(function() {
352        if($('#choice_44_43_1').is(':checked')) {
353            jQuery('.hide-content').hide();
354        }
355    });
356     jQuery('#choice_48_28_1').click(function() {
357        if($('#choice_48_28_1').is(':checked')) {
358            jQuery('.hide-content').show();
359        }
360    });
361     jQuery('#choice_48_28_0').click(function() {
362        if($('#choice_48_28_0').is(':checked')) {
363            jQuery('.hide-content').hide();
364        }
365    });
366    
367    
368   jQuery('#choice_44_28_1').click(function() {
369        if($('#choice_44_28_1').is(':checked')) {
370            jQuery('.hide-content-form').hide();
371        }
372    });
373     
374   jQuery('#choice_44_28_1').click(function() {
375        if($('#choice_44_28_1').is(':checked')) {
376            jQuery('.hide-content').show();
377        }
378    });
379
380
381
382    // ===== Scroll to Top ====
383    $(window).scroll(function() {
384        if ($(this).scrollTop() >= 50) {        // If page is scrolled more than 50px
385            $('#return-to-top').fadeIn(200);    // Fade in the arrow
386        } else {
387            $('#return-to-top').fadeOut(200);   // Else fade out the arrow
388        }
389    });
390    $('#return-to-top').click(function() {      // When arrow is clicked
391        $('body,html').animate({
392            scrollTop : 0                       // Scroll to top of body
393        }, 500);
394    });
395
396    /* match height function */
397    $('.match-height').matchHeight();
398
399    // Search box toggle
400    $('.nawma-search-icon img').click(function (e) {
401        $('.nawma-search-form').stop(true).slideToggle();
402    });
403    $(document).click(function (e) {
404        if (!$(e.target).closest('.nawma-search-icon img, .nawma-search-form').length) {
405            $('.nawma-search-form').stop(true).slideUp();
406        }
407    });
408
409    // Add placeholder to search form
410    $('.nawma-search-form #searchform #s').attr("placeholder", "Search here...");
411    $('.nawma-search-form-mobile #searchform #s').attr("placeholder", "Search here...");
412
413    /** additional bin request - start **/
414	function makeid(length) {
415	    var result           = [];
416	    var characters       = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
417	    var charactersLength = characters.length;
418	    for ( var i = 0; i < length; i++ ) {
419	      result.push(characters.charAt(Math.floor(Math.random() * charactersLength)));
420	   	}
421	   	return result.join('');
422	}
423
424	$(document).on('change', '.rates-payment-options input[type=radio][name=input_21]', function() {
425		var payment_option = $(this).val();
426		var city = $(".requested_city input[name=input_33]").val();
427		var total_amount = Math.trunc($(".total_charge input[name=input_5]").val());
428		if(payment_option == 'Pay online with Credit Card'){
429			if(city == 'Playford'){
430				var city_init = 'PL-';
431				var final_refer = city_init + makeid(4) + total_amount;
432				$("input[name=input_44]").val(final_refer);
433			}else if (city == 'Gawler') {
434				var city_init = 'GA-';
435				var final_refer = city_init + makeid(4) + total_amount;
436				$("input[name=input_45]").val(final_refer);
437			}else if (city == 'Salisbury') {
438				var city_init = 'SA-';
439				var final_refer = city_init + makeid(4) + total_amount;
440				$("input[name=input_45]").val(final_refer);
441			}
442		}
443	});
444
445	
446	//  FOGO Bin Form 
447	$(document).on('change', '.additional-bin-payment input[type=radio][name=input_32]', function() {
448		 if (!$(".green-waste-bin")[0]){
449    		var payment_option = $(this).val();
450    		var city = $(".requested_city input[name=input_43]").val();
451    		//var total_amount = Math.trunc($("input[name=input_32]").val());
452            var total_amount = $("input[name=input_32]").val();
453            var get_total_amount = parseInt(total_amount.replace(/[^0-9.]/g, ""));
454    		if (city == 'Gawler') {
455    			var city_init = 'GA-';
456    			var final_refer = city_init + makeid(5) + get_total_amount;
457    			$("input[name=input_44]").val(final_refer);
458                $("input[name=input_46]").val(get_total_amount);
459    		}else if (city == 'Playford') {
460    			var city_init = 'PL-';
461    			var final_refer = city_init + makeid(5) + get_total_amount;
462    			$("input[name=input_44]").val(final_refer);
463    			$("input[name=input_46]").val(get_total_amount);
464		    }
465		}
466		
467	});
468	
469	
470	
471	$(document).on('change', '.additional-bin-payment input[type=radio][name=input_51]', function() {
472		
473		var payment_option = $(this).val();
474		var city = $(".requested_city input[name=input_43]").val();
475		//var total_amount = Math.trunc($("input[name=input_32]").val());
476        var total_amount = $("input[name=input_51]:checked").val().split("-");
477        var get_total_amount = parseInt(total_amount[1].replace(/[^0-9.]/g, ""));
478
479		if(city == 'Playford'){
480			var city_init = 'PL-';
481			var final_refer = city_init + makeid(5) + get_total_amount;
482			$("input[name=input_44]").val(final_refer);
483            $("input[name=input_46]").val(get_total_amount);
484            var get_price_currency = $.trim( total_amount[1] );
485            $("input[name=input_55]").val(get_price_currency);
486		}
487		
488	});
489	
490    // addition bin request form ajax
491    $(document).on('change', '.addition-bin-request input[type=radio][name=input_1]', function() {
492	  var bin_request_value = $(this).val();
493      var bin_request_text = $(this).next().find('div span strong').text();
494	  bin_request_text = bin_request_text.replace(/ *\([^)]*\) */g, ' ');
495      var city = $('.requested_city input').val();
496      var ajaxurl = my_ajax_object.ajax_url;
497      $('#bin-request').text( bin_request_text );
498      $.ajax({
499    		url: ajaxurl,
500    		type: 'POST',
501    		dataType : 'json',
502    		data: {
503				action : 'get_bin_rates',
504				bin : bin_request_value,
505				city : city,
506        },
507        cache: false,
508        beforeSend: function() {
509    			$('.gform_wrapper').append('<div class="loader"><img src=" ' + my_ajax_object.ajax_loader + ' " /></div>');
510    		},
511    		complete: function() {
512    			$('.gform_wrapper .loader').remove();
513    		},
514    		success: function( response ){
515    			if( response.status ){
516                    var registration_charge = response.data.registration;
517                    var supply_charge = response.data.supply;
518                    var total_charge = +registration_charge + +supply_charge;
519                    registration_charge = parseFloat( registration_charge ).toFixed(2);
520                    supply_charge = parseFloat( supply_charge ).toFixed(2);
521                    total_charge = parseFloat( total_charge ).toFixed(2);
522                    $('.registration_charge input').val(registration_charge);
523                    $('.supply_charge input').val(supply_charge);
524                    $('.total_charge input').val(total_charge);
525                    $('li.gf_readonly input').attr('readonly','readonly');
526                    if( registration_charge == 0 || supply_charge == 0 ){
527                        $('.registration_charge').addClass('gf_invisible');
528                        $('.supply_charge').addClass('gf_invisible');
529                    } else {
530                        $('.registration_charge').removeClass('gf_invisible');
531                        $('.supply_charge').removeClass('gf_invisible');
532                    }
533                    $('.total_charge').removeClass('gf_invisible');
534                    var payment = jQuery('.rates-payment-options input[type=radio][name=input_21]:checked').val();
535                    //if(payment == 'Pay online with Credit Card'){
536                        if(city == 'Playford'){
537                            var city_init = 'PL-';
538                            var final_refer = city_init + makeid(4) + Math.trunc(total_charge);
539                            jQuery("input[name=input_44]").val(final_refer);
540                        }else if (city == 'Gawler') {
541                            var city_init = 'GA-';
542                            var final_refer = city_init + makeid(4) + Math.trunc(total_charge);
543                            jQuery("input[name=input_45]").val(final_refer);
544                        }else if (city == 'Salisbury') {
545                            var city_init = 'SA-';
546                            var final_refer = city_init + makeid(4) + Math.trunc(total_charge);
547                            jQuery("input[name=input_45]").val(final_refer);
548                        }
549                    //}
550    			}
551    		},
552    	});
553    });
554
555    // chnage submit button on payment option change
556    $(document).on('change', '.rates-payment-options input[type=radio]', function() {
557      var payment_val = this.value;
558      if( payment_val == 'Pay online with Credit Card' ) {
559        $('.gform_footer input[type=submit]').val('Pay Online');
560      } else {
561        $('.gform_footer input[type=submit]').val('Invoice Me');
562      }
563    });
564
565    // make read only amount field after form validation
566    $(document).bind('gform_post_render',function(){
567      $('li.gf_readonly input').attr('readonly','readonly');
568    });
569
570    /** additional bin request - end **/
571
572
573});
574
575jQuery(document).ready(function ($) {
576
577    $('a.corp-doc-link').on('click', function (e) {
578        e.preventDefault();
579
580        const fileURL  = $(this).data('file-url');
581        const title    = $(this).data('title');
582        const category = $(this).data('category');
583
584        // AJAX request to log download
585        $.ajax({
586            url: my_ajax_object.ajax_url,
587            type: 'POST',
588            data: {
589                action: 'rs_log_document_download',
590                file_url: fileURL,
591                title: title,
592                category: category
593            },
594            complete: function () {
595                // Always open in new tab (success OR fail)
596                window.open(fileURL, '_blank');
597            }
598        });
599
600    });
601
602});
603
604/* Script on load
605------------------------------------------------------------------------------*/
606$(window).load(function() {
607    // page is fully loaded, including all frames, objects and images
608});
609
610/* Script on scroll
611------------------------------------------------------------------------------*/
612$(window).scroll(function() {
613
614});
615
616/* Script on resize
617------------------------------------------------------------------------------*/
618$(window).resize(function() {
619
620});
621
622/* Script all functions
623------------------------------------------------------------------------------*/
624
625$(window).on("load resize",function(){
626
627})

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.