/* arya */
$(document).ready(function () {
arya.init();
});
var arya = {
mode: '',
optionsGlobal: optionsGlobal,
optionsCampaign: optionsCampaign,
options: {},
campaign_stats: campaign_stats,
campaign_stats_last_donators: campaign_stats_last_donators,
context_lang: context_lang,
pageTypeRender: '',
preloader: function () {
var _arya_preloader = _arya_preloader || 1000;
$('body').prepend('
');
setTimeout(function () {
$('#loader').fadeOut('slow', function () {
// Animation complete.
arya.adaptHeight();
});
}, _arya_preloader);
$('#type-b').addClass('loaded');
},
adaptHeight: function () {
if (typeof Steps != 'undefined') {
Steps.adapted_height || ($('#step-1 .step-content').children().wrapAll(''), $('#step-2 .step-content').children().wrapAll(''), $("#step-3 .step-content").children().wrapAll(''), $(window).load(Steps.adaptHeight)), Steps.adapted_height = !0;
var e = $('#step-1 .height_adaptor').height(),
t = $('#step-2 .height_adaptor').height(),
a = $('#step-3 .height_adaptor').height(),
i = Math.max(e, t, a);
$('.step-content').height(i);
}
},
init: function () {
// init options from global or campaigns
arya.initThemeOptions();
},
start: function () {
arya.pageTypeRender();
arya.stepsRender();
arya.placeholders();
arya.step1();
arya.step2();
arya.step3();
arya.stepInfos();
arya.initWidgets();
arya.amountsRender();
$('body').bind('change_amount', arya.changeAMount);
if ($('#greetings').length > 0) {
$('body').addClass('thanks-page');
}
arya.preloader();
aryaAmounts.init();
arya.initCssOptions();
arya.initVar()
if (arya.amount_in_valid == '1') {
arya.btnRender();
}
arya.colorAdjust();
setTimeout(function () {
arya.sizing();
}, 2000);
},
initThemeOptions: function () {
arya.options = {
'KFJEi9kava0x5LjA0SMy': '',
'active_theme': '',
'font': '',
'font_title': '',
'wedge': '',
'donation_grid': '',
'one_column_mobile': '',
'widgets_footer': '',
'widgets_header': '',
'widgets_progress_bar_goal': '',
'widgets_progress_bar_text': '',
'widgets_last_donors': '',
'widgets_last_donors_filter': '',
'widgets_last_donors_text': '',
'widgets_cookies_banner': '',
'widgets_cookies_banner_text': '',
'--main-action-color': '',
'--main-action-color-lighter': '',
'--description-color': '',
'--information-color': '',
'--column-background-color': '',
'--banner-color': '',
'--banner-color-darker': ''
};
if (arya.optionsCampaign['active_theme'] == '1' && (arya.optionsCampaign['overload_theme'] == '1' || typeof arya.optionsGlobal['active_theme'] == 'undefined')) {
arya.mode = 'campaign';
} else if (arya.optionsGlobal['active_theme'] == '1') {
arya.mode = 'global';
} else {
arya.mode = 'off';
}
arya.setTheme(arya.mode);
},
setTheme: function (mode) {
switch (mode) {
case 'global':
$('body').addClass('arya');
//console.log(' theme global ON');
$.each(arya.optionsGlobal, function (key, value) {
arya.options[key] = arya.optionsGlobal[key];
});
arya.options['widgets_last_donors_text'] = arya.optionsGlobal['widgets_last_donors_text_' + arya.context_lang];
arya.options['widgets_progress_bar_text'] = arya.optionsGlobal['widgets_progress_bar_text_' + arya.context_lang];
arya.options['widgets_cookies_banner_text'] = arya.optionsGlobal['widgets_cookies_banner_text_' + arya.context_lang];
console.log('ARYA GLOBAL');
arya.start();
break;
case 'campaign':
$('body').addClass('arya');
//console.log(' OVERLOAD theme campagne ON');
$.each(arya.optionsCampaign, function (key, value) {
arya.options[key] = arya.optionsCampaign[key];
});
arya.options['widgets_last_donors_text'] = arya.optionsCampaign['widgets_last_donors_text_' + arya.context_lang];
arya.options['widgets_progress_bar_text'] = arya.optionsCampaign['widgets_progress_bar_text_' + arya.context_lang];
arya.options['widgets_cookies_banner_text'] = arya.optionsCampaign['widgets_cookies_banner_text_' + arya.context_lang];
console.log('ARYA CAMPAIGN');
arya.start();
break;
case 'off':
console.log('ARYA OFF');
return;
break;
default:
console.log('ARYA OFF');
}
},
initCssOptions: function () {
let root = document.documentElement;
root.style.setProperty('--main-action-color', arya.options['--main-action-color']);
root.style.setProperty('--main-action-color-lighter', utils.lightenDarkenColor(arya.options['--main-action-color'], 35));
root.style.setProperty('--border-radius', arya.options['wedge'] + 'px');
root.style.setProperty('--description-color', arya.options['--description-color']);
root.style.setProperty('--information-color', arya.options['--information-color']);
root.style.setProperty('--column-background-color', arya.options['--column-background-color']);
root.style.setProperty('--banner-color', arya.options['--banner-color']);
root.style.setProperty('--banner-color-darker', utils.lightenDarkenColor(arya.options['--banner-color'], -45));
if( arya.options['font'] != ''){
WebFont.load({
google: {
families: [arya.options['font'] + ':300,700']
}
});
}
if( arya.options['font_title'] != ''){
WebFont.load({
google: {
families: [arya.options['font_title'] + ':300,700']
}
});
}
$('body').css('font-family', arya.options['font']);
$('#type-b.arya h1, #type-b.arya h2, #type-b.arya h3, #type-b.arya h4, #type-b.arya h5, #type-b.arya h6').css('font-family', arya.options['font_title']);
if (typeof Step3 != 'undefined') {
Step3.select('h4').css('font-family', arya.options['font_title']);
}
},
initVar: function () {
if (typeof amount_in_valid_text != 'undefined' && amount_in_valid_text != '') {
arya.amount_btn_text = amount_in_valid_text;
} else {
if (typeof Step3 != 'undefined') {
arya.amount_btn_text = Step3.select('.payment-submit .button').first().val();
}
}
if (typeof amount_in_valid != 'undefined') {
arya.amount_in_valid = amount_in_valid;
}
},
initWidgets: function () {
if (arya.options['widgets_last_donors'] == 'true' && arya.pageTypeRender == 'form_page') {
arya.widgets_last_donors();
};
if (arya.options['widgets_header'] == '3' && arya.pageTypeRender == 'form_page') {
arya.widgets_progress_bar();
};
if (arya.options['one_column_mobile'] == 'true') {
arya.oneColumn();
};
if (arya.options['widgets_cookies_banner'] == 'true') {
arya.widgets_cookiesBanner();
};
},
changeAMount: function () {
arya.adaptHeight();
arya.sizing();
arya.UpdateCreditCardType();
},
widgets_cookiesBanner: function () {
if (Cookies.get('cookies_accepted') != 'true') {
$('#container').prepend('' + arya.options['widgets_cookies_banner_text'] + 'ok
');
$('#cookiesBanner .close').on('click', function () {
$('#cookiesBanner').slideUp('slow', function () {
// Animation complete.
Cookies.set('cookies_accepted', 'true');
});
});
}
},
pageTypeRender: function(){
if( typeof Thanks == 'undefined' && typeof Steps == 'undefined'){
arya.pageTypeRender = 'annexes_pages';
$('body').addClass('annexes_pages');
$('body #main').wrapInner('');
$('body #footer').wrapInner('');
} else if( typeof Thanks != 'undefined'){
arya.pageTypeRender = 'thanks_page';
$('body').addClass('thanks_page');
} else {
arya.pageTypeRender = 'form_page';
}
},
stepsRender: function () {
if (typeof $('body').attr('id') == 'undefined') {
$('body').attr('id', 'type-b');
}
if ($('#lang').length > 0) {
$('body').addClass('i18n');
}
if (arya.options['widgets_header'] == 2 || arya.options['widgets_header'] == 3) {
$('body').addClass('header-banner');
}
$('body.annexes_pages #header').wrapInner('