function loginMe(e) { } $(document).ready(function () { var lastLoginBtnSource = null; var TEST_COOKIE = 'test_cookie'; $.cookie(TEST_COOKIE, true); if ($.cookie(TEST_COOKIE)) { $.cookie(TEST_COOKIE, null); // delete the cookie } else { $("#form-login").html("Prosimo vklopite piškotke!"); } $('.submit-login').live('click', function (event) { event.preventDefault(); function isValidEmailAddress(emailAddress) { var pattern = new RegExp(/^((([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i); return pattern.test(emailAddress); }; if (!isValidEmailAddress($('#form_login_username').val())) { //$('#submit-login').prop("disabled", true); // Element(s) are now enabled. $('#error-email-login').html('E-mail naslov ni pravilnega formata'); $('#error-email-login').show(); return false; } var login_box = $('#login-popupbox'); var navigation = $("#main-nav"); if ($('#cookie_remember_me:checked').val() == 1) { var remmember = 1; } else { var remmember = 0; } var form_data = { username: $('#form_login_username').val(), password: $('#form_login_password').val(), remember_me: remmember, smatch_id: $('.session_match').val(), comment: $('.attr-comment').val(), ajax: '1' }; var type = $(event.target).hasClass("fb") ? 'login/fb' : 'ajax/checkLogin'; $.ajax({ url: base_url + type, type: 'POST', async: false, data: form_data, success: function (msg) { //info@digital.cx login_box.fadeOut('slow', function () { $('#login-holder').html(msg); login_box.fadeIn('slow'); var user_value = $("#user_id").attr('value'); var test = $(".user_id").val(); if ((/ie7/i.test($('html').attr('class'))) || (/ie8/i.test($('html').attr('class')))) { location.reload(); //alert($('html').attr('class')); } // login was successful if (user_value > 0) { if($("#" + lastLoginBtnSource.id).data('href')) { window.location.href = $("#" + lastLoginBtnSource.id).data('href'); login_box.fadeOut('slow'); return; } if ((/ie7/i.test($('html').attr('class'))) || (/ie8/i.test($('html').attr('class')))) { location.reload(); //alert($('html').attr('class')); } location.reload(); // ajax call to update navigation var user_id = { user: user_value, ajax: '1' }; /*$.ajax({ url: base_url+'ajax/changeNavigation', type: 'POST', async : false, data: user_id, success: function(msg) { navigation.fadeOut('slow', function() { navigation.html(msg); navigation.fadeIn('slow'); $('#main-nav ul > li').hover(function() { var submenu = $(this).find('ul'); if (submenu.size() > 0) { $(this).addClass('active'); $(submenu).stop(true, true).delay(50).slideDown(); }; },function() { var submenu = $(this).find('ul'); $(this).removeClass('active'); $(submenu).stop(true, true).delay(50).slideUp(); }); }) } });*/ // close the login popup $("#login-popupbox").dialog("close"); if (/\/shop/i.test(window.location)) { location.reload(); } // if we are on calendar page refresh calendar if (/\/calendar/i.test(window.location)) { // load logged-in version of calendar $.ajax({ url: base_url + 'calendar/index/', async: false, data: { ajax: '1' }, type: 'POST', success: function (data) { // refresh calendar $("#calendar_holder").fadeOut(function () { $(this).html(data).fadeIn(); initCalendarHover(); // if user wanted to checkin show the checkin form if ($("#" + lastLoginBtnSource.id).hasClass("checkinbtn")) { $("#" + lastLoginBtnSource.id).click(); } }); } }); } } }); } }); }); $("#login-popupbox").dialog({ modal: true, width: 301, autoOpen: false, resizable: false, draggable: false, close: function () { $("#login-popupbox .register").attr('href', '/register'); } }); $(".loginButton").click(function (e) { e.preventDefault(); lastLoginBtnSource = this; $("#login-popupbox .register").attr('href', '/register/index/ajax/' + $(this).data('match_id')); $("#login-popupbox").dialog("open"); }); $('#submit-recover').live('click', function (event) { var login_box = $('#login-popupbox'); var form_data = { username_recover: $('#form_login_username_recover').val(), ajax: '1' }; $.ajax({ url: base_url + 'ajax/checkRecover', type: 'POST', async: false, data: form_data, success: function (msg) { login_box.fadeOut('slow', function () { $('#recover-holder').html(msg); login_box.fadeIn('slow'); }) } }); event.preventDefault(); }); $('.recover').live('click', function (event) { $("#login-holder").fadeOut('slow', function () { $("#recover-holder").fadeIn('slow'); }) event.preventDefault(); }) $('#recover-back').live('click', function (event) { $("#recover-holder").fadeOut('slow', function () { $("#login-holder").fadeIn('slow'); }) event.preventDefault(); }) $('#form_login_username_recover').focus(function () { $(this).val(''); }); var responsive_iframe = $('body').find('iframe'); console.log(responsive_iframe); if (responsive_iframe.length > 0) { $(responsive_iframe).each(function (index, element) { if (element.src.indexOf("youtube") != -1) { $(element).wrap('
'); } }); } });