/* Moria */ $(document).ready(function() { moria.initCountry(); moria.initVar() moria.init(); if ( moria.amount_in_valid == '1' ){ moria.btnRender(); } amounts.init(); }); var moria = { options : options, translations : translations, geolocCountry : '', redirections : redirections, step1reassurance :step1reassurance, step2reassurance :step2reassurance, step3reassurance :step3reassurance, step1reassuranceTitle :step1reassuranceTitle, step2reassuranceTitle :step2reassuranceTitle, step3reassuranceTitle :step3reassuranceTitle, initCountry : function(){ $.getScript('https://services.iraiser.eu/geoip/api/v1/geoip.jsonp', function( data, textStatus, jqxhr ) { moria.geolocCountry = abGeoIp.countryCode; console.log('moria.geolocCountry : '+moria.geolocCountry); if( moria.geolocCountry != 'null' ){ // on a une geoloc de trouvée par l'API // moria.redirections[sophia.geolocCountry] if ( typeof moria.redirections[moria.geolocCountry] != 'undefined' ){ moria.goToRedirections(moria.redirections[moria.geolocCountry].url); } }else { //No geoloc trouvé return false; } }); }, initVar : function(){ if(moria.step1reassurance == false){moria.step1reassurance = ''}; if(moria.step2reassurance == false){moria.step2reassurance = ''}; if(moria.step3reassurance == false){moria.step3reassurance = ''}; if(moria.step1reassuranceTitle == false){moria.step1reassuranceTitle = ''}; if(moria.step2reassuranceTitle == false){moria.step2reassuranceTitle = ''}; if(moria.step3reassuranceTitle == false){moria.step3reassuranceTitle = ''}; if( typeof amount_in_valid_text != 'undefined' && amount_in_valid_text != ''){ moria.amount_btn_text = amount_in_valid_text; }else { if (typeof Step3 != 'undefined') { moria.amount_btn_text = Step3.select('.payment-submit .button').first().val(); } } if(typeof amount_in_valid != 'undefined' ){ moria.amount_in_valid = amount_in_valid; } }, init : function(){ console.log('FUNCTION init'); //console.log('amount is : '+Common.getDonation().amount); moria.stepsRender(); //moria.initAmount(); moria.step1(); moria.step2(); moria.step3(); moria.stepInfos(); moria.amountsRender(); if( typeof Step1 != 'undefined' && typeof Step1.getDonation().frequency != 'undefined' ){ var frequency = Step1.getDonation().frequency; var tabs_first = $('.tabs ul li:first-child').attr('aria-controls'); //console.log( frequency ); //console.log( tabs_first ); if( frequency != tabs_first ){ $('.tabs').tabs({ active: 1 }); } } moria.changeAMount() $('body').bind('change_amount', moria.changeAMount); /* custo client */ if( $('html').attr('lang') == 'de_DE' ){ $('#footer').load('/libs.iraiser.eu/users/irc/ircBlackFooter_GERMANY.html #import_html', function(){ var footerHeight = $('#footer').outerHeight(); $('#container').css('padding-bottom', footerHeight) }); } if( $('html').attr('lang') == 'se_SE' ){ $('#footer').load('/libs.iraiser.eu/users/irc/ircBlackFooter_SWEDEN.html #import_html', function(){ var footerHeight = $('#footer').outerHeight(); $('#container').css('padding-bottom', footerHeight) }); } /* end custo client */ var footerHeight = $('#footer').outerHeight(); $('#container').css('padding-bottom', footerHeight); if( typeof Steps != 'undefined'){ Steps.adaptHeight(); } }, initAmount : function(){ console.log('FUNCTION initAmount'); //console.log('amount is : '+Common.getDonation().amount); var tempAmount = Common.getDonation().amount; console.log('amount = '+tempAmount) defaultRegularAmount = $('[name=amount-regular]:eq( -2 )').val(); defaultOnceAmount = $('[name=amount-once]:eq( -2 )').val(); if ( Common.getDonation().amount == 0 && Common.getDonation().frequency == 'regular'){ console.log(' regular no amount !'); Step1.set_donation({ amount: defaultRegularAmount, frequency: 'regular' }); } if ( Common.getDonation().amount == 0 && Common.getDonation().frequency == 'once'){ console.log(' once no amount !'); Step1.set_donation({ amount: defaultOnceAmount, frequency: 'once' }); } }, changeAMount : function(){ console.log('FUNCTION changeAmount'); //console.log('amount is : '+Common.getDonation().amount); if( typeof Steps != 'undefined'){ Steps.adaptHeight(); } }, goToRedirections : function(url){ console.log('URL DE REDIRECTION : '+url); document.location.href = url; }, stepsRender : function(){ if( moria.options['header'] == 2 ){ $('body').addClass('header-banner'); } $('body:not(#type-a):not(#type-b) #header').wrapInner('
\ '+moria.translations['security_info']+'\
'); $('#security-info').appendTo('#step-3 .height_adaptor') }, step3 : function(){ if( typeof Step3 != 'undefined'){ Step3.select('[name=cardtype]').after(''); Step3.select('#card-type').append(''); /* typeA hack*/ $('#type-a [name=cardtype]').after(''); $('#type-a #card-type').append(''); Step3.select('[name=cardtype]').change(function(event) { $('#card-type li').removeClass('selected'); $(this).parents('li').addClass('selected'); }); /* typeA hack*/ $('#type-a [name=cardtype]').change(function(event) { $('#card-type li').removeClass('selected'); $(this).parents('li').addClass('selected'); }); /* Step3.select('#card-scode').each(function(index, el) { $(this).after($(this).find('.help')); }); */ /*placeholder*/ Step3.select('#card-number label, #card-scode label, #card-expiry label, #iban-input label, #bic-input label').each(function(index, el) { var input = $(this).next(':input'); $(this).find('.help').remove(); if (input.attr('type') == 'text') { input.attr('placeholder', $(this).text()); $(this).hide(); } }); Step3.select('#gocardless_autogiro_sin label, #gocardless_autogiro_branch label, #gocardless_autogiro_account label, #swish_account_number label').each(function(index, el) { var input = $(this).next(':input'); var el = $(this).clone(); el.find('span').remove(); var text = el.text(); var labelText = text.trim() $(this).find('.help').remove(); if (input.attr('type') == 'text') { input.attr('placeholder', labelText+' *'); $(this).hide(); } }); //Step3.select('#payment_mode-swish_account .payment_mode_title').html(''); /* typeA hack*/ $('#type-a #card-number label').each(function(index, el) { var input = $(this).next(':input'); $(this).find('.help').remove(); if (input.attr('type') == 'text') { input.attr('placeholder', $(this).text()); $(this).hide(); } }); Step3.select('.payment_body').hide(); if ( typeof Step1 != 'undefined'){ $('.payment_mode h4',Step1['payment_modes_regular']).each(function(index, el) { $(this).click(function(event) { if ($(this).siblings('.payment_body').is(':visible')){ return; }else { $('.payment_body',Step1['payment_modes_regular']).slideUp(); $('.payment_mode h4',Step1['payment_modes_regular']).removeClass('active'); $(this).siblings('.payment_body').slideDown(); $(this).addClass('active'); } }); }); $('.payment_mode h4',Step1['payment_modes_once']).each(function(index, el) { $(this).click(function(event) { if ($(this).siblings('.payment_body').is(':visible')){ return; }else { $('.payment_body',Step1['payment_modes_once']).slideUp(); $('.payment_mode h4',Step1['payment_modes_once']).removeClass('active'); $(this).siblings('.payment_body').slideDown(); $(this).addClass('active'); } }); }); } Step3.select('#payment_mode-paypal .payment_head').each(function(index, el) { $(this).find('.payment_mode_title').html(''); }); Step3.select('#payment_mode-apple_pay .payment_head').each(function(index, el) { $(this).find('.payment_mode_title').html(''); }); /* on garde tout fermé pour IRC mais en fait non ou ouvre le premier */ Step3.select('.payment_mode:first-of-type h4').click(); /* lol */ /*clear*/ $('#step-3 .step-content').append(''); } if( typeof moria.translations['privacy_text'] != 'undefined'){ $('#step-2 #fieldset-step2').after(''+moria.translations['privacy_text']+'
'); } if( typeof moria.translations['payment_text'] != 'undefined'){ $('#step-3 .payment').after(''+moria.translations['payment_text']+'
'); } if( typeof moria.translations['swish_text'] != 'undefined' && typeof Step3 != 'undefined' ){ Step3.select('#payment_mode-swish_account').after(''+moria.translations['swish_text']+'
'); } if( typeof moria.translations['autogiro_text'] != 'undefined' && typeof Step3 != 'undefined' ){ Step3.select('#payment_mode-gocardless_autogiro').after(''+moria.translations['autogiro_text']+'
'); } }, stepInfos : function(){ // IRC moria.options = {'footer':1}; if( moria.options['footer'] == 1 ){ $('body').addClass('footer-detach') $('#step-1 .step-info').appendTo('#bottom .container').addClass('step-info-1'); $('#step-2 .step-info').appendTo('#bottom .container').addClass('step-info-2'); $('#step-3 .step-info').appendTo('#bottom .container').addClass('step-info-3'); $('#bottom').append(''); /* remove then add again ... but only step3*/ if( $('#greetings').length > 0 ){ $('#bottom .container').append(''); $('#bottom .container').append(''); $('#bottom .container').append(''+text+'
'; } var block = ''+text+'
'; } var block = '