function getUrl(value) { return location.protocol + '//' + location.host + '/' + value; } $(document).ready(function(){ $(window).scroll(function(){ var pos = $(window).scrollTop(); if(pos >= 30){ $('.main-header').css('position','fixed'); $('.main-header').css('top','0'); }else{ $('.main-header').css('position','relative'); $('.main-header').css('top','0'); } }); //login $('.login-system, .btn-login-system, .signup-system').click(function(){ var isSignUp = $(this).attr('signup'); if( $('#modal-sign-in').length ) { if(isSignUp == undefined){ $('#modal-sign-in').modal(); }else{ $('#modal-sign-up').modal(); } }else{ $.ajaxSetup({ headers: { 'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content') } }); $.ajax({ url: getUrl('get-login'), type: "POST", data: { }, success: function(result){ $('body').append(result); if(isSignUp == undefined){ $('#modal-sign-in').modal(); }else{ $('#modal-sign-up').modal(); } } }); } }); }); function open_login_g(){ var curUrl = $('#current-url').val(); if(curUrl == undefined){ curUrl = ""; } fb_login=window.open(getUrl("login-google?l="+curUrl),'name','width='+screen.width+',height='+screen.height+',top=0,left=0'+',fullscreen=yes'); }; function open_login_f(){ var curUrl = $('#current-url').val(); if(curUrl == undefined){ curUrl = ""; } fb_login=window.open(getUrl("login-facebook?l="+curUrl),'name','width='+screen.width+',height='+screen.height+',top=0,left=0'+',fullscreen=yes'); } function open_f_login(){ var curUrl = $('#current-url').val(); if(curUrl == undefined){ curUrl = ""; } fb_login=window.open(getUrl("facebook-login?l="+curUrl),'name','width='+screen.width+',height='+screen.height+',top=0,left=0'+',fullscreen=yes'); } function redirect() { fb_login.close(); self.location = getUrl('library'); } function redirectFacebook(link) { fb_login.close(); open_f_login(); } $(document).on('click', '.main-header-cover .header-language .dropdown-menu li a', function(){ var lang = $(this).attr('val'); $('#input-set-language').val(lang); $('#form-set-language').submit(); }); $(document).on('click', '.header-middle', function(){ amimateUpDown($('.main-header-cover .header-menu')); // amimateUpDown($('.main-header-cover .header-right')); }); function amimateUpDown(element){ if($(element).hasClass('menu-show')){ $(element).slideUp('fast',function(){ $(element).removeClass('menu-show'); }); }else{ $(element).slideDown('fast',function(){ $(element).addClass('menu-show'); }); } }