PageSourceSearch

https://www.ndp.ca/sites/default/files/js/js_7x6Ml9ZbTw3mnANfjSHHm6SH6D2PYutFvp6g5nr04GM.js

js ndp.ca collected 2026-09-24 08:44:52 UTC 12,316 bytes, 343 lines download raw bytes

1jQuery(function(){
2
3  jQuery('.page--contact .contact-form').bind('success',function(){
4    // show hide
5    console.log('something');
6    jQuery('.page-text').hide();
7    jQuery('.contact-form').hide();   
8    jQuery('.thankyou-text').show();    
9    jQuery('.share-links').show();    
10    // track
11    track.track_action('NDPCA_CONTACT_PAGE','CONTACT_US_SENT');
12  });
13
14});
15
16jQuery(function($){
17
18  $('input.phone-input').removeClass('validate-required');
19  $('input.postalcode-input').removeClass('validate-required');    
20
21}); 
22;
23window.amex_support_enabled = true;
24;
25var MTIProjectId='0ea9c285-4095-472b-bc40-edc3449d29fd';
26jQuery(function() {
27	var mtiTracking = document.createElement('script');
28	mtiTracking.type='text/javascript';
29	mtiTracking.async='true';
30	mtiTracking.src=('https:'==document.location.protocol?'https:':'http:')+'//fast.fonts.com/t/trackingCode.js';
31	(document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild( mtiTracking );
32});
33;
34(function(init){
35  
36  var $ = jQuery;
37  
38  // array that holds all init functions
39  var all_block_rerun_functions = [];
40  
41  // method used in block js files 
42  init.block = function(block_selector,block_init_func) {
43    // debug output
44    // console.log("Block: "+block_selector);
45    // turn the init function into a rerun function
46    var block_rerun_function = function(root_obj) {
47      // get objects below the root that match selector
48      var selected_objs = $(root_obj).filter(block_selector).add( $(root_obj).find(block_selector) );
49      // run init function on all seleced objects
50      $(selected_objs).each(function(block_index,block_obj){
51        // if this block has been inited, skip
52        if ( $(block_obj).data('inited')) return;
53        // add tpl path data
54        var tpl_selector = block_selector.replace('.','').replace('\\\/','/');
55        $(block_obj).data('tpl',tpl_selector);
56        // run init function - pass $, block_obj, block_index
57        block_init_func($,block_obj,block_index);
58        // set inited to true
59        $(block_obj).data('inited',true);
60        // debug output
61        // console.log("Inited: "+block_selector);
62      });    
63    }
64    // add newly created rerun function to the list of all rerun functions for later use
65    all_block_rerun_functions.push( block_rerun_function );
66    // ask $ to run this rerun function on HTML for the first time once page is ready 
67    $(function(){ block_rerun_function("html"); })
68     
69  }
70  
71  // method used on blocks injected asyncronously
72  init.async = function(root_obj) {
73    // debug output
74    // console.log("Async Init...");
75    // loop through all rerun functions and run them on the root obj
76    for(index in all_block_rerun_functions) {
77      // get block rerun function
78      block_rerun_function = all_block_rerun_functions[index];
79      // run this function on the provided root object
80      block_rerun_function(root_obj);
81    }
82  }
83    
84})(window.init = {});
85;
86jQuery(function($){
87
88	// function resize_min_width() {
89	// 	$('.rich .asset--standard-fields > [js-field-min-width]').removeAttr('js-field-min-width-applied');
90	// 	$('.rich .asset--standard-fields > [js-field-min-width]').each(function(index,obj){
91	// 		if ( $(obj).is('[js-field-min-width-applied]') ) return;
92	// 		var nextobj = $(obj).next();
93	// 		if ( $(nextobj).is('[js-field-min-width]')==false) return;
94	// 		$(obj).css({'width':'','display':'block','margin-right':''});
95	// 		$(nextobj).css({'width':'','display':'block','margin-right':''});
96	// 		var width = $(obj).width();
97	// 		var js_field_min_width = parseInt( $(obj).attr('js-field-min-width') );
98	// 		var next_js_field_min_width = parseInt( $(nextobj).attr('js-field-min-width') );
99	// 		var combined_min_width = js_field_min_width+next_js_field_min_width;
100	// 		if (combined_min_width+10 < width) {
101	// 			var field1width = (width-10)*(js_field_min_width/combined_min_width);
102	// 			var field2width = (width-10)*(next_js_field_min_width/combined_min_width);
103	// 			$(obj).css({'width':field1width+'px','display':'inline-block','margin-right':'10px'}).attr('js-field-min-width-applied','1');;
104	// 			$(nextobj).css({'width':field2width+'px','display':'inline-block'}).attr('js-field-min-width-applied','1');;
105	// 		}
106	// 	});		
107	// }
108	// $(window).resize(resize_min_width);
109	// resize_min_width();
110
111
112	// // append in-progress animation div to body
113	// $('<div class="in-progress-animation"><div class="in-progress-animation-inner"></div>').appendTo('body');
114	// // form validate and track
115	// $('.asset--standard-fields form').bind('submit',function(){
116	// 	// validate form
117	// 	var form = this;
118	//   	var valid = validate_form(form);
119	//   	if (!valid) return false;
120	// 	// show progress animation
121	//   	$('.in-progress-animation').show();	
122	//   	// ajax submit form
123	//   	ajax_submit_form(form,function(){
124	//   		// fade out
125	//   		$('.in-progress-animation').slideUp(100);
126	//   		$('.page-overlay').fadeIn(500);
127	//   		//track.track_action('Video AYN - TV Ad 1','Submit Signon - Success');
128	//   	});	
129	// 	// return false
130	// 	return false;
131	// });
132
133	// // # 
134	// // # helpers
135	// // #
136
137	// function ajax_submit_form(form,success) {
138 //  		var data = $(form).serialize()+'&json=1';
139	//   	var action = $(form).attr('action');
140	//   	//alert(action+' : '+data);
141	// 	$.ajax({'type':'POST','url':action,'data':data,'success':function(data){ 
142	// 		try { 
143	// 		    var dataobj = $.parseJSON(data);
144	// 		    if (dataobj.success) { success(); }  else { alert(data); }
145	// 		} 
146	// 		catch(e) { alert(data); }}
147	// 	});		
148	// }
149
150});
151
152
153;
154;
155jQuery(function () {
156  //mobile navigation
157  var  jQuerytoggleButton = jQuery('.block--home-navbar .nav-hamburger'),
158  jQuerymenuWrap = jQuery(' .block--home-navbar .container-wrap'),
159  jQueryscroll = jQuery(".wrapper--central");
160
161  jQuerytoggleButton.on('click', function(){
162    jQuery(this).toggleClass('button-open');
163    jQuerymenuWrap.toggleClass('menu-show');
164  });
165  
166  //desktop navigation
167  jQuery(".block--home-navbar .container-link-menu").on('click keypress', function(ev) {
168    var is_key_press = (ev.type=='keypress');
169    if (is_key_press) {
170      let keycode = (event.keyCode ? event.keyCode : event.which);
171      let is_enter_key = (keycode==13);
172      if (!is_enter_key) return;
173      ev.preventDefault();
174    }
175    jQuery(".block--home-navbar .menu-overlay").show();
176    jQuery(".block--home-navbar .menu-contents").slideDown(400).addClass("menu-open");
177    if (is_key_press) jQuery(".block--home-navbar .close-menu").focus();
178  });
179  jQuery(".container-dropdown .close-menu, .container-dropdown .menu-overlay").on('click keypress', function(ev) {
180    var is_key_press = (ev.type=='keypress');
181    if (is_key_press) {
182      let keycode = (event.keyCode ? event.keyCode : event.which);
183      let is_enter_key = (keycode==13);
184      if (!is_enter_key) return;
185      ev.preventDefault();
186    }
187    jQuery(".block--home-navbar .menu-overlay").hide();
188    jQuery(".block--home-navbar .menu-contents").slideUp(400).removeClass("menu-open");    
189    if (is_key_press) jQuery(".block--home-navbar .container-link-menu").focus();
190  });
191  
192
193  jQuery('.block--home-navbar .container-link-menu').on('click', function(ev){
194    ev.preventDefault();
195    jQuery(this).next('.dropdown').toggle();
196  });
197
198  function update_donate_bar() {
199    var distanceFromTop = jQuery(document).scrollTop();
200    if (distanceFromTop >= jQuery('.block--home-navbar  .nav-bar-menu-container').height())
201    {
202        jQuery('.block--home-navbar #donate-bar').fadeIn(400).addClass('fixed');
203    }
204    else
205    {
206        jQuery('.block--home-navbar #donate-bar').fadeOut(0).removeClass('fixed');
207    }
208    if(distanceFromTop >= 10) {
209      jQuery('.block--home-navbar nav').addClass('scrolling');
210    } else {
211      jQuery('.block--home-navbar nav.scrolling').removeClass('scrolling');
212    }
213  }
214
215  //donate bar
216  jQuery(window).scroll(function() {
217    update_donate_bar();
218  });
219  update_donate_bar();
220
221});
222;
223;
224jQuery(function($){
225
226  $('.block--home-signup-donate--signup form').bind('success',function(){
227
228    window.location = $('.block--home-signup-donate--signup .js-donate-link').data('link');
229
230  });
231
232});
233;
234jQuery(function($){
235
236  $('.block--home-signup-donate--donate .donate-amounts .donate-btn').bind('click',function(ev){
237    $('.block--home-signup-donate--donate .donate-amounts .donate-btn').removeClass('selected');
238    $(this).addClass('selected');
239    ev.preventDefault();
240  });
241  $('.block--home-signup-donate--donate .donate-button .donate-btn').bind('click',function(ev){
242    var ask = $('.block--home-signup-donate--donate .donate-amounts .donate-btn.selected').data('ask');
243    var donate_link = $(this).attr('href');
244    donate_link += (donate_link.indexOf('?') == -1) ? '?' : '&';
245    donate_link += 'ask='+ask;
246    window.location = donate_link;
247    ev.preventDefault();
248  });
249
250});
251;
252;
253jQuery(function() {
254
255    // append in-progress animation div to body
256    jQuery('<div class="in-progress-animation"><div class="in-progress-animation-inner"></div>').appendTo('body');
257    // form validate and track
258    jQuery('.asset--standard-form form').each(function(index, obj) {
259
260        jQuery(obj).bind('submit', function() {
261            // validate form
262            var form = this;
263            var valid = validate_form(form);
264            if (!valid) {
265                jQuery(form).trigger('validate-error', [form]);
266                return false;
267            }
268            // show progress animation
269            jQuery('.in-progress-animation').show();
270            jQuery(form).find('.submit-text').addClass('fade');
271            jQuery(form).find('.process-overlay').show();
272            jQuery(form).find('.submit-button').prop('disabled', true);
273            // postalcode cookie
274            var postalcode = jQuery(form).find('[name=postalcode]').val();
275            if (postalcode)
276                if (visitor)
277                    if (visitor.save_postalcode) { visitor.save_postalcode(postalcode); }
278                    // email cookie
279            var email = jQuery(form).find('[name=email]').val();
280            if (email)
281                if (visitor)
282                    if (visitor.save_email) { visitor.save_email(email); }
283                    // ajax submit form
284            ajax_submit_form(form,
285                function(dataobj) {
286                    // trigger success
287                    jQuery(form).trigger('success', [dataobj]);
288                },
289                function(dataobj) {
290                    console.log(dataobj);
291                    // hide progress animation
292                    jQuery('.in-progress-animation').slideUp(100);
293                    jQuery(form).find('.submit-text').removeClass('fade');
294                    jQuery(form).find('.process-overlay').fadeOut(1500);
295                    jQuery(form).find('.submit-button').prop('disabled', false);
296                }
297            );
298            // return false
299            return false;
300        });
301
302    });
303
304    // # 
305    // # helpers
306    // #
307
308    function ajax_submit_form(form, success, complete) {
309        var data = $(form).serialize() + '&json=1';
310        var action = $(form).attr('action');
311        //console.log("Submitting to " + action);
312        //console.log(data);
313        jQuery.ajax({
314            'type': 'POST',
315            'url': action,
316            'data': data,
317            'success': function(data) {
318                var successflag = false;
319                // try parsing json
320                try {
321                    //console.log("Got response, parsing json");
322                    var dataobj = jQuery.parseJSON(data);
323                    //console.log(dataobj);
324                    successflag = dataobj.success;
325                }
326                // catch json parsing error
327                catch (e) {
328                    console.log("JSON parse error: " + data);
329                    alert(data);
330                }
331                // log success flag
332                //console.log("Success: "+successflag); 
333                // on success run success function
334                if (successflag) { success(dataobj); }
335                //
336                if (complete) complete(dataobj);
337                // on error alert data
338                else { alert(data); }
339            }
340        });
341    }
342
343});;

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.