window.__lc = window.__lc || {};
window.__lc.license = 10681387;
(function() {
var lc = document.createElement('script'); lc.type = 'text/javascript'; lc.async = true;
lc.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'cdn.livechatinc.com/tracking.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(lc, s);
})();
var breeze_prefetch = {"local_url":"https:\/\/mentalhealth.openpathcollective.org","ignore_remote_prefetch":"1","ignore_list":["\/register\/","\/wp-admin\/"]};
https://mentalhealth.openpathcollective.org/wp-content/plugins/breeze/assets/js/js-front-end/breeze-prefetch-links.min.js
https://mentalhealth.openpathcollective.org/wp-includes/js/jquery/jquery.min.js
https://mentalhealth.openpathcollective.org/wp-includes/js/jquery/jquery-migrate.min.js
https://mentalhealth.openpathcollective.org/wp-content/plugins/breeze/assets/js/js-front-end/breeze-lazy-load.min.js
console.log("%cDesign and development by http://benrosati.com", "color: #4fb06f; font-style: italic");
//Zopim
// $zopim(function(){
// $zopim.livechat.setOnStatus(badge );
// function badge ( status ) {
// if ( status == 'online' ) {
// $('.liveChat').html('Live Chat: <strong style="color: #008000;">Online - Click here</strong>');
// }
// }
// $zopim.livechat.hideAll();
// });
////////////////////////////////////////
//Check Required Fields
////////////////////////////////////////
function required(form){
var valid = true;
form.find(".required").each(function(){
$(this).parent().children("label").css("color", "inherit");
$(this).css("border-color", "#ccc");
if( $(this).is(':checkbox') && $(this).prop('checked') != true || $(this).val() == "" ){
valid = false;
$(this).parent().children("label").css("color", "rgb(255, 89, 89)");
$(this).css("border-color", "rgb(255, 89, 89)");
}
});
return valid;
}
////////////////////////////////////////
//Check URL FOR QUEURY
////////////////////////////////////////
var getQueryVariable = function(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
jQuery(document).ready(function($) {
////////////////////////////////////////
//ESCAPE
////////////////////////////////////////
$('.escape__button').click(function(){
window.location.replace("https://www.google.com/");
window.open("https://www.wunderground.com/news/", '_blank');
});
$('.escape__message').click(function(){
Cookies.set('emergency', '1');
TweenMax.to('.escape__message', 0.2, {display: 'none', opacity: 0, scale: 0});
});
////////////////////////////////////////
//NAVIGATION
////////////////////////////////////////
var TL__dropdown = new TimelineMax({paused:true});
TL__dropdown.to('.dropdown', 0.25, {opacity:1, top:45, display:'block'});
var TL__support = new TimelineMax({paused:true});
TL__support.to('.support', 0.25, {opacity:1, top:45, display:'block'});
var TL__hamburger = new TimelineMax({paused:true});
TL__hamburger.to('.rect1', 0.25, {y: '+=10'});
TL__hamburger.to('.rect3', 0.25, {y: '-=10'}, "-=0.25");
TL__hamburger.to('.rect1, .rect3', 0.25, {rotation:"+=45", transformOrigin:"50% 50%"});
TL__hamburger.to('.rect2', 0.25, {rotation:"-=45", transformOrigin:"50% 50%"}, "-=0.25");
$('.nav__hamburger').click(function(){
if( $('.nav__hamburger').hasClass('active') ){
$('.nav__hamburger').removeClass('active');
$('.nav__hamburger__title').text('Menu');
TL__hamburger.reverse();
$('.nav__mobile').slideUp();
} else {
$('.nav__hamburger').addClass('active');
$('.nav__hamburger__title').text('Close');
TL__hamburger.play();
$('.nav__mobile').slideDown();
}
});
$(window).resize(function(){
if( $(window).width() >= 780 ){
if( $('.nav__hamburger').hasClass('active') ){
$('.nav__hamburger').removeClass('active');
$('.nav__hamburger__title').text('Menu');
TL__hamburger.reverse();
$('.nav__mobile').slideUp();
}
}
});
$('.nav__mobile__link--support').click(function(){
$('.nav__mobile__support').slideToggle();
});
$('a[data-action="call__account"]').on('click', function(event){
if( $('a[data-action="call__account"]').hasClass('active') ){
$('a[data-action="call__account"]').removeClass('active');
TL__dropdown.reverse();
} else {
$('a[data-action="call__account"]').addClass('active');
TL__dropdown.play();
}
event.stopPropagation();
});
$('a[data-action="call__support"]').on('click', function(event){
if( $('a[data-action="call__support"]').hasClass('active') ){
$('a[data-action="call__support"]').removeClass('active');
TL__support.reverse();
} else {
$('a[data-action="call__support"]').addClass('active');
TL__support.play();
}
event.stopPropagation();
});
$(document).on('click', function(event){
if( $('a[data-action="call__account"]').hasClass('active') ){
$('a[data-action="call__account"]').removeClass('active');
TL__dropdown.reverse();
}
if( $('a[data-action="call__support"]').hasClass('active') ){
$('a[data-action="call__support"]').removeClass('active');
TL__support.reverse();
}
event.stopPropagation();
});
TweenMax.to('body', 0.5, { opacity:1, delay:0.25 });
});
jQuery(document).ready(function($) {
$('html').css('backgroundColor', '#edeff0');
$('body').css({'boxShadow' : 'none', 'background' : 'transparent', 'max-width' : 'none'});
if ( parseInt(Cookies.get('login')) > 10 ) {
$('.login__form__alert').html('Too many attempts. <a href="https://mentalhealth.openpathcollective.org/recover/">Reset password</a>').slideDown();
$('.action--login, .login__form__input__username, .login__form__input__password').unbind();
}
function FN__login( form ){
var valid = required( form );
$('.action--login').text('Processing...');
if ( valid == true ){
$.ajax({
url: 'https://mentalhealth.openpathcollective.org/wp-admin/admin-ajax.php?action=login',
method: 'POST',
data: {
"username": $('.login__form__input__username').val(),
"pass": $('.login__form__input__password').val()
},
success: function( data ) {
if( data == 1){
Cookies.remove('login');
window.location.href = "https://mentalhealth.openpathcollective.org/account/";
} else if( Cookies.get('login') ){
var i = parseInt(Cookies.get('login'));
i++;
Cookies.set('login', i);
if( i > 10){
$('.login__form__alert').html('Too many attempts. <a href="https://mentalhealth.openpathcollective.org/recover/">Reset password</a>').slideDown();
$('.action--login').remove();
} else {
$('.login__form__alert').html( data ).slideDown();
$('.action--login').text('Resubmit credentials');
}
} else {
Cookies.set('login', '1');
$('.login__form__alert').html( data ).slideDown();
$('.action--login').text('Resubmit credentials');
}
},
error: function(xhr, ajaxOptions, thrownError) { console.log(xhr.responseText); }
});
}
}
$('.action--login').click(function(){
FN__login( $(this).parent().parent() );
});
$('.login__form__input__username, .login__form__input__password').keypress(function(e) {
if(e.which == 13) { FN__login( $(this).parent().parent() ); }
});
});
https://mentalhealth.openpathcollective.org/wp-content/themes/custom/static/js/main.js