9952b84b by Jeff Balicki

broker clean up

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 77dba185
...@@ -168,8 +168,7 @@ if (function_exists(clean_custom_menus())) { ...@@ -168,8 +168,7 @@ if (function_exists(clean_custom_menus())) {
168 </div> 168 </div>
169 <script> 169 <script>
170 (function($) { 170 (function($) {
171 jQuery(document).ready( 171 jQuery( document ).ready(function( $ ) {
172 function($) {
173 console.log($.cookie('dialog_cookie_new')); 172 console.log($.cookie('dialog_cookie_new'));
174 if ($.cookie('dialog_cookie_new') == null) { 173 if ($.cookie('dialog_cookie_new') == null) {
175 $(window).resize( 174 $(window).resize(
...@@ -333,36 +332,7 @@ if (function_exists(clean_custom_menus())) { ...@@ -333,36 +332,7 @@ if (function_exists(clean_custom_menus())) {
333 } 332 }
334 }); 333 });
335 334
336 // $('.bxslider2').bxSlider({ 335
337 // mode: 'fade',
338 // captions: true,
339 // auto: true,
340 // autoStart: true,
341 // pause: 9000,
342 // controls: false
343 // });
344
345 // $('.bxslider').bxSlider({
346 // mode: 'fade',
347 // captions: true,
348 // auto: true,
349 // autoStart: true,
350 // pause: 9000,
351 // onSlideBefore: function($slideElement, oldIndex, newIndex) {
352 // var $bxControls = $('.bx-controls');
353 // $bxControls.fadeOut(10);
354 // },
355 // onSlideAfter: function($slideElement, oldIndex, newIndex) {
356 // setTimeout(function() {
357 // setSliderControlPosition(newIndex);
358 // }, 100);
359 // },
360 // onSliderLoad: function(currentIndex) {
361 // setTimeout(function() {
362 // setSliderControlPosition(currentIndex);
363 // }, 100);
364 // }
365 // });
366 336
367 $(window).resize(function() { 337 $(window).resize(function() {
368 if ($(this).width() < 701) { 338 if ($(this).width() < 701) {
...@@ -384,29 +354,6 @@ if (function_exists(clean_custom_menus())) { ...@@ -384,29 +354,6 @@ if (function_exists(clean_custom_menus())) {
384 smallMenu.css('zIndex', 0); 354 smallMenu.css('zIndex', 0);
385 }, 500); 355 }, 500);
386 }); 356 });
387 }
388 );
389
390 function setSliderControlPosition(index) {
391 var currentItem = $('.bxslider li').eq(index);
392 var $wrapper = $(currentItem).find('.video-wrapper');
393 var height = $wrapper.height();
394 var $sliderControls = $('.slider-controls');
395 $sliderControls.height(height);
396
397 var dummyControlPosition = $sliderControls.find('.slider-controls-direction').position().top;
398 var dummyPagerPosition = $sliderControls.find('.slider-pager').position().top;
399 var $bxControls = $('.bx-controls');
400 var $bxControlsDirectionPrev = $bxControls.find('.bx-controls-direction .bx-prev');
401 var $bxControlsDirectionNext = $bxControls.find('.bx-controls-direction .bx-next');
402 var $bxPager = $('.bx-pager');
403
404 $bxControlsDirectionPrev.css('top', dummyControlPosition);
405 $bxControlsDirectionNext.css('top', dummyControlPosition);
406 $bxPager.css('top', dummyPagerPosition);
407 $bxControls.fadeIn(10);
408 }
409
410 357
411 $("#read-more-dialog").dialog({ 358 $("#read-more-dialog").dialog({
412 width: "auto", 359 width: "auto",
...@@ -435,6 +382,31 @@ if (function_exists(clean_custom_menus())) { ...@@ -435,6 +382,31 @@ if (function_exists(clean_custom_menus())) {
435 $(".ui-dialog-title").hide(); 382 $(".ui-dialog-title").hide();
436 }); 383 });
437 384
385 }
386 );
387
388 function setSliderControlPosition(index) {
389 var currentItem = $('.bxslider li').eq(index);
390 var $wrapper = $(currentItem).find('.video-wrapper');
391 var height = $wrapper.height();
392 var $sliderControls = $('.slider-controls');
393 $sliderControls.height(height);
394
395 var dummyControlPosition = $sliderControls.find('.slider-controls-direction').position().top;
396 var dummyPagerPosition = $sliderControls.find('.slider-pager').position().top;
397 var $bxControls = $('.bx-controls');
398 var $bxControlsDirectionPrev = $bxControls.find('.bx-controls-direction .bx-prev');
399 var $bxControlsDirectionNext = $bxControls.find('.bx-controls-direction .bx-next');
400 var $bxPager = $('.bx-pager');
401
402 $bxControlsDirectionPrev.css('top', dummyControlPosition);
403 $bxControlsDirectionNext.css('top', dummyControlPosition);
404 $bxPager.css('top', dummyPagerPosition);
405 $bxControls.fadeIn(10);
406 }
407
408
409
438 410
439 411
440 })(jQuery); 412 })(jQuery);
......
...@@ -34,25 +34,15 @@ function theme_broker_enqueue_scripts() ...@@ -34,25 +34,15 @@ function theme_broker_enqueue_scripts()
34 wp_enqueue_style('fontawsome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css'); 34 wp_enqueue_style('fontawsome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css');
35 wp_enqueue_style('Material', 'https://fonts.googleapis.com/icon?family=Material+Icons'); 35 wp_enqueue_style('Material', 'https://fonts.googleapis.com/icon?family=Material+Icons');
36 wp_enqueue_style('bxslider', get_bloginfo('template_url') . '/styles/vendor/jquery.bxslider.css'); 36 wp_enqueue_style('bxslider', get_bloginfo('template_url') . '/styles/vendor/jquery.bxslider.css');
37 wp_enqueue_script( 37
38 'bxslider', 38
39 get_bloginfo('template_url') . '/scripts/vendor/jquery.bxslider.js', 39 wp_enqueue_script( 'bxslider', get_bloginfo('template_url') . '/scripts/vendor/jquery.bxslider.js',[], "0.0.1", true );
40 [],
41 "0.0.1",
42 true
43 );
44 wp_enqueue_script('cookies', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js'); 40 wp_enqueue_script('cookies', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js');
45 wp_enqueue_script('moblie_menu', get_bloginfo('template_url') . '/scripts/moblie_menu.js'); 41 wp_enqueue_script('moblie_menu', get_bloginfo('template_url') . '/scripts/moblie_menu.js');
46 wp_enqueue_script('jQmobile', get_bloginfo('template_url') . '/scripts/vendor/jquery.mobile.custom.min.js'); 42 wp_enqueue_script('jQmobile', get_bloginfo('template_url') . '/scripts/vendor/jquery.mobile.custom.min.js');
47 wp_enqueue_script('colorbox', '//cdnjs.cloudflare.com/ajax/libs/jquery.colorbox/1.6.4/jquery.colorbox.js'); 43 wp_enqueue_script('colorbox', '//cdnjs.cloudflare.com/ajax/libs/jquery.colorbox/1.6.4/jquery.colorbox.js');
48 wp_enqueue_script( 44 wp_enqueue_script('bootstrap','https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js',[], false, true );
49 'bootstrap', 45 wp_enqueue_script('jquery-ui', get_bloginfo('template_url') . '/scripts/jquery-ui.min.js', [], false, true);
50 'https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js',
51 [],
52 false,
53 true
54 );
55
56 // qTip 46 // qTip
57 wp_enqueue_style('qtip', get_bloginfo('template_url') . '/styles/vendor/jquery.qtip.css'); 47 wp_enqueue_style('qtip', get_bloginfo('template_url') . '/styles/vendor/jquery.qtip.css');
58 wp_enqueue_script('qtip', get_bloginfo('template_url') . '/scripts/vendor/jquery.qtip.js', [], "0.0.1", true); 48 wp_enqueue_script('qtip', get_bloginfo('template_url') . '/scripts/vendor/jquery.qtip.js', [], "0.0.1", true);
...@@ -69,13 +59,7 @@ function theme_broker_enqueue_scripts() ...@@ -69,13 +59,7 @@ function theme_broker_enqueue_scripts()
69 59
70 // Tooltipster 60 // Tooltipster
71 wp_enqueue_style('tooltipster', get_bloginfo('template_url') . '/styles/vendor/tooltipster.bundle.min.css'); 61 wp_enqueue_style('tooltipster', get_bloginfo('template_url') . '/styles/vendor/tooltipster.bundle.min.css');
72 wp_enqueue_script( 62 wp_enqueue_script( 'tooltipster', get_bloginfo('template_url') . '/scripts/vendor/tooltipster.bundle.min.js',[], "0.0.1",true );
73 'tooltipster',
74 get_bloginfo('template_url') . '/scripts/vendor/tooltipster.bundle.min.js',
75 [],
76 "0.0.1",
77 true
78 );
79 wp_enqueue_script('show-more', get_bloginfo('template_url') . '/scripts/show-more.js', [], "0.0.3", true); 63 wp_enqueue_script('show-more', get_bloginfo('template_url') . '/scripts/show-more.js', [], "0.0.3", true);
80 wp_enqueue_script('accessibility_script', get_bloginfo('template_url') . '/scripts/accessibility.js', true); 64 wp_enqueue_script('accessibility_script', get_bloginfo('template_url') . '/scripts/accessibility.js', true);
81 65
...@@ -150,34 +134,7 @@ function theme_broker_enqueue_scripts() ...@@ -150,34 +134,7 @@ function theme_broker_enqueue_scripts()
150 134
151 } 135 }
152 136
153 add_action('wp_enqueue_scripts', 'theme_enqueue_scripts');
154 function theme_enqueue_scripts()
155 {
156
157 137
158 if (
159 is_page_template("broker_landing_page.php")
160 || is_page_template("broker_pages.php")
161 || is_page_template("login-page.php")
162 || is_page_template("default.php")
163 || is_page_template("general.php")
164 || is_page_template("SearchWpResult.php")
165 || is_page_template("broker_notifications_archive.php")
166 || is_page_template("broker_account_pages.php")
167 || is_page_template("marketing_masters.php")
168 || get_post_type() == 'notifications'
169 || get_post_type() == 'sfwd-courses'
170 || get_post_type() == 'sfwd-lessons'
171 || get_post_type() == 'sfwd-quiz'
172 || get_post_type() == 'badges'
173
174 ) {
175
176 wp_enqueue_script('require', get_bloginfo('template_url') . '/scripts/vendor/r.js', [], false, true);
177 }
178 wp_enqueue_script('global', get_bloginfo('template_url') . '/scripts/optimized.min.js', ['require'], false, true);
179 wp_enqueue_style('global', get_bloginfo('template_url') . '/styles/global.css');
180 }
181 if (is_page_template("badge-share.php")) 138 if (is_page_template("badge-share.php"))
182 { 139 {
183 wp_enqueue_script('sharerbox', get_bloginfo('template_url') . '/scripts/sharerbox.js', [], false, true); 140 wp_enqueue_script('sharerbox', get_bloginfo('template_url') . '/scripts/sharerbox.js', [], false, true);
......
1 require.config({
2 "baseUrl": "/wp-content/themes/commonwell-corp/js/",
3 "paths": {
4 "jquery": "../components/jquery/jquery.min",
5 "hoverIntent" : "../components/superfish/dist/js/hoverIntent",
6 "superfish": "../components/superfish/dist/js/superfish.min",
7 "fittext": "vendor/jquery.fittext",
8 "superclick": "vendor/superclick",
9 "featherlight": "vendor/featherlight.min"
10 },
11 "shim": {
12 jquery: {
13 exports: 'jquery'
14 },
15 hoverIntent: {
16 deps: ['jquery']
17 },
18 superfish: {
19 deps: ['jquery']
20 },
21 fittext: {
22 deps: ['jquery']
23 },
24 superclick: {
25 deps: ['jquery']
26 },
27 featherlight: {
28 deps: ['jquery']
29 }
30 }
31 });
32
33 require(['jquery', 'src/menu', 'fittext', 'src/sizing', 'src/care_form', 'src/facebook_extensible', 'src/canada-post'], function ($, Menu) {
34 $.fn.extend({
35 limiter: function (max, counter) {
36 $(this).on("keyup focus", function () {
37 var self = this;
38 var words = (self.value.length > 0) ? ($.trim(self.value).replace(/['";:,.?¿\-]+/g, '').match(/\S+/g)).length : 0;
39 if (typeof(counter) != 'undefined') {
40 counter.html(max - words);
41 }
42 });
43 }
44 });
45
46 function noscroll(event) {
47 event.preventDefault();
48 }
49
50 var App = {
51 menu: null,
52 init: function () {
53 this.menu = new Menu($('#primary-nav'));
54 this.menu.setup();
55 $("#area").limiter(250, $("#chars"));
56 $('.mobile-menu-btn').on('click', function (event) {
57 event.preventDefault();
58 $('body').toggleClass('menu-on');
59 console.log('menu on');
60 // lock scrolling when nav is open
61 // if ($('body').hasClass('menu-on')) {
62 // $(document).on('touchmove', noscroll);
63 // } else {
64 // $(document).off('touchmove', noscroll);
65 // }
66 return false;
67 });
68
69 // Change --- word to please select one
70 $('form .form-control').find('select[name="community"] option').eq(0).html('Please select one');
71 $('form .form-control').find('select[name="referral"] option').eq(0).html('Please select one');
72
73 }
74 };
75
76 $(document).ready(function() {
77 App.init();
78
79 // we should use RAF for smooth moving
80 window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.oRequestAnimationFrame;
81 function createMapCloseBtn() {
82 var $map = $('#map');
83 $map.hide();
84 // inject the close button
85 $map.append('<a href="#" class="close-map"></a>');
86 // hide the map when its clicked
87 $map.find('.close-map').on('click', function (event) {
88 event.preventDefault();
89 $map.hide();
90 return false;
91 });
92 // show the map when markers are clicked on
93 $('#sl_div').find('.marker').on('click', function () {
94 $map.show();
95 });
96 }
97
98 function setMapStart() {
99 // are we mobile?
100 var mobile = (window.innerWidth < 960);
101 // different lefts for different screens
102 var mapLeft = mobile ? '53px' : '8px';
103 // when should the map stop moving up?
104 var minTop = $('#other-header').outerHeight() + $('#primary-nav').outerHeight() + 40;
105 if(window.isBrokerPage) {
106 minTop = (mobile) ? 50 : 0;
107 }
108 var is_safari = navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0;
109 //if(is_safari) {
110 var smallMobile = (window.innerWidth < 600);
111 var mapWidth = smallMobile ? 0 : $('#map').outerWidth() + 8;
112 $('#map').css({
113 top: minTop,
114 left: mapLeft,
115 opacity: 1,
116 zIndex: 1,
117 marginLeft: -mapWidth
118 });
119
120 $(window).resize(function() {
121 var smallMobile = (window.innerWidth < 600);
122 var mapWidth = smallMobile ? 0 : $('#map').outerWidth() + 8;
123 var mapLeft = smallMobile ? '53px' : '8px';
124
125 $('#map').css({
126 left: mapLeft,
127 marginLeft: -mapWidth
128 });
129 }).resize();
130 //} else {
131 // // if the screen is mobile, and we havent injected the button
132 // $('#map').css({
133 // top: minTop,
134 // left: mapLeft,
135 // opacity: 1,
136 // zIndex: 1
137 // });
138 //}
139
140 if ($('.close-map').length === 0) {
141 createMapCloseBtn();
142 }
143 }
144
145 // scroller function to move the map
146 function moveMap() {
147 var mobile = (window.innerWidth < 960);
148 var pos = (mobile) ? $(document).scrollTop() + 200 : $(document).scrollTop();
149 var minTop = $('#other-header').outerHeight() + $('#primary-nav').outerHeight() + 20;
150 if(window.isBrokerPage) {
151 minTop = 0;
152 pos = (mobile) ? $(document).scrollTop() + 50 : $(document).scrollTop();
153 }
154
155 if (pos > minTop) {
156 $('#map').css('top', pos);
157 // call this function with RAF
158 requestAnimationFrame(moveMap);
159 } else {
160 $('#map').css('top', minTop);
161 }
162 }
163
164 // use a dom ready function for these events
165 $(function () {
166 var searchCat = $('#sl_div').find('#cat').attr('textvalue');
167 if(searchCat && searchCat != 'broker') {
168 $('#div_nameSearch #nameSearch').attr('placeholder', 'Company Name');
169 }
170
171 // when the search is clicked
172 // and if the screensize is correct
173 // move the map under the nav on the left side
174 $('#addressSubmit').on('click', function () {
175 // timeout for the delayed map loading
176 setTimeout(function () {
177 setMapStart();
178 }, 1000);
179 // feebback to let people know that the form is actually working
180 //$('#address_search').append('<p id="searching-feedback">Searching...</p>');
181 $(this).attr('value', 'Searching...');
182 });
183 // used to avoid multiple listeners
184 var scrollListener = false;
185 // this event is trigger whenever the map is updated according to
186 // the slp.js file in the store-locator-le plugin
187 $('#map_sidebar').on('contentchanged', function () {
188 //$('#searching-feedback').remove();
189 $('#addressSubmit').attr('value', 'Search');
190
191 setMapStart();
192 if (!scrollListener) {
193 $(window).scroll(function () {
194 requestAnimationFrame(moveMap);
195 });
196 scrollListener = true;
197 }
198
199 // Check if the store has site url
200 var url = $(this).parent().find('.slp_result_website > a').attr('href');
201 if(url === undefined) {
202 $('.results_entry').find('.results_row_top .location_name').css('color', '#706f73');
203 }
204
205 //$(this).parent().find('.results_row_top').click(function() {
206 // var companyName = $(this).find('.location_name').text();
207 // var hasURL = $(this).find('.storelocatorlink');
208 // if(hasURL) {
209 // ga('send', 'event', 'broker', 'click', companyName);
210 // }
211 //});
212 });
213 });
214 });
215
216
217 });
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
1 jQuery(document).ready(function($) {
2
3
4
5 var term03 = $(".wheel-03 .term03");
6 var term04 = $(".wheel-03 .term04");
7 var term05 = $(".wheel-03 .term05");
8 var term06 = $(".wheel-03 .term06");
9 var term07 = $(".wheel-03 .term07");
10
11 var stepFrame = 5;
12
13 tl03 = new TimelineLite();
14 tl03
15 .to(term03, stepFrame, {
16 css: { className: "term term02" },
17 attr: { y: "-=50" },
18 ease: Linear.easeNone
19 })
20 .to(term03, stepFrame, {
21 css: { className: "term term01" },
22 attr: { y: "-=50" },
23 ease: Linear.easeNone
24 })
25 .to(term03, stepFrame, {
26 css: { className: "term term00" },
27 attr: { y: "-=50" },
28 ease: Linear.easeNone
29 });
30
31 tl04 = new TimelineLite();
32 tl04
33 .to(term04, stepFrame, {
34 css: { className: "term term03" },
35 attr: { y: "-=50" },
36 ease: Linear.easeNone
37 })
38 .to(term04, stepFrame, {
39 css: { className: "term term02" },
40 attr: { y: "-=50" },
41 ease: Linear.easeNone
42 })
43 .to(term04, stepFrame, {
44 css: { className: "term term01" },
45 attr: { y: "-=50" },
46 ease: Linear.easeNone
47 })
48 .to(term04, stepFrame, {
49 css: { className: "term term00" },
50 attr: { y: "-=50" },
51 ease: Linear.easeNone
52 });
53
54 tl05 = new TimelineLite();
55 tl05
56 .to(term05, stepFrame, {
57 css: { className: "term term04" },
58 attr: { y: "-=50" },
59 ease: Linear.easeNone
60 })
61 .to(term05, stepFrame, {
62 css: { className: "term term03" },
63 attr: { y: "-=50" },
64 ease: Linear.easeNone
65 })
66 .to(term05, stepFrame, {
67 css: { className: "term term02" },
68 attr: { y: "-=50" },
69 ease: Linear.easeNone
70 })
71 .to(term05, stepFrame, {
72 css: { className: "term term01" },
73 attr: { y: "-=50" },
74 ease: Linear.easeNone
75 })
76 ;
77
78 tl06 = new TimelineLite();
79 tl06
80 .to(term06, stepFrame, {
81 css: { className: "term term05" },
82 attr: { y: "-=50" },
83 ease: Linear.easeNone
84 })
85 .to(term06, stepFrame, {
86 css: { className: "term term04" },
87 attr: { y: "-=50" },
88 ease: Linear.easeNone
89 })
90 .to(term06, stepFrame, {
91 css: { className: "term term03" },
92 attr: { y: "-=50" },
93 ease: Linear.easeNone
94 })
95 .to(term06, stepFrame, {
96 css: { className: "term term02" },
97 attr: { y: "-=50" },
98 ease: Linear.easeNone
99 })
100 ;
101
102 tl07 = new TimelineLite();
103 tl07
104 .to(term07, stepFrame, {
105 css: { className: "term term06" },
106 attr: { y: "-=50" },
107 ease: Linear.easeNone
108 })
109 .to(term07, stepFrame, {
110 css: { className: "term term05" },
111 attr: { y: "-=50" },
112 ease: Linear.easeNone
113 })
114 .to(term07, stepFrame, {
115 css: { className: "term term04" },
116 attr: { y: "-=50" },
117 ease: Linear.easeNone
118 })
119 .to(term07, stepFrame, {
120 css: { className: "term term03" },
121 attr: { y: "-=50" },
122 ease: Linear.easeNone
123 });
124
125 wheel03 = new TimelineMax({ repeat: 100, timeScale: 10, yoyo:true });
126
127 wheel03.add(tl03, 0);
128 wheel03.add(tl04, 0);
129 wheel03.add(tl05, 0);
130 wheel03.add(tl06, 0);
131 wheel03.add(tl07, 0);
132
133
134 wheel03.pause();
135 setInterval(myTimer, 1000);
136
137 function myTimer() {
138 //
139 if(!$('.full-screen').hasClass('paused')){
140 wheel03.play();
141 //
142 //$('canvas').remove();
143 setTimeout(() => {
144 wheel03.pause();
145 }, 500);
146 }
147 }
148
149 TweenMax.to(wheel03, 0.1, { timeScale: 10, ease: Circ.easeOut });
150
151 $(document).on('click', '.video-thumb', function(){
152 $('.full-screen').hide();
153 var video = document.getElementsByTagName('video')[0];
154 var sources = video.getElementsByTagName('source');
155 var track = video.getElementsByTagName('track');
156 sources[0].src = $(this).data('video');
157 track[0].src = $(this).data('cc');
158 video.load();
159 video.muted = false;
160 video.removeAttribute("loop");
161 $('.play').hide();
162 $('.pause').hide();
163 $('.product-header-image').css('background-image','none').css('background-color','#000');
164 $('#myVideo').css('position','relative').css('right','unset').css('min-width','unset').css('max-width','100vw').css('max-height','99.8%');;
165 video.setAttribute("controls","controls")
166 // if (video.requestFullscreen) {
167 // video.requestFullscreen();
168 // } else if (video.msRequestFullscreen) {
169 // video.msRequestFullscreen();
170 // } else if (video.mozRequestFullScreen) {
171 // video.mozRequestFullScreen();
172 // } else if (video.webkitRequestFullscreen) {
173 // video.webkitRequestFullscreen();
174 // }
175
176 });
177
178
179 $(document).on('click', '.pause', function(){
180 $('.full-screen').addClass('paused');
181 $(this).hide();
182 $('.play').show();
183 var video = document.getElementsByTagName('video')[0];
184 video.pause();
185 wheel03.pause();
186
187 });
188
189 $(document).on('click', '.play', function(){
190 $('.full-screen').removeClass('paused');
191 $(this).hide();
192 $('.pause').show();
193 var video = document.getElementsByTagName('video')[0];
194 video.play();
195 wheel03.play();
196
197 });
198
199 $('.video-thumb-title').sameHeight();
200
201 $(window).resize(function(){
202 $('.video-thumb-title').css('height','unset');
203 $('.video-thumb-title').sameHeight();
204 });
205
206
207 });
208
209 (function(document, history, location) {
210 var HISTORY_SUPPORT = !!(history && history.pushState);
211
212 var anchorScrolls = {
213 ANCHOR_REGEX: /^#[^ ]+$/,
214 OFFSET_HEIGHT_PX: 150,
215
216 /**
217 * Establish events, and fix initial scroll position if a hash is provided.
218 */
219 init: function() {
220 this.scrollToCurrent();
221 window.addEventListener('hashchange', this.scrollToCurrent.bind(this));
222 document.body.addEventListener('click', this.delegateAnchors.bind(this));
223 },
224
225 /**
226 * Return the offset amount to deduct from the normal scroll position.
227 * Modify as appropriate to allow for dynamic calculations
228 */
229 getFixedOffset: function() {
230 return this.OFFSET_HEIGHT_PX;
231 },
232
233 /**
234 * If the provided href is an anchor which resolves to an element on the
235 * page, scroll to it.
236 * @param {String} href
237 * @return {Boolean} - Was the href an anchor.
238 */
239 scrollIfAnchor: function(href, pushToHistory) {
240 var match, rect, anchorOffset;
241
242 if(!this.ANCHOR_REGEX.test(href)) {
243 return false;
244 }
245
246 match = document.getElementById(href.slice(1));
247
248 if(match) {
249 rect = match.getBoundingClientRect();
250 anchorOffset = window.pageYOffset + rect.top - this.getFixedOffset();
251 window.scrollTo(window.pageXOffset, anchorOffset);
252
253 // Add the state to history as-per normal anchor links
254 if(HISTORY_SUPPORT && pushToHistory) {
255 history.pushState({}, document.title, location.pathname + href);
256 }
257 }
258
259 return !!match;
260 },
261
262 /**
263 * Attempt to scroll to the current location's hash.
264 */
265 scrollToCurrent: function() {
266 this.scrollIfAnchor(window.location.hash);
267 },
268
269 /**
270 * If the click event's target was an anchor, fix the scroll position.
271 */
272 delegateAnchors: function(e) {
273 var elem = e.target;
274
275 if(
276 elem.nodeName === 'A' &&
277 this.scrollIfAnchor(elem.getAttribute('href'), true)
278 ) {
279 e.preventDefault();
280 }
281 }
282 };
283
284 window.addEventListener(
285 'DOMContentLoaded', anchorScrolls.init.bind(anchorScrolls)
286 );
287 })(window.document, window.history, window.location);
288
289
290
291 (function( $ ) {
292 // the sameHeight functions makes all the selected elements of the same height
293 $.fn.sameHeight = function() {
294 var selector = this;
295 var heights = [];
296
297 // Save the heights of every element into an array
298 selector.each(function(){
299 var height = $(this).height();
300 heights.push(height);
301 });
302
303 // Get the biggest height
304 var maxHeight = Math.max.apply(null, heights);
305 // Show in the console to verify
306 console.log(heights,maxHeight);
307
308 // Set the maxHeight to every selected element
309 selector.each(function(){
310 $(this).height(maxHeight);
311 });
312 };
313
314 }( jQuery ));
...\ No newline at end of file ...\ No newline at end of file
1 jQuery(document).ready( function($) {
2
3 // in case of bootstrap modal example:
4 $('.modal').on('shown.bs.modal', function () {
5
6 var documentScrollTop = $(document).scrollTop();
7 $(document).on('scroll.noScroll', function() {
8 $(document).scrollTop(documentScrollTop);
9 return false;
10 });
11
12 }).on('hidden.bs.modal', function() {
13
14 $(document).off('scroll.noScroll');
15
16 });
17
18 $('input').iCheck({
19 checkboxClass: 'icheckbox_square-green',
20 radioClass: 'iradio_square-green',
21 increaseArea: '20%' // optional
22 });
23
24 function scrollScripts() {
25
26 if(!jQuery('#content-wrap').hasClass('retract')) {
27 if(jQuery(window).scrollTop() >= 150) {
28 jQuery('#content-wrap').addClass('retract');
29 jQuery('#page-header-seedit').addClass('retract');
30 jQuery('#mySidenav').addClass('retract');
31 jQuery('#page-header-part').addClass('retract');
32 jQuery('#myTopnav').css('top', '40px');
33 jQuery('#menu-seedit-main').css('margin-top', '15px');
34 jQuery('.tag-line').hide();
35
36 }
37 } else {
38 if(jQuery(window).scrollTop() < 170) {
39 jQuery('#content-wrap').removeClass('retract');
40 jQuery('#page-header-seedit').removeClass('retract');
41 jQuery('#mySidenav').removeClass('retract');
42 jQuery('#page-header-part').removeClass('retract');
43 jQuery('#menu-seedit-main').css('margin-top', '50px');
44 jQuery('.tag-line').show();
45 jQuery('#myTopnav').css('top', '100px');
46
47 }
48 }
49 }
50
51
52 jQuery( ".rect" ).each(function( index ) {
53
54 var rec = $(this);
55 setTimeout(function() {
56 $(rec).css('visibility','visible');
57
58 }, index * 500);
59
60 });
61
62
63
64
65
66 $(document).on("click",".btn.story",function() {
67 $('.sub-header').show();
68 $('.modal-title').show();
69 $('.modal-thanks').hide();
70 $('.form').children().show();
71 $('.load').hide();
72 $('[name="project_id"]').val($('[name="post_id"]').val());
73 $('[name="post_date"]').val( $('#date').val());
74 $('#exampleModalAddStory').modal('show');
75 });
76 $(document).on("click",".btn.photo",function() {
77 $('.sub-header').show();
78 $('.modal-title').show();
79 $('.modal-thanks').hide();
80 $('.form').children().show();
81 $('.load').hide();
82 $('[name="project_id"]').val($('[name="post_id"]').val());
83 $('[name="post_date"]').val( $('#date').val());
84 $('#exampleModalAddPhoto').modal('show');
85 });
86 $(document).on("click",".btn.comment",function() {
87 $('.sub-header').show();
88 $('.modal-title').show();
89 $('.modal-thanks').hide();
90 $('.form').children().show();
91 $('.load').hide();
92 $('[name="project_id"]').val($('[name="post_id"]').val());
93 $('[name="post_date"]').val( $('#date').val());
94 $('#exampleModalAddComment').modal('show');
95
96 });
97
98 $(document).on("click",".wpcf7-submit",function() {
99 $('.load').show();
100 });
101
102 document.addEventListener( 'wpcf7submit', function( event ) {
103
104 setTimeout(function(){
105 if(jQuery('.wpcf7-not-valid').length > 0) {
106 jQuery('html,body').animate({scrollTop: jQuery('.wpcf7-not-valid').first().offset().top -150}, 'linear')
107 }
108 }, 1000);
109
110 setTimeout(function(){
111 $('.load').hide();
112 }, 1000);
113
114 }, false );
115
116 document.addEventListener( 'wpcf7mailsent', function( event ) {
117 $('.load').hide();
118 $('.sub-header').hide();
119 $('.modal-title').hide();
120 $('.form').children().hide();
121 $('.modal-thanks').show();
122
123 $('.wpcf7-response-output').show();
124 if($('.modal.fade.in').length == 0) {
125 setTimeout(function(){
126 $([document.documentElement, document.body]).animate({
127 scrollTop: $('.wpcf7-response-output').offset().top - 150
128 }, 2000);
129 }, 1000);
130 }
131
132 });
133
134 $(".moreBox").slice(0, 3).show();
135 if ($(".blogBox:hidden").length != 0) {
136 $("#loadMore").show();
137 }
138
139 jQuery(document).on("click", "#loadMore", function(e) {
140 e.preventDefault();
141 $(".moreBox:hidden").slice(0, 3).slideDown();
142 if ($(".moreBox:hidden").length == 0) {
143 $("#loadMore").fadeOut('slow');
144 }
145 });
146
147 $(document).on("click",".btn.fb",function() {
148 window.open('http://facebook.com/sharer/sharer.php?u='+encodeURIComponent(window.location.href), '', 'left=0,top=0,width=650,height=420,personalbar=0,toolbar=0,scrollbars=0,resizable=0');
149 });
150
151 jQuery(document).on("click",".share_read_more",function(evt) {
152 evt.preventDefault();
153
154 $(".modal-body.story").html('<img class="loading" src="https://thecommonwell.ca/wp-content/themes/commonwell-corp/images/loading.svg"/>');
155 $('.sub-header').show();
156 $('.modal-title').show();
157 $("#exampleModalLong").modal("show");
158 var id = $(this).data('id');
159 console.log(id);
160 $.ajax({
161 type: 'POST',
162 url: '../../wp-admin/admin-ajax.php',
163 dataType: 'json',
164 data: {
165 'post_id': id,
166 'action': 'ajax_request' //this is the name of the AJAX method called in WordPress
167 }, success: function (data) {
168 $(".sub-header.story").html(data['date']+'<br/>Submitted by '+data['post'].post_title);
169 $(".modal-body.story").html(data['post'].post_content);
170
171 console.log(data['post']);
172 },
173 error: function () {
174 alert("error");
175 }
176 });
177
178
179 return false;
180 });
181
182 jQuery(document).on("click","#menu-seedit-main li a",function(evt) {
183 jQuery('#mySidenav').removeClass('mobile-open');
184 });
185
186 document.addEventListener('dblclick', (event) => {
187 event.preventDefault()
188 }, { passive: false });
189
190 var scrolling = false;
191
192 jQuery( window ).scroll( function() {
193 scrolling = true;
194 });
195
196 jQuery('#side-window').scroll(function() {
197 scrolling = true;
198 });
199
200 setInterval( function() {
201 if ( scrolling ) {
202 scrolling = false;
203 scrollScripts();
204 }
205 }, 250 );
206
207 // or for modern browsers
208 document.addEventListener( 'wheel', function( evt ) {
209 scrolling = true;
210 }, { capture: false, passive: true });
211
212 scrollScripts();
213
214 var el = document.getElementById('commonwell-link');
215 var style = window.getComputedStyle(el, null).getPropertyValue('font-size');
216 var fontSize = style;
217 var fontSizePercentage = parseFloat(style) / 12 * 100;
218 if( fontSizePercentage > 100){
219 document.body.className += ' large_font';
220 // $('.menu-item-220 a').attr('href','/news/');
221 }
222 if( fontSizePercentage > 125){
223 document.body.className += ' xlarge_font';
224 }
225
226 console.log(style, fontSizePercentage);
227
228 });
229
230 jQuery(window).load(function() {
231 if(location.hash) {
232 var id = jQuery(location.hash);
233 jQuery('html,body').animate({scrollTop: id.offset().top -150}, 'linear')
234 }
235 });
1 jQuery(document).ready( function() {
2
3
4 function scrollScripts() {
5
6 if(!jQuery('#content-wrap').hasClass('retract')) {
7 if(jQuery(window).scrollTop() >= 150) {
8 jQuery('#content-wrap').addClass('retract');
9 jQuery('#page-header-seedit').addClass('retract');
10 jQuery('#mySidenav').addClass('retract');
11 jQuery('#page-header-part').addClass('retract');
12 jQuery('#myTopnav').css('top', '40px');
13 jQuery('#menu-seedit-main').css('margin-top', '15px');
14
15
16 jQuery('.tag-line').hide();
17
18 document.querySelector(".otherpage-logo").getSVGDocument().getElementById("Community_Nutrition_Resources_Food_Security").setAttribute("fill-opacity", "0");
19
20 }
21 } else {
22 if(jQuery(window).scrollTop() < 170) {
23 jQuery('#content-wrap').removeClass('retract');
24 jQuery('#page-header-seedit').removeClass('retract');
25 jQuery('#mySidenav').removeClass('retract');
26 jQuery('#page-header-part').removeClass('retract');
27 jQuery('#menu-seedit-main').css('margin-top', '50px');
28 jQuery('.tag-line').show();
29 jQuery('#myTopnav').css('top', '100px');
30 document.querySelector(".otherpage-logo").getSVGDocument().getElementById("Community_Nutrition_Resources_Food_Security").setAttribute("fill-opacity", "1");
31
32 }
33 }
34 }
35
36 jQuery(document).on("click","#menu-seedit-main li a",function(evt) {
37 jQuery('#mySidenav').removeClass('mobile-open');
38 });
39
40 document.addEventListener('dblclick', (event) => {
41 event.preventDefault()
42 }, { passive: false });
43
44 var scrolling = false;
45
46 jQuery( window ).scroll( function() {
47 scrolling = true;
48 });
49
50 jQuery('#side-window').scroll(function() {
51 scrolling = true;
52 });
53
54 setInterval( function() {
55 if ( scrolling ) {
56 scrolling = false;
57 scrollScripts();
58 }
59 }, 250 );
60
61 // or for modern browsers
62 document.addEventListener( 'wheel', function( evt ) {
63 scrolling = true;
64 }, { capture: false, passive: true });
65
66 scrollScripts();
67
68 var el = document.getElementById('commonwell-link');
69 var style = window.getComputedStyle(el, null).getPropertyValue('font-size');
70 var fontSize = style;
71 var fontSizePercentage = parseFloat(style) / 12 * 100;
72 if( fontSizePercentage > 100){
73 document.body.className += ' large_font';
74 // $('.menu-item-220 a').attr('href','/news/');
75 }
76 if( fontSizePercentage > 125){
77 document.body.className += ' xlarge_font';
78 }
79
80 console.log(style, fontSizePercentage);
81
82 });
83
84
85
1 define(
2 ['jquery', 'featherlight'], function ($) {
3 $(document).ready(
4 function () {
5 var $canadaPostButton = $('.canada-post-icon-button');
6 var tl = new TimelineMax(
7 {
8 repeat: -1,
9 repeatDelay: 10
10 }
11 );
12
13 tl
14 .to(
15 $canadaPostButton, 0.25, {
16 scaleX: 1.1,
17 scaleY: 1.1,
18 force3D: true,
19 ease: Linear.easeNone
20 }
21 )
22 .to(
23 $canadaPostButton, 0.25, {
24 scaleX: 0.95,
25 scaleY: 0.95,
26 force3D: true,
27 ease: Linear.easeNone
28 }
29 )
30 .to(
31 $canadaPostButton, 0.25, {
32 scaleX: 1,
33 scaleY: 1,
34 force3D: true,
35 ease: Linear.easeNone
36 }
37 );
38 }
39 );
40 }
41 );
1 define(
2 ['jquery'], function ($) {
3 $(document).ready(
4 function () {
5 // Check if browser supports HTML5 input placeholder
6 function supports_input_placeholder() {
7 var i = document.createElement('input');
8 return 'placeholder' in i;
9 }
10
11 // Change input text on focus
12 if (!supports_input_placeholder()) {
13 jQuery('.wpcf7-text').each(
14 function () {
15 var self = jQuery(this);
16 var value = jQuery.trim(self.val());
17 if (value == '') self.val(self.attr('placeholder'));
18 }
19 );
20 jQuery('.wpcf7-text').focus(
21 function () {
22 var self = jQuery(this);
23 if (self.val() == self.attr('placeholder')) self.val('');
24 }
25 ).blur(
26 function () {
27 var self = jQuery(this);
28 var value = jQuery.trim(self.val());
29 if (value == '') self.val(self.attr('placeholder'));
30 }
31 );
32 }
33
34 //functionality for add-file link
35 $('a.add_file').on(
36 'click', function (e) {
37 //show by click the first one from hidden inputs
38 $('p.hide:not(:visible):first').show('slow');
39 e.preventDefault();
40 }
41 );
42
43 //functionality for del-file link
44 $('a.del_file').on(
45 'click', function (e) {
46 //var init
47 var input_parent = $(this).parent();
48 var input_wrap = input_parent.find('span');
49 //reset field value
50 input_wrap.html(input_wrap.html());
51 //hide by click
52 input_parent.hide('slow');
53 e.preventDefault();
54 }
55 );
56
57 $('a.first-file').on(
58 'click', function (e) {
59 //reset field value
60 $('.wpcf7-file').eq(0).replaceWith($('.wpcf7-file').eq(0).val('').clone(true));
61 $(this).hide();
62 e.preventDefault();
63 }
64 );
65
66 $('.wpcf7-file').eq(0).change(
67 function () {
68 var fileName = $(this).val();
69 if (fileName != '') {
70 $('a.first-file').show();
71 } else {
72 $('a.first-file').hide();
73 }
74 }
75 );
76
77 var eventFields = $('input[name="event-date"], input[name="event-location"], textarea[name="purpose-event"], input[name="role"], textarea[name="recognize-event"]');
78 eventFields.removeClass('wpcf7-validates-as-required');
79 eventFields.parents('.form-control').hide();
80
81 $('input[name="donation"]').click(
82 function () {
83 var value = $(this).attr('value');
84 var isDonation = value.indexOf('donation') > 0;
85 var requiredClassName = 'wpcf7-validates-as-required';
86 var requiredAttr = "aria-required";
87 var eventFields = $('input[name="event-date"], input[name="event-location"], textarea[name="purpose-event"], input[name="role"], textarea[name="recognize-event"]');
88
89 // Check if it is donation or event
90 if (!isDonation) {
91 eventFields.addClass(requiredClassName).attr(requiredAttr, true);
92 eventFields.parents('.form-control').slideDown();
93 } else {
94 eventFields.removeClass(requiredClassName).attr(requiredAttr, false);
95 eventFields.parents('.form-control').slideUp();
96
97 }
98 }
99 );
100 }
101 );
102 }
103 );