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())) {
</div>
<script>
(function($) {
jQuery(document).ready(
function($) {
jQuery( document ).ready(function( $ ) {
console.log($.cookie('dialog_cookie_new'));
if ($.cookie('dialog_cookie_new') == null) {
$(window).resize(
......@@ -333,36 +332,7 @@ if (function_exists(clean_custom_menus())) {
}
});
// $('.bxslider2').bxSlider({
// mode: 'fade',
// captions: true,
// auto: true,
// autoStart: true,
// pause: 9000,
// controls: false
// });
// $('.bxslider').bxSlider({
// mode: 'fade',
// captions: true,
// auto: true,
// autoStart: true,
// pause: 9000,
// onSlideBefore: function($slideElement, oldIndex, newIndex) {
// var $bxControls = $('.bx-controls');
// $bxControls.fadeOut(10);
// },
// onSlideAfter: function($slideElement, oldIndex, newIndex) {
// setTimeout(function() {
// setSliderControlPosition(newIndex);
// }, 100);
// },
// onSliderLoad: function(currentIndex) {
// setTimeout(function() {
// setSliderControlPosition(currentIndex);
// }, 100);
// }
// });
$(window).resize(function() {
if ($(this).width() < 701) {
......@@ -384,6 +354,34 @@ if (function_exists(clean_custom_menus())) {
smallMenu.css('zIndex', 0);
}, 500);
});
$("#read-more-dialog").dialog({
width: "auto",
autoOpen: false,
// maxWidth: 660, // This won't work
create: function(event, ui) {
// Set maxWidth
$(this).css("maxWidth", "516px");
},
modal: true,
position: {
my: "center",
at: "center",
of: window
},
closeText: "hide",
hide: {
effect: "explode",
duration: 1000
}
});
$(document).on('click', '#read-more', function() {
$("#read-more-dialog").dialog("open");
$(".ui-dialog-title").hide();
});
}
);
......@@ -408,33 +406,7 @@ if (function_exists(clean_custom_menus())) {
}
$("#read-more-dialog").dialog({
width: "auto",
autoOpen: false,
// maxWidth: 660, // This won't work
create: function(event, ui) {
// Set maxWidth
$(this).css("maxWidth", "516px");
},
modal: true,
position: {
my: "center",
at: "center",
of: window
},
closeText: "hide",
hide: {
effect: "explode",
duration: 1000
}
});
$(document).on('click', '#read-more', function() {
$("#read-more-dialog").dialog("open");
$(".ui-dialog-title").hide();
});
})(jQuery);
......
......@@ -34,25 +34,15 @@ function theme_broker_enqueue_scripts()
wp_enqueue_style('fontawsome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css');
wp_enqueue_style('Material', 'https://fonts.googleapis.com/icon?family=Material+Icons');
wp_enqueue_style('bxslider', get_bloginfo('template_url') . '/styles/vendor/jquery.bxslider.css');
wp_enqueue_script(
'bxslider',
get_bloginfo('template_url') . '/scripts/vendor/jquery.bxslider.js',
[],
"0.0.1",
true
);
wp_enqueue_script( 'bxslider', get_bloginfo('template_url') . '/scripts/vendor/jquery.bxslider.js',[], "0.0.1", true );
wp_enqueue_script('cookies', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.min.js');
wp_enqueue_script('moblie_menu', get_bloginfo('template_url') . '/scripts/moblie_menu.js');
wp_enqueue_script('jQmobile', get_bloginfo('template_url') . '/scripts/vendor/jquery.mobile.custom.min.js');
wp_enqueue_script('colorbox', '//cdnjs.cloudflare.com/ajax/libs/jquery.colorbox/1.6.4/jquery.colorbox.js');
wp_enqueue_script(
'bootstrap',
'https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js',
[],
false,
true
);
wp_enqueue_script('bootstrap','https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js',[], false, true );
wp_enqueue_script('jquery-ui', get_bloginfo('template_url') . '/scripts/jquery-ui.min.js', [], false, true);
// qTip
wp_enqueue_style('qtip', get_bloginfo('template_url') . '/styles/vendor/jquery.qtip.css');
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()
// Tooltipster
wp_enqueue_style('tooltipster', get_bloginfo('template_url') . '/styles/vendor/tooltipster.bundle.min.css');
wp_enqueue_script(
'tooltipster',
get_bloginfo('template_url') . '/scripts/vendor/tooltipster.bundle.min.js',
[],
"0.0.1",
true
);
wp_enqueue_script( 'tooltipster', get_bloginfo('template_url') . '/scripts/vendor/tooltipster.bundle.min.js',[], "0.0.1",true );
wp_enqueue_script('show-more', get_bloginfo('template_url') . '/scripts/show-more.js', [], "0.0.3", true);
wp_enqueue_script('accessibility_script', get_bloginfo('template_url') . '/scripts/accessibility.js', true);
......@@ -150,34 +134,7 @@ function theme_broker_enqueue_scripts()
}
add_action('wp_enqueue_scripts', 'theme_enqueue_scripts');
function theme_enqueue_scripts()
{
if (
is_page_template("broker_landing_page.php")
|| is_page_template("broker_pages.php")
|| is_page_template("login-page.php")
|| is_page_template("default.php")
|| is_page_template("general.php")
|| is_page_template("SearchWpResult.php")
|| is_page_template("broker_notifications_archive.php")
|| is_page_template("broker_account_pages.php")
|| is_page_template("marketing_masters.php")
|| get_post_type() == 'notifications'
|| get_post_type() == 'sfwd-courses'
|| get_post_type() == 'sfwd-lessons'
|| get_post_type() == 'sfwd-quiz'
|| get_post_type() == 'badges'
) {
wp_enqueue_script('require', get_bloginfo('template_url') . '/scripts/vendor/r.js', [], false, true);
}
wp_enqueue_script('global', get_bloginfo('template_url') . '/scripts/optimized.min.js', ['require'], false, true);
wp_enqueue_style('global', get_bloginfo('template_url') . '/styles/global.css');
}
if (is_page_template("badge-share.php"))
{
wp_enqueue_script('sharerbox', get_bloginfo('template_url') . '/scripts/sharerbox.js', [], false, true);
......
require.config({
"baseUrl": "/wp-content/themes/commonwell-corp/js/",
"paths": {
"jquery": "../components/jquery/jquery.min",
"hoverIntent" : "../components/superfish/dist/js/hoverIntent",
"superfish": "../components/superfish/dist/js/superfish.min",
"fittext": "vendor/jquery.fittext",
"superclick": "vendor/superclick",
"featherlight": "vendor/featherlight.min"
},
"shim": {
jquery: {
exports: 'jquery'
},
hoverIntent: {
deps: ['jquery']
},
superfish: {
deps: ['jquery']
},
fittext: {
deps: ['jquery']
},
superclick: {
deps: ['jquery']
},
featherlight: {
deps: ['jquery']
}
}
});
require(['jquery', 'src/menu', 'fittext', 'src/sizing', 'src/care_form', 'src/facebook_extensible', 'src/canada-post'], function ($, Menu) {
$.fn.extend({
limiter: function (max, counter) {
$(this).on("keyup focus", function () {
var self = this;
var words = (self.value.length > 0) ? ($.trim(self.value).replace(/['";:,.?¿\-]+/g, '').match(/\S+/g)).length : 0;
if (typeof(counter) != 'undefined') {
counter.html(max - words);
}
});
}
});
function noscroll(event) {
event.preventDefault();
}
var App = {
menu: null,
init: function () {
this.menu = new Menu($('#primary-nav'));
this.menu.setup();
$("#area").limiter(250, $("#chars"));
$('.mobile-menu-btn').on('click', function (event) {
event.preventDefault();
$('body').toggleClass('menu-on');
console.log('menu on');
// lock scrolling when nav is open
// if ($('body').hasClass('menu-on')) {
// $(document).on('touchmove', noscroll);
// } else {
// $(document).off('touchmove', noscroll);
// }
return false;
});
// Change --- word to please select one
$('form .form-control').find('select[name="community"] option').eq(0).html('Please select one');
$('form .form-control').find('select[name="referral"] option').eq(0).html('Please select one');
}
};
$(document).ready(function() {
App.init();
// we should use RAF for smooth moving
window.requestAnimationFrame = window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.oRequestAnimationFrame;
function createMapCloseBtn() {
var $map = $('#map');
$map.hide();
// inject the close button
$map.append('<a href="#" class="close-map"></a>');
// hide the map when its clicked
$map.find('.close-map').on('click', function (event) {
event.preventDefault();
$map.hide();
return false;
});
// show the map when markers are clicked on
$('#sl_div').find('.marker').on('click', function () {
$map.show();
});
}
function setMapStart() {
// are we mobile?
var mobile = (window.innerWidth < 960);
// different lefts for different screens
var mapLeft = mobile ? '53px' : '8px';
// when should the map stop moving up?
var minTop = $('#other-header').outerHeight() + $('#primary-nav').outerHeight() + 40;
if(window.isBrokerPage) {
minTop = (mobile) ? 50 : 0;
}
var is_safari = navigator.userAgent.search("Safari") >= 0 && navigator.userAgent.search("Chrome") < 0;
//if(is_safari) {
var smallMobile = (window.innerWidth < 600);
var mapWidth = smallMobile ? 0 : $('#map').outerWidth() + 8;
$('#map').css({
top: minTop,
left: mapLeft,
opacity: 1,
zIndex: 1,
marginLeft: -mapWidth
});
$(window).resize(function() {
var smallMobile = (window.innerWidth < 600);
var mapWidth = smallMobile ? 0 : $('#map').outerWidth() + 8;
var mapLeft = smallMobile ? '53px' : '8px';
$('#map').css({
left: mapLeft,
marginLeft: -mapWidth
});
}).resize();
//} else {
// // if the screen is mobile, and we havent injected the button
// $('#map').css({
// top: minTop,
// left: mapLeft,
// opacity: 1,
// zIndex: 1
// });
//}
if ($('.close-map').length === 0) {
createMapCloseBtn();
}
}
// scroller function to move the map
function moveMap() {
var mobile = (window.innerWidth < 960);
var pos = (mobile) ? $(document).scrollTop() + 200 : $(document).scrollTop();
var minTop = $('#other-header').outerHeight() + $('#primary-nav').outerHeight() + 20;
if(window.isBrokerPage) {
minTop = 0;
pos = (mobile) ? $(document).scrollTop() + 50 : $(document).scrollTop();
}
if (pos > minTop) {
$('#map').css('top', pos);
// call this function with RAF
requestAnimationFrame(moveMap);
} else {
$('#map').css('top', minTop);
}
}
// use a dom ready function for these events
$(function () {
var searchCat = $('#sl_div').find('#cat').attr('textvalue');
if(searchCat && searchCat != 'broker') {
$('#div_nameSearch #nameSearch').attr('placeholder', 'Company Name');
}
// when the search is clicked
// and if the screensize is correct
// move the map under the nav on the left side
$('#addressSubmit').on('click', function () {
// timeout for the delayed map loading
setTimeout(function () {
setMapStart();
}, 1000);
// feebback to let people know that the form is actually working
//$('#address_search').append('<p id="searching-feedback">Searching...</p>');
$(this).attr('value', 'Searching...');
});
// used to avoid multiple listeners
var scrollListener = false;
// this event is trigger whenever the map is updated according to
// the slp.js file in the store-locator-le plugin
$('#map_sidebar').on('contentchanged', function () {
//$('#searching-feedback').remove();
$('#addressSubmit').attr('value', 'Search');
setMapStart();
if (!scrollListener) {
$(window).scroll(function () {
requestAnimationFrame(moveMap);
});
scrollListener = true;
}
// Check if the store has site url
var url = $(this).parent().find('.slp_result_website > a').attr('href');
if(url === undefined) {
$('.results_entry').find('.results_row_top .location_name').css('color', '#706f73');
}
//$(this).parent().find('.results_row_top').click(function() {
// var companyName = $(this).find('.location_name').text();
// var hasURL = $(this).find('.storelocatorlink');
// if(hasURL) {
// ga('send', 'event', 'broker', 'click', companyName);
// }
//});
});
});
});
});
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
jQuery(document).ready(function($) {
var term03 = $(".wheel-03 .term03");
var term04 = $(".wheel-03 .term04");
var term05 = $(".wheel-03 .term05");
var term06 = $(".wheel-03 .term06");
var term07 = $(".wheel-03 .term07");
var stepFrame = 5;
tl03 = new TimelineLite();
tl03
.to(term03, stepFrame, {
css: { className: "term term02" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term03, stepFrame, {
css: { className: "term term01" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term03, stepFrame, {
css: { className: "term term00" },
attr: { y: "-=50" },
ease: Linear.easeNone
});
tl04 = new TimelineLite();
tl04
.to(term04, stepFrame, {
css: { className: "term term03" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css: { className: "term term02" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css: { className: "term term01" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term04, stepFrame, {
css: { className: "term term00" },
attr: { y: "-=50" },
ease: Linear.easeNone
});
tl05 = new TimelineLite();
tl05
.to(term05, stepFrame, {
css: { className: "term term04" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: { className: "term term03" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: { className: "term term02" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term05, stepFrame, {
css: { className: "term term01" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
;
tl06 = new TimelineLite();
tl06
.to(term06, stepFrame, {
css: { className: "term term05" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: { className: "term term04" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: { className: "term term03" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term06, stepFrame, {
css: { className: "term term02" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
;
tl07 = new TimelineLite();
tl07
.to(term07, stepFrame, {
css: { className: "term term06" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: { className: "term term05" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: { className: "term term04" },
attr: { y: "-=50" },
ease: Linear.easeNone
})
.to(term07, stepFrame, {
css: { className: "term term03" },
attr: { y: "-=50" },
ease: Linear.easeNone
});
wheel03 = new TimelineMax({ repeat: 100, timeScale: 10, yoyo:true });
wheel03.add(tl03, 0);
wheel03.add(tl04, 0);
wheel03.add(tl05, 0);
wheel03.add(tl06, 0);
wheel03.add(tl07, 0);
wheel03.pause();
setInterval(myTimer, 1000);
function myTimer() {
//
if(!$('.full-screen').hasClass('paused')){
wheel03.play();
//
//$('canvas').remove();
setTimeout(() => {
wheel03.pause();
}, 500);
}
}
TweenMax.to(wheel03, 0.1, { timeScale: 10, ease: Circ.easeOut });
$(document).on('click', '.video-thumb', function(){
$('.full-screen').hide();
var video = document.getElementsByTagName('video')[0];
var sources = video.getElementsByTagName('source');
var track = video.getElementsByTagName('track');
sources[0].src = $(this).data('video');
track[0].src = $(this).data('cc');
video.load();
video.muted = false;
video.removeAttribute("loop");
$('.play').hide();
$('.pause').hide();
$('.product-header-image').css('background-image','none').css('background-color','#000');
$('#myVideo').css('position','relative').css('right','unset').css('min-width','unset').css('max-width','100vw').css('max-height','99.8%');;
video.setAttribute("controls","controls")
// if (video.requestFullscreen) {
// video.requestFullscreen();
// } else if (video.msRequestFullscreen) {
// video.msRequestFullscreen();
// } else if (video.mozRequestFullScreen) {
// video.mozRequestFullScreen();
// } else if (video.webkitRequestFullscreen) {
// video.webkitRequestFullscreen();
// }
});
$(document).on('click', '.pause', function(){
$('.full-screen').addClass('paused');
$(this).hide();
$('.play').show();
var video = document.getElementsByTagName('video')[0];
video.pause();
wheel03.pause();
});
$(document).on('click', '.play', function(){
$('.full-screen').removeClass('paused');
$(this).hide();
$('.pause').show();
var video = document.getElementsByTagName('video')[0];
video.play();
wheel03.play();
});
$('.video-thumb-title').sameHeight();
$(window).resize(function(){
$('.video-thumb-title').css('height','unset');
$('.video-thumb-title').sameHeight();
});
});
(function(document, history, location) {
var HISTORY_SUPPORT = !!(history && history.pushState);
var anchorScrolls = {
ANCHOR_REGEX: /^#[^ ]+$/,
OFFSET_HEIGHT_PX: 150,
/**
* Establish events, and fix initial scroll position if a hash is provided.
*/
init: function() {
this.scrollToCurrent();
window.addEventListener('hashchange', this.scrollToCurrent.bind(this));
document.body.addEventListener('click', this.delegateAnchors.bind(this));
},
/**
* Return the offset amount to deduct from the normal scroll position.
* Modify as appropriate to allow for dynamic calculations
*/
getFixedOffset: function() {
return this.OFFSET_HEIGHT_PX;
},
/**
* If the provided href is an anchor which resolves to an element on the
* page, scroll to it.
* @param {String} href
* @return {Boolean} - Was the href an anchor.
*/
scrollIfAnchor: function(href, pushToHistory) {
var match, rect, anchorOffset;
if(!this.ANCHOR_REGEX.test(href)) {
return false;
}
match = document.getElementById(href.slice(1));
if(match) {
rect = match.getBoundingClientRect();
anchorOffset = window.pageYOffset + rect.top - this.getFixedOffset();
window.scrollTo(window.pageXOffset, anchorOffset);
// Add the state to history as-per normal anchor links
if(HISTORY_SUPPORT && pushToHistory) {
history.pushState({}, document.title, location.pathname + href);
}
}
return !!match;
},
/**
* Attempt to scroll to the current location's hash.
*/
scrollToCurrent: function() {
this.scrollIfAnchor(window.location.hash);
},
/**
* If the click event's target was an anchor, fix the scroll position.
*/
delegateAnchors: function(e) {
var elem = e.target;
if(
elem.nodeName === 'A' &&
this.scrollIfAnchor(elem.getAttribute('href'), true)
) {
e.preventDefault();
}
}
};
window.addEventListener(
'DOMContentLoaded', anchorScrolls.init.bind(anchorScrolls)
);
})(window.document, window.history, window.location);
(function( $ ) {
// the sameHeight functions makes all the selected elements of the same height
$.fn.sameHeight = function() {
var selector = this;
var heights = [];
// Save the heights of every element into an array
selector.each(function(){
var height = $(this).height();
heights.push(height);
});
// Get the biggest height
var maxHeight = Math.max.apply(null, heights);
// Show in the console to verify
console.log(heights,maxHeight);
// Set the maxHeight to every selected element
selector.each(function(){
$(this).height(maxHeight);
});
};
}( jQuery ));
\ No newline at end of file
jQuery(document).ready( function($) {
// in case of bootstrap modal example:
$('.modal').on('shown.bs.modal', function () {
var documentScrollTop = $(document).scrollTop();
$(document).on('scroll.noScroll', function() {
$(document).scrollTop(documentScrollTop);
return false;
});
}).on('hidden.bs.modal', function() {
$(document).off('scroll.noScroll');
});
$('input').iCheck({
checkboxClass: 'icheckbox_square-green',
radioClass: 'iradio_square-green',
increaseArea: '20%' // optional
});
function scrollScripts() {
if(!jQuery('#content-wrap').hasClass('retract')) {
if(jQuery(window).scrollTop() >= 150) {
jQuery('#content-wrap').addClass('retract');
jQuery('#page-header-seedit').addClass('retract');
jQuery('#mySidenav').addClass('retract');
jQuery('#page-header-part').addClass('retract');
jQuery('#myTopnav').css('top', '40px');
jQuery('#menu-seedit-main').css('margin-top', '15px');
jQuery('.tag-line').hide();
}
} else {
if(jQuery(window).scrollTop() < 170) {
jQuery('#content-wrap').removeClass('retract');
jQuery('#page-header-seedit').removeClass('retract');
jQuery('#mySidenav').removeClass('retract');
jQuery('#page-header-part').removeClass('retract');
jQuery('#menu-seedit-main').css('margin-top', '50px');
jQuery('.tag-line').show();
jQuery('#myTopnav').css('top', '100px');
}
}
}
jQuery( ".rect" ).each(function( index ) {
var rec = $(this);
setTimeout(function() {
$(rec).css('visibility','visible');
}, index * 500);
});
$(document).on("click",".btn.story",function() {
$('.sub-header').show();
$('.modal-title').show();
$('.modal-thanks').hide();
$('.form').children().show();
$('.load').hide();
$('[name="project_id"]').val($('[name="post_id"]').val());
$('[name="post_date"]').val( $('#date').val());
$('#exampleModalAddStory').modal('show');
});
$(document).on("click",".btn.photo",function() {
$('.sub-header').show();
$('.modal-title').show();
$('.modal-thanks').hide();
$('.form').children().show();
$('.load').hide();
$('[name="project_id"]').val($('[name="post_id"]').val());
$('[name="post_date"]').val( $('#date').val());
$('#exampleModalAddPhoto').modal('show');
});
$(document).on("click",".btn.comment",function() {
$('.sub-header').show();
$('.modal-title').show();
$('.modal-thanks').hide();
$('.form').children().show();
$('.load').hide();
$('[name="project_id"]').val($('[name="post_id"]').val());
$('[name="post_date"]').val( $('#date').val());
$('#exampleModalAddComment').modal('show');
});
$(document).on("click",".wpcf7-submit",function() {
$('.load').show();
});
document.addEventListener( 'wpcf7submit', function( event ) {
setTimeout(function(){
if(jQuery('.wpcf7-not-valid').length > 0) {
jQuery('html,body').animate({scrollTop: jQuery('.wpcf7-not-valid').first().offset().top -150}, 'linear')
}
}, 1000);
setTimeout(function(){
$('.load').hide();
}, 1000);
}, false );
document.addEventListener( 'wpcf7mailsent', function( event ) {
$('.load').hide();
$('.sub-header').hide();
$('.modal-title').hide();
$('.form').children().hide();
$('.modal-thanks').show();
$('.wpcf7-response-output').show();
if($('.modal.fade.in').length == 0) {
setTimeout(function(){
$([document.documentElement, document.body]).animate({
scrollTop: $('.wpcf7-response-output').offset().top - 150
}, 2000);
}, 1000);
}
});
$(".moreBox").slice(0, 3).show();
if ($(".blogBox:hidden").length != 0) {
$("#loadMore").show();
}
jQuery(document).on("click", "#loadMore", function(e) {
e.preventDefault();
$(".moreBox:hidden").slice(0, 3).slideDown();
if ($(".moreBox:hidden").length == 0) {
$("#loadMore").fadeOut('slow');
}
});
$(document).on("click",".btn.fb",function() {
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');
});
jQuery(document).on("click",".share_read_more",function(evt) {
evt.preventDefault();
$(".modal-body.story").html('<img class="loading" src="https://thecommonwell.ca/wp-content/themes/commonwell-corp/images/loading.svg"/>');
$('.sub-header').show();
$('.modal-title').show();
$("#exampleModalLong").modal("show");
var id = $(this).data('id');
console.log(id);
$.ajax({
type: 'POST',
url: '../../wp-admin/admin-ajax.php',
dataType: 'json',
data: {
'post_id': id,
'action': 'ajax_request' //this is the name of the AJAX method called in WordPress
}, success: function (data) {
$(".sub-header.story").html(data['date']+'<br/>Submitted by '+data['post'].post_title);
$(".modal-body.story").html(data['post'].post_content);
console.log(data['post']);
},
error: function () {
alert("error");
}
});
return false;
});
jQuery(document).on("click","#menu-seedit-main li a",function(evt) {
jQuery('#mySidenav').removeClass('mobile-open');
});
document.addEventListener('dblclick', (event) => {
event.preventDefault()
}, { passive: false });
var scrolling = false;
jQuery( window ).scroll( function() {
scrolling = true;
});
jQuery('#side-window').scroll(function() {
scrolling = true;
});
setInterval( function() {
if ( scrolling ) {
scrolling = false;
scrollScripts();
}
}, 250 );
// or for modern browsers
document.addEventListener( 'wheel', function( evt ) {
scrolling = true;
}, { capture: false, passive: true });
scrollScripts();
var el = document.getElementById('commonwell-link');
var style = window.getComputedStyle(el, null).getPropertyValue('font-size');
var fontSize = style;
var fontSizePercentage = parseFloat(style) / 12 * 100;
if( fontSizePercentage > 100){
document.body.className += ' large_font';
// $('.menu-item-220 a').attr('href','/news/');
}
if( fontSizePercentage > 125){
document.body.className += ' xlarge_font';
}
console.log(style, fontSizePercentage);
});
jQuery(window).load(function() {
if(location.hash) {
var id = jQuery(location.hash);
jQuery('html,body').animate({scrollTop: id.offset().top -150}, 'linear')
}
});
jQuery(document).ready( function() {
function scrollScripts() {
if(!jQuery('#content-wrap').hasClass('retract')) {
if(jQuery(window).scrollTop() >= 150) {
jQuery('#content-wrap').addClass('retract');
jQuery('#page-header-seedit').addClass('retract');
jQuery('#mySidenav').addClass('retract');
jQuery('#page-header-part').addClass('retract');
jQuery('#myTopnav').css('top', '40px');
jQuery('#menu-seedit-main').css('margin-top', '15px');
jQuery('.tag-line').hide();
document.querySelector(".otherpage-logo").getSVGDocument().getElementById("Community_Nutrition_Resources_Food_Security").setAttribute("fill-opacity", "0");
}
} else {
if(jQuery(window).scrollTop() < 170) {
jQuery('#content-wrap').removeClass('retract');
jQuery('#page-header-seedit').removeClass('retract');
jQuery('#mySidenav').removeClass('retract');
jQuery('#page-header-part').removeClass('retract');
jQuery('#menu-seedit-main').css('margin-top', '50px');
jQuery('.tag-line').show();
jQuery('#myTopnav').css('top', '100px');
document.querySelector(".otherpage-logo").getSVGDocument().getElementById("Community_Nutrition_Resources_Food_Security").setAttribute("fill-opacity", "1");
}
}
}
jQuery(document).on("click","#menu-seedit-main li a",function(evt) {
jQuery('#mySidenav').removeClass('mobile-open');
});
document.addEventListener('dblclick', (event) => {
event.preventDefault()
}, { passive: false });
var scrolling = false;
jQuery( window ).scroll( function() {
scrolling = true;
});
jQuery('#side-window').scroll(function() {
scrolling = true;
});
setInterval( function() {
if ( scrolling ) {
scrolling = false;
scrollScripts();
}
}, 250 );
// or for modern browsers
document.addEventListener( 'wheel', function( evt ) {
scrolling = true;
}, { capture: false, passive: true });
scrollScripts();
var el = document.getElementById('commonwell-link');
var style = window.getComputedStyle(el, null).getPropertyValue('font-size');
var fontSize = style;
var fontSizePercentage = parseFloat(style) / 12 * 100;
if( fontSizePercentage > 100){
document.body.className += ' large_font';
// $('.menu-item-220 a').attr('href','/news/');
}
if( fontSizePercentage > 125){
document.body.className += ' xlarge_font';
}
console.log(style, fontSizePercentage);
});
define(
['jquery', 'featherlight'], function ($) {
$(document).ready(
function () {
var $canadaPostButton = $('.canada-post-icon-button');
var tl = new TimelineMax(
{
repeat: -1,
repeatDelay: 10
}
);
tl
.to(
$canadaPostButton, 0.25, {
scaleX: 1.1,
scaleY: 1.1,
force3D: true,
ease: Linear.easeNone
}
)
.to(
$canadaPostButton, 0.25, {
scaleX: 0.95,
scaleY: 0.95,
force3D: true,
ease: Linear.easeNone
}
)
.to(
$canadaPostButton, 0.25, {
scaleX: 1,
scaleY: 1,
force3D: true,
ease: Linear.easeNone
}
);
}
);
}
);
define(
['jquery'], function ($) {
$(document).ready(
function () {
// Check if browser supports HTML5 input placeholder
function supports_input_placeholder() {
var i = document.createElement('input');
return 'placeholder' in i;
}
// Change input text on focus
if (!supports_input_placeholder()) {
jQuery('.wpcf7-text').each(
function () {
var self = jQuery(this);
var value = jQuery.trim(self.val());
if (value == '') self.val(self.attr('placeholder'));
}
);
jQuery('.wpcf7-text').focus(
function () {
var self = jQuery(this);
if (self.val() == self.attr('placeholder')) self.val('');
}
).blur(
function () {
var self = jQuery(this);
var value = jQuery.trim(self.val());
if (value == '') self.val(self.attr('placeholder'));
}
);
}
//functionality for add-file link
$('a.add_file').on(
'click', function (e) {
//show by click the first one from hidden inputs
$('p.hide:not(:visible):first').show('slow');
e.preventDefault();
}
);
//functionality for del-file link
$('a.del_file').on(
'click', function (e) {
//var init
var input_parent = $(this).parent();
var input_wrap = input_parent.find('span');
//reset field value
input_wrap.html(input_wrap.html());
//hide by click
input_parent.hide('slow');
e.preventDefault();
}
);
$('a.first-file').on(
'click', function (e) {
//reset field value
$('.wpcf7-file').eq(0).replaceWith($('.wpcf7-file').eq(0).val('').clone(true));
$(this).hide();
e.preventDefault();
}
);
$('.wpcf7-file').eq(0).change(
function () {
var fileName = $(this).val();
if (fileName != '') {
$('a.first-file').show();
} else {
$('a.first-file').hide();
}
}
);
var eventFields = $('input[name="event-date"], input[name="event-location"], textarea[name="purpose-event"], input[name="role"], textarea[name="recognize-event"]');
eventFields.removeClass('wpcf7-validates-as-required');
eventFields.parents('.form-control').hide();
$('input[name="donation"]').click(
function () {
var value = $(this).attr('value');
var isDonation = value.indexOf('donation') > 0;
var requiredClassName = 'wpcf7-validates-as-required';
var requiredAttr = "aria-required";
var eventFields = $('input[name="event-date"], input[name="event-location"], textarea[name="purpose-event"], input[name="role"], textarea[name="recognize-event"]');
// Check if it is donation or event
if (!isDonation) {
eventFields.addClass(requiredClassName).attr(requiredAttr, true);
eventFields.parents('.form-control').slideDown();
} else {
eventFields.removeClass(requiredClassName).attr(requiredAttr, false);
eventFields.parents('.form-control').slideUp();
}
}
);
}
);
}
);