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(); } }); } }); } // if we are on calendar page refresh calendar if (/\/invite_checkin/i.test(window.location)) { $.ajax({ url: base_url + 'ajax/writeReloadInviteCheckinForm/', async: false, data: { match_id: true, }, type: 'GET', success: function (data) { } }); } } }); } }); }); $("#login-popupbox").dialog({ modal: true, width: 301, zIndex: 100002, 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('
'); } }); } $("#open-side-menu").click(function () { var status = $(this).data("status"); $("#user-side-menu").css('display', 'none'); $("#open-user-menu").data('status', 'closed'); $("#open-user-menu").css('color', '#3f3f3f'); if (status == "closed") { $(this).removeClass('fa-bars'); $(this).addClass('fa-times-circle'); $("#mobile-header-menu").addClass('mobile-header-menu-opened'); $("#mobile-header-menu").css('z-index', 100002); $('#mobile-menu-background-blur').css('display', 'initial'); $("#mobile-side-menu").css({ position: 'fixed', left: '-100%' }).show(); $("#mobile-side-menu").animate({ left: '0%' }, 350); $(this).data('status', 'open') } else if (status == "open") { $(this).removeClass('fa-times-circle'); $(this).addClass('fa-bars'); $("#mobile-header-menu").removeClass('mobile-header-menu-opened'); $("#mobile-header-menu").css('z-index', 100001); $('#mobile-menu-background-blur').css('display', 'none'); $("#mobile-side-menu").animate({ left: '-100%' }, 350, function() { $(this).css('display', 'none'); }); $(this).data('status', 'closed') } }) $(".menu-main-row").click(function () { var menu = $(this).data('menu'); var submenu_status = $(this).data('submenu_status'); var chevron = $(".menu-item-chevron[data-menu='" + menu + "']"); if ($(".menu-submenu[data-menu='" + menu + "']").length > 0) { if (submenu_status == 'closed') { $(this).css('background-color', '#b1b1b159'); $(".menu-submenu[data-menu='" + menu + "']").slideDown(350); $(this).data('submenu_status', 'open'); $(chevron).css({ 'transform': 'rotate(180deg)' }); } else if (submenu_status == 'open') { $(this).css('background-color', 'white'); $(".menu-submenu[data-menu='" + menu + "']").slideUp(350); $(this).data('submenu_status', 'closed'); $(chevron).css({ 'transform': 'rotate(0deg)' }); } } }) $("#open-user-menu").click(function () { var status = $(this).data("status"); $("#mobile-side-menu").css('display', 'none'); $("#open-side-menu").data('status', 'closed'); $("#open-side-menu").removeClass('fa-times-circle'); $("#open-side-menu").addClass('fa-bars'); if (status == "closed") { $(this).css('color', 'rgb(1, 151, 204)'); $("#mobile-header-menu").addClass('mobile-header-menu-opened'); $("#mobile-header-menu").css('z-index', 100002); $('#mobile-menu-background-blur').css('display', 'initial'); $("#user-side-menu").css({ position: 'fixed', left: '-100%' }).show(); $("#user-side-menu").animate({ left: '0%' }, 350); $(this).data('status', 'open') } else if (status == "open") { $(this).css('color', '#3f3f3f'); $("#mobile-header-menu").removeClass('mobile-header-menu-opened'); $("#mobile-header-menu").css('z-index', 100001); $('#mobile-menu-background-blur').css('display', 'none'); $("#user-side-menu").animate({ left: '-100%' }, 350, function() { $(this).css('display', 'none'); }); $(this).data('status', 'closed') } }) if ( $('.noti-bubble-red').is(":visible") ) { $(".mobile-search-form").css('margin-top', '30px'); } else { $(".mobile-search-form").css('margin-top', '14px'); } });