var vocaConfig = { 'isLogin':false, 'loginPage' : 'my-library' }; function urlConfig(link){ return window.location.protocol+'//'+window.location.host+'/'+link; } // check rule email function checkEmail(email) { var re = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return re.test(email); }; //get domain url function url($ajaxlink){ return location.protocol+'//'+location.host+'/assets/assets-v2/js/'+$ajaxlink; } $( document ).ready(function(){ $('#alert-message-success-default').fadeIn('slow'); $('#alert-message-success-default').delay(2500).fadeOut('slow'); $('#alert-message-error-default').fadeIn('slow'); $('#alert-message-error-default').delay(2500).fadeOut('slow'); $('.icon').click(function (a) { $('#side-nav').css({ 'z-index': '-2' }); a.preventDefault(); var b = '260px'; var c = '-280px'; var d = '300px'; var e = '-300px'; var f = 200; if ($('body').hasClass('menu-open')) { var b = '0px'; var c = '0px'; var f = 100; } else $('#voca-wrap').css({ 'position': 'fixed' }); $("#side-nav").show(); $("#side-nav").stop().animate({ width: '600px' }, { duration: 150, queue: false, complete: function () { $(this).stop().animate({ 'width': '275px','z-index':'1000' }, { duration: f, queue: false }); $('body').addClass('menu-open'); } }); $("#top-nav, #voca-wrap").stop().animate({ left: d, right: e }, { duration: 150, queue: false, complete: function () { $(this).stop().animate({ left: b, right: c }, { duration: f, queue: false, complete: function () { if (b == '0px') { $('body').removeClass('menu-open'); $('#voca-wrap').css({ 'position': 'relative' }); $('#side-nav').css({ 'z-index': '-2' }); $('#close-menu-overlay').remove(); } } }); if ($('#close-menu-overlay').length == 0) $('body').append(''); } }); $('.icon-menu').toggleClass('fa-bars').toggleClass('fa-chevron-left'); }); $(document).on("click", '#close-menu-overlay', function (a) { a.preventDefault(); $('.intro-text-menu.icon').trigger('click'); }); });; $(document).ready(function(){ console.log("Ready"); /*if(vocaConfig.isLogin == false){ $(function(){ var dom = $('#modal-login-system'); if(dom != undefined){ $.ajax({ url: urlConfig('auth/signin'), type: 'GET' }).success(function(data){ $('#modal-login-system').html(data); }); } }); }*/ $(document).on('keypress','#email-login, #password-login',function(e){ if(e.keyCode == 13){ $( "#btn-login-system" ).trigger( "click" ); } }); $('#content-login-loading').removeClass('fullwidth'); $(document).on('click','#btn-login-system',function(){ var email = $('#email-login').val(); var password = $('#password-login').val(); var curUrl = $('#current-url').val(); if(curUrl == undefined){ curUrl = ""; } var rememberPass = 0; if(email == ""){ $('.login-msg').html(emailNotEmpty); return false; }else{ $('.login-msg').html(''); } if(password == ""){ $('.login-msg').html(passNotEmpty); return false; }else{ $('.login-msg').html(''); } if($('#login-remember-pass').is(':checked')){ rememberPass = 1; } $('#content-login-loading').removeClass('fullwidth').queue(function(next){ $(this).addClass('fullwidth'); next(); }); $.ajax({ url : urlConfig('auth/signin'), data : { email : email, password : password, rememberPass : rememberPass, curUrl: curUrl }, headers: { 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') }, type: 'POST' }).success(function(data){ $('#content-login-loading').removeClass('fullwidth'); $('.login-msg').html(''); if(data.length > 2000){ $('body').append(data); $('#modal-login-system').modal('hide'); $('#register-msg-modal').modal(); }else{ if(data.email){ $('.login-msg').html(data.email.toString()); }else{ $('.login-msg').html(''); } if(data.password){ $('.login-msg').html(data.password.toString()); }else{ $('.login-msg').html(''); } if(!data.email && !data.password){ if(data[0] != "success"){ $('.login-msg').html(data); }else{ $('#email-login').val(''); $('#password-login').val(''); $('#modal-login-system').modal('hide'); window.location.href = urlConfig(data[1]); } } } }); }); $('#content-register-loading').removeClass('fullwidth'); }); function redirect() { fb_login.close(); self.location = urlConfig(vocaConfig.loginPage); } /*function open_login_f(){ var curUrl = $('#current-url').val(); fb_login=window.open(urlConfig('auth/login-facebook/'+curUrl),'name'); } function open_login_g(){ var curUrl = $('#current-url').val(); fb_login=window.open(urlConfig('auth/login-google/'+curUrl),'name'); };*/ $(document).ready(function(){ //get link /*if(vocaConfig.isLogin == false){ $(function(){ var dom = $('#modal-signup-system'); if(dom != undefined){ $.ajax({ url: urlConfig('auth/signup'), type: 'GET' }).success(function(data){ $('#modal-signup-system').html(data); }); } }); }*/ $('#slt-provinces').val(0); //when user select a any province system auto display districts of that province $('#slt-provinces').change(function(){ var id = $(this).val(); if(id!=0){ //route into get-districts to get districts of a province when user select $.post(urlConfig('auth/get-districts'),{provinceId: id},function(data){ $('#first-option').siblings().remove(); for (var index = 0; index < data.length; ++index) { $("").insertAfter("#first-option"); } }); }else{ $('#first-option').siblings().remove(); } }); //verify format email $(document).on('blur','#email-register, #email-register-now',function(){ /*var email = $(this).val(); if(email == ""){ $('.msg-email-register-error').html(emailNotEmpty); return false; }else{ $('.msg-email-register-error').html(''); } $.ajax({ url: urlConfig('auth/verify-email-format'), data: { email:email }, type:"POST", async: false }).success(function(data) { if(data == 0){ $('.msg-email-register-error').html(emailWrongFormat); }else{ $('.msg-email-register-error').html(''); } });*/ }); //focus email input $(document).on('focus','#email-register, #email-register-now',function(){ $('.msg-email-register-error').html(recommendEmailGoogle); }); //refresh-register-captcha $(document).on('click','#refresh-register-captcha',function(){ $.ajax({ url: urlConfig("auth/get-captcha"), type:"POST" }).success(function( data) { $("#recaptcha-image").attr("src",data); }); }); //refresh-register-now-captcha $(document).on('click','#refresh-register-now-captcha',function(){ $.ajax({ url: urlConfig("auth/question-protect"), type:"POST" }).success(function( data) { $('#question-id-register-now-protect').val(data[0]); $('#question-register-now-protect').html(data[1]); }); }); $('#content-signup-loading').removeClass('fullwidth'); //register system $(document).on('click','#btn-register-system',function(){ if($('#agree-register-service').is(':checked')){ $('.msg-agree-service-error').html(''); var registerToken = $('input[name="register_token"]').val(); var email = $('#email-register').val(); var password = $('#password-register').val(); var captcha = $('#captcha-register').val(); var name = $('#full-name-register').val(); var username = $('#username-register').val(); var questionId = $('#question-register-protect').attr('question-id'); var agree = 1; var curUrl = $('#current-url').val(); if(curUrl == undefined){ curUrl = ""; } if(name == ""){ $('.register-msg').html(fullNameNotEmpty); return false; }else{ $('.register-msg').html(''); } if(username == ""){ $('.register-msg').html(userNameNotEmpty); return false; }else{ $('.register-msg').html(''); } if(email == ""){ $('.register-msg').html(emailNotEmpty); return false; }else{ $('.register-msg').html(''); } if(password == ""){ $('.register-msg').html(passNotEmpty); return false; }else{ $('.register-msg').html(''); } if(captcha == ""){ $('.register-msg').html(captchaNotEmpty); return false; }else{ $('.register-msg').html(''); } $('#content-signup-loading').removeClass('fullwidth').queue(function(next){ $(this).addClass('fullwidth'); next(); }); $.blockUI({ message:vocaLang.pleaseWaitVoca, css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '2px', '-moz-border-radius': '2px', 'z-index':'11000', opacity: .5, color: '#fff'} }); $.ajax({ url : urlConfig('auth/signup'), data : { email : email, password : password, captcha : captcha, full_name : name, username : username, agree : agree, register_token: registerToken, curUrl : curUrl }, headers: { 'X-CSRF-Token': $('meta[name="csrf-token"]').attr('content') }, type: 'POST' }).success(function(data){ $.unblockUI(); $('#content-signup-loading').removeClass('fullwidth'); $('.register-msg').html(''); $('#password-register').val(''); $('#captcha-register').val(''); jQuery('#refresh-register-captcha').click(); if(data.email){ $('.register-msg').html(data.email.toString()); return false; }else{ $('.register-msg').html(''); } if(data.username){ $('.register-msg').html(data.username.toString()); return false; }else{ $('.register-msg').html(''); } if(data.password){ $('.register-msg').html(data.password.toString()); return false; }else{ $('.register-msg').html(''); } if(data.captcha){ $('.register-msg').html(data.captcha.toString()); return false; }else{ $('.register-msg').html(''); } if(data.full_name){ $('.register-msg').html(data.full_name.toString()); return false; }else{ $('.register-msg').html(''); } if(!data.email && !data.password && !data.captcha && !data.full_name){ if(data[0] != "success"){ $('.register-msg').html(data); $('#password-register').val(''); $('#captcha-register').val(''); jQuery('#refresh-register-captcha').click(); }else{ $('#email-register').val(''); $('#password-register').val(''); $('#captcha-register').val(''); $('#full-name-register').val(''); $('#username-register').val(''); if(data[1] == ""){ window.location.href = urlConfig('my-library'); }else{ window.location.href = urlConfig(data[1]); } } }else{ $('#password-register').val(''); $('#captcha-register').val(''); jQuery('#refresh-register-captcha').click(); } }); }else{ $('.msg-agree-service-error').html(selectAgreeService); } }); $('#month-birth').change(function(){ var month = $('#month-birth').val(); var date = $('#date-birth').val(); var year = $('#year-birth').val(); var valueMonth = 1; var monthThirty = ["4","6","9","11"] if(month == 2){ if((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)){ valueMonth = 29; }else{ valueMonth = 28; } }else if(monthThirty.indexOf(month) != -1){ valueMonth = 30; }else{ valueMonth = 31; } $('.flag-date').siblings().remove(); for(var i = 1; i<= valueMonth; i++){ if(date == i ){ $('').insertBefore('.flag-date'); }else{ $('').insertBefore('.flag-date'); } } }); $('#year-birth').change(function(){ var month = $('#month-birth').val(); var date = $('#date-birth').val(); var year = $('#year-birth').val(); var valueMonth = 1; var monthThirty = ["4","6","9","11"] if(month == 2){ if((year % 400 == 0) || (year % 4 == 0 && year % 100 != 0)){ valueMonth = 29; }else{ valueMonth = 28; } }else if(monthThirty.indexOf(month) != -1){ valueMonth = 30; }else{ valueMonth = 31; } $('.flag-date').siblings().remove(); for(var i = 1; i<= valueMonth; i++){ if(date == i ){ $('').insertBefore('.flag-date'); }else{ $('').insertBefore('.flag-date'); } } }); $(document).on('change','.logon',function(){ var value = $('input[name=logon]:checked').val(); if(value == 1){ $('.login-now').slideUp(); $('.register-now').slideDown(); }else{ $('.register-now').slideUp(); $('.login-now').slideDown(); } }); $(document).on('click','#register-by-voca',function(e){ e.preventDefault(); if($(this).hasClass('show-register')){ $(this).html(vocaLang.useSocialAccount); $('.register-by-voca').slideDown(); $(this).removeClass('show-register'); $(this).addClass('hide-register'); }else{ $(this).html(vocaLang.useVocaAccount); $('.register-by-voca').slideUp(); $(this).removeClass('hide-register'); $(this).addClass('show-register'); } }); $(document).on('click','.modal-register-system',function(){ $('#modal-login-system').modal('hide'); }); $('#content-register-loading').removeClass('fullwidth'); }); function redirect(url) { fb_login.close(); if(url == ""){ self.location=urlConfig(vocaConfig.loginPage); }else{ self.location=urlConfig(url); } } function open_login_f(){ var curUrl = $('#current-url').val(); if(curUrl == undefined){ curUrl = ""; } fb_login=window.open(urlConfig("auth/login-facebook/"+curUrl),'name','width='+screen.width+',height='+screen.height+',top=0,left=0'+',fullscreen=yes'); } function open_login_g(){ var curUrl = $('#current-url').val(); if(curUrl == undefined){ curUrl = ""; } fb_login=window.open(urlConfig("auth/login-google/"+curUrl),'name','width='+screen.width+',height='+screen.height+',top=0,left=0'+',fullscreen=yes'); }; /* USER VOICE API */ /*(function(){var uv=document.createElement('script');uv.type='text/javascript';uv.async=true;uv.src='//widget.uservoice.com/ZRfBjfeBHZzNxDpNGWisA.js';var s=document.getElementsByTagName('script')[0];s.parentNode.insertBefore(uv,s)})() UserVoice = window.UserVoice || []; UserVoice.push(['showTab', 'classic_widget', { mode: 'full', primary_color: '#133F69', link_color: '#FFCE0F', default_mode: 'feedback', forum_id: 241081, support_tab_name: vocaLang.contact, feedback_tab_name: vocaLang.feedback, tab_label: 'Feedback', tab_color: '#ECC21B', tab_position: 'bottom-right', tab_inverted: false }]);*/ /* USER REPORT API */ /*var _urq = _urq || []; _urq.push(['initSite', '8f7a2bd2-67f8-4a17-b058-9790418273f7']); (function() { var ur = document.createElement('script'); ur.type = 'text/javascript'; ur.async = true; ur.src = ('https:' == document.location.protocol ? 'https://cdn.userreport.com/userreport.js' : 'http://cdn.userreport.com/userreport.js'); var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ur, s); })(); ;*/ $(document).ready(function(){ function getUrl(link){ return location.protocol+'//'+location.host+'/library/'+link; } $('.search-topic').keyup(function(e){ var keyWord = $(this).val(); if(e.keyCode == 13 && keyWord !=""){ $.ajax({ url: getUrl("search-topic"), data: { keyWord: keyWord }, type: "POST" }).done(function(data) { $('.tab-content').html(data); $('.search-topic').val(''); }); } }); });; $(document).ready(function(){ //rating $('.click-rating').click(function(event){ var topic = $(this).attr('topic'); var id = $(this).attr('id'); event.preventDefault(); $.ajax({ url: urlConfig("rating-topic"), data: { topicId:topic, }, type:"POST" }).success(function(data) { $('.is_rated').html('

Ðánh giá

') }); }); //click to learn /*$('.learn-question').click(function(){ var childrenTopic = $(this).attr('childrenTopic'); var parentTopic = $(this).attr('parentTopic'); $('#learn-unknow').attr('href',urlConfig('learning/'+childrenTopic+'-'+parentTopic+'-unknow')); $('#learn-all').attr('href',urlConfig('learning/'+childrenTopic+'-'+parentTopic)); $('#learn-question').modal('show'); });*/ }); ; $(document).ready(function(){ $('.warning-alert').fadeIn(5000); $('.active-product-button').click(function(){ $.blockUI( { message: vocaLang.pleaseWaitVoca, css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '2px', '-moz-border-radius': '2px', opacity: .5, color: '#fff' }} ); }); }); ; $(document).ready(function(){ $('.speaker').click(function(){ var val = $(this).attr('attr'); $('.audio-'+val).get(0).play(); }); });; $(document).ready(function(){ //get domain url function url($ajaxlink){ return location.protocol+'//'+location.host+'/'+$ajaxlink; } $('.show-more-user').click(function(){ var topicId = $(this).attr('showId'); var parentTopic = $(this).attr('parentTopic'); var start = $(this).attr('count'); var index = parseInt(start)+10; $('.show-more-user').attr('count',index); $.ajax({ url: url("show-more-user-topic-child"), data: { topicId:topicId, start: start, parentTopic:parentTopic }, type:"POST" }).success(function(data) { if(data!=""){ $(data).insertBefore('.flag-show-more'); }else{ $('.show-more').html(''); } }); }); $('.show-more-user-parent').click(function(){ var topicId = $(this).attr('showId'); var start = $(this).attr('count'); var index = parseInt(start)+10; $('.show-more-user-parent').attr('count',index); $.ajax({ url: url("show-more-user"), data: { topicId:topicId, start: start }, type:"POST" }).success(function(data) { if(data!=""){ $('.list-user-learn').append(data); //$(data).insertBefore('.flag-show-more'); }else{ $('.show-more-user-parent').css('display','none'); } }); }); //click to learn $('.learn-question').click(function(){ var childrenTopic = $(this).attr('childrenTopic'); var parentTopic = $(this).attr('parentTopic'); var isDontKnowWord = $(this).attr('isDontKnowWord'); var isLearContext = parseInt($(this).attr('learn_context')); if(isLearContext == 1){ $('.learning-context-btn').css('display','inline-block'); }else{ $('.learning-context-btn').css('display','none'); } $('.learning-flashcard-btn').attr('url',urlConfig('learning/'+childrenTopic+'-'+parentTopic)); $('.learning-writing-btn').attr('url',urlConfig('learning-writing/'+childrenTopic+'-'+parentTopic)); $('.learning-speaking-btn').attr('url',urlConfig('learning-speaking/'+childrenTopic+'-'+parentTopic)); $('.learning-context-btn').attr('url',urlConfig('learning-context/'+childrenTopic+'-'+parentTopic)); if(isDontKnowWord == 1){ $('.flashcard-unknow').attr('href',urlConfig('learning/'+childrenTopic+'-'+parentTopic+'-unknow')); $('.flashcard-unknow').html(''); $('.writing-unknow').attr('href',urlConfig('learning-writing/'+childrenTopic+'-'+parentTopic+'-unknow')); $('.writing-unknow').html(''); $('.speaking-unknow').attr('href',urlConfig('learning-speaking/'+childrenTopic+'-'+parentTopic+'-unknow')); $('.speaking-unknow').html(''); $('.context-unknow').attr('href',urlConfig('learning-context/'+childrenTopic+'-'+parentTopic+'-unknow')); $('.context-unknow').html(''); }else{ $('.flashcard-unknow').attr('href',''); $('.flashcard-unknow').html(''); $('.writing-unknow').attr('href',''); $('.writing-unknow').html(''); $('.speaking-unknow').attr('href',''); $('.speaking-unknow').html(''); $('.context-unknow').attr('href',''); $('.context-unknow').html(''); } $('.flashcard-learn-all').attr('href',urlConfig('learning/'+childrenTopic+'-'+parentTopic)); $('.writing-learn-all').attr('href',urlConfig('learning-writing/'+childrenTopic+'-'+parentTopic)); $('.speaking-learn-all').attr('href',urlConfig('learning-speaking/'+childrenTopic+'-'+parentTopic)); $('.context-learn-all').attr('href',urlConfig('learning-context/'+childrenTopic+'-'+parentTopic)); $('.choose-learn-words').attr('topic',childrenTopic); $('.choose-learn-words').attr('parent',parentTopic); $('#diary-form-choose-learn-words').attr('action',urlConfig('learning/'+childrenTopic+'-'+parentTopic)) $('#learn-question').modal('show'); }); //click to test review $('#btn-test-review').click(function(){ document.cookie = "testReview=testReview;path=/"; }); });; $( document ).ready(function() { // open video in learning guide page $(".voca-video-features-video").click(function(){ var id = $(this).attr('video'); $("#voca-overlay-box-"+id+",#voca-overlay-"+id).css("display","block"); }); // close video and stop video in learning guide page $(".voca-overlay-wrapper .close").click(function(){ var id = $(this).attr('wrapper'); $("#voca-overlay-box-"+id+",#voca-overlay-"+id).css("display","none"); var video = $("#player-video-"+id).attr("src"); $("#player-video-"+id).attr("src",""); $("#player-video-"+id).attr("src",video); }); // open video in library detail page $(".voca-video-features-video-a").click(function(){ $("#voca-overlay-box,#voca-overlay").css("display","block"); $('#ground-span').fadeIn(); }); // close video and stop video in library detail page $(".voca-overlay-wrapper .close,#ground-span").click(function(){ $("#voca-overlay-box,#voca-overlay").css("display","none"); $('#ground-span').fadeOut(); var video = $("#player-video").attr("src"); $("#player-video").attr("src",""); $("#player-video").attr("src",video); }); });; $(document).ready(function(){ /*$(function(){ var discount = $("input[name='payment_method']:checked").attr('discount'); var totalMoney = $('#total-money').val(); var discountvalue = $('#total-money').attr('discountvalue'); var discountPromotion = $('#promotion_code').attr('discount'); if(discountPromotion == 0){ discountPromotion = discountvalue; if($('#discount-reference').length){ var domDiscountReference = $('#discount-reference')[0].outerHTML; } } if(discount){ if(discount > 0){ if(discountPromotion > 0){ var discountMoney = parseInt(discount) + parseInt(discountPromotion); }else{ var discountMoney = discount; } var payMoney = totalMoney - discountMoney; if(domDiscountReference){ $('.total-value-item').html(domDiscountReference+'
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } }else{ if(discountPromotion > 0){ var payMoney = totalMoney - discountPromotion; if(domDiscountReference){ $('.total-value-item').html(domDiscountReference+'
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountPromotion.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountPromotion.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } }else{ $('.total-value-item').html('
'+vocaLang.paymentMoney+''+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } } } }); $(function(){ var promotionCodeValue = $('#promotion_code').val(); if(promotionCodeValue != "" && promotionCodeValue!= undefined) { $('#promotion-code').attr('checked','checked'); $('.div-promotion').css('display','block'); var promotionCode = $('#promotion_code').val(); var productId = $('#product_id').val(); if(promotionCode !=""){ $.ajax({ url: urlConfig("check-promotion-code"), data: { promotionCode:promotionCode, productId:productId }, type:"POST" }).success(function(data) { // var discountGateway = $("input[name='payment_method']:checked").attr('discount'); discountGateway = 0; var totalMoney = $('#total-money').val(); if(data == "not exist"){ $('#promotion_code').attr('discount',0); var discountValue = $('#total-money').attr('discountvalue'); if(discountValue > 0){ var payMoney = totalMoney - discountValue - discountGateway ; $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+(parseInt(discountGateway) + parseInt(discountValue)).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ if(discountGateway > 0){ var payMoney = totalMoney - discountGateway ; $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountGateway.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ $('.total-value-item').html('
'+vocaLang.paymentMoney+''+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } } $('.apply-promotion-code-result').text(vocaLang.promotionNotExist); $('.apply-promotion-code-result').css('color','#F00'); }else{ var discountMoney = data; $('#promotion_code').attr('discount',discountMoney); var payMoney = totalMoney - discountMoney - discountGateway; $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+(parseInt(discountGateway) + parseInt(discountMoney )).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } }); } } }); // payment method change $('#payment_method').change(function(){ var method = $(this).val(); if(method == 1){ $('.payment_method').html(' MobiFone Viettel Vinaphone'); }else{ $('.payment_method').html(' Vietcombank DongABank Sacombank
Agribank Eximbank Viettinbank'); } });*/ // check promotion code /*$('.apply-promotion-code').click(function(){ var promotionCode = $('#promotion_code').val(); var productId = $('#product_id').val(); if(promotionCode !=""){ $.ajax({ url: urlConfig("check-promotion-code"), data: { promotionCode:promotionCode, productId:productId }, type:"POST" }).success(function(data) { //var discountGateway = $("input[name='payment_method']:checked").attr('discount'); discountGateway = 0; var totalMoney = $('#total-money').val(); if(data == "not exist"){ $('#promotion_code').attr('discount',0); var discountValue = $('#total-money').attr('discountvalue'); if(discountValue > 0){ var payMoney = totalMoney - discountValue - discountGateway ; $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+(parseInt(discountGateway) + parseInt(discountValue)).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ if(discountGateway > 0){ var payMoney = totalMoney - discountGateway ; $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountGateway.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ $('.total-value-item').html('
'+vocaLang.paymentMoney+''+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } } $('.apply-promotion-code-result').text(vocaLang.promotionNotExist); $('.apply-promotion-code-result').css('color','#F00'); }else{ var discountMoney = data; $('#promotion_code').attr('discount',discountMoney); var payMoney = totalMoney - discountMoney - discountGateway; $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+(parseInt(discountGateway) + parseInt(discountMoney )).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); $('.apply-promotion-code-result').text(vocaLang.promotionValid); $('.apply-promotion-code-result').css('color','#00F'); } }); } });*/ /* $('.apply-promotion-code').click(function(){ var promotionCode = $('#promotion_code').val(); var productId = $('#product_id').val(); if(promotionCode !=""){ $.ajax({ url: urlConfig("check-promotion-code"), data: { promotionCode:promotionCode, productId:productId }, type:"POST" }).success(function(data) { console.log(data); discountGateway = 0; var totalMoney = $('#total-money').val(); if(data == "not exist"){ $('#promotion_code').attr('discount',0); var discountValue = $('#total-money').attr('discountvalue'); if(discountValue > 0){ var payMoney = totalMoney - discountValue - discountGateway ; $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+(parseInt(discountGateway) + parseInt(discountValue)).toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ if(discountGateway > 0){ var payMoney = totalMoney - discountGateway ; $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountGateway.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ $('.total-value-item').html('
'+vocaLang.paymentMoney+''+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } } $('.apply-promotion-code-result').text(vocaLang.promotionNotExist); $('.apply-promotion-code-result').css('color','#F00'); }else{ var discountMoney = data; $('#promotion_code').attr('discount',discountMoney); var payMoney = totalMoney - discountMoney - discountGateway; $('.total-value-item').html('
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); $('.apply-promotion-code-result').text(vocaLang.promotionValid); $('.apply-promotion-code-result').css('color','#00F'); } }); } }); // check promotion code radio button $('#promotion-code').change( function(){ if ($(this).val() == "checkpromotioncode") { $('.div-promotion').fadeIn(1000); } }); // click into pament button $('.payment-now').click(function(){ $.blockUI( { message: vocaLang.pleaseWaitVoca, css: { border: 'none', padding: '15px', backgroundColor: '#000', '-webkit-border-radius': '2px', '-moz-border-radius': '2px', opacity: .5, color: '#fff' }} ); }); // change payment gateway $('input[name="select_method"]').change(function(){ var discount = $(this).attr('discount'); var totalMoney = $('#total-money').val(); var discountvalue = $('#total-money').attr('discountvalue'); var discountPromotion = $('#promotion_code').attr('discount'); if(discountPromotion == 0){ discountPromotion = discountvalue; if($('#discount-reference').length){ var domDiscountReference = $('#discount-reference')[0].outerHTML; } } if(discount > 0){ if(discountPromotion > 0){ var discountMoney = parseInt(discount) + parseInt(discountPromotion); }else{ var discountMoney = discount; } var payMoney = totalMoney - discountMoney; if(domDiscountReference){ $('.total-value-item').html(domDiscountReference+'
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } }else{ if(discountPromotion > 0){ var payMoney = totalMoney - discountPromotion; if(domDiscountReference){ $('.total-value-item').html(domDiscountReference+'
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountPromotion.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); }else{ $('.total-value-item').html('
'+vocaLang.money+' '+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.discountMoney+''+discountPromotion.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'+vocaLang.paymentMoney+''+payMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } }else{ $('.total-value-item').html('
'+vocaLang.paymentMoney+''+totalMoney.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,")+' VND
'); } } }); $('.tab-payment-transfer').click(function(){ $('#chk-payment-transfer').prop("checked", true); $('#chk-payment-transfer').trigger('change'); if($('#alert-payment-method').length){ $('#alert-payment-method').fadeIn(); $('#alert-payment-method').delay(15000).fadeOut(); } }); $('.tab-payment-banking').click(function(){ $('#chk-payment-banking').prop("checked", true); $('#chk-payment-banking').trigger('change'); if($('#alert-payment-method').length){ $('#alert-payment-method').fadeIn(); $('#alert-payment-method').delay(15000).fadeOut(); } }); $('.tab-payment-card').click(function(){ $('#chk-payment-card').prop("checked", true); $('#chk-payment-card').trigger('change'); }); $('.tab-payment-viettel').click(function(){ $('#chk-payment-viettel').prop("checked", true); $('#chk-payment-viettel').trigger('change'); }); $('.tab-payment-nl').click(function(){ $('#chk-payment-nl').prop("checked", true); $('#chk-payment-nl').trigger('change'); if($('#alert-payment-method').length){ $('#alert-payment-method').fadeIn(); $('#alert-payment-method').delay(15000).fadeOut(); } });*/ $('.choose-learn-words').click(function(){ var topic = $(this).attr('topic'); var parent = $(this).attr('parent'); $.ajax({ url: urlConfig("choose-learn-words"), data: { topic : topic, parent: parent }, type:"POST" }).success(function(data) { if(data[0] !=0) { $('.show-choose-learn-words').modal(); $('.modal-dialog-choose-word').html(data); } }); }); //update bell notification $('.bell-has-notification').click(function(){ var countNotification = $('.bell-has-notification .count-notification span').html(); $.ajax({ url: urlConfig("update-user-notification"), type:"POST" }).success(function(data){ if(data > 0){ var notifyRemain = countNotification - data; if(notifyRemain > 0){ $('.bell-has-notification .count-notification span').html(notifyRemain); }else{ $('.bell-has-notification .count-notification').css('background','#003366'); $('.bell-has-notification .count-notification span').css('color','#003366'); $('.bell-has-notification').addClass('bell-flag'); //$('.bell-has-notification a img').attr("src",urlConfig("assets/imgs/bell-logo-disable.png")); } } }); }); //click btn review $('.btn-remind-review').click(function(){ var topicId = $(this).attr('topic_id'); var urlRedirect = $(this).attr('url'); document.cookie='remindTopic='+topicId+';path=/'; window.location.href = urlRedirect; return false; }); //close learning video $('.learning-video-modal .close').click(function(){ $('.learning-video-modal-src').attr('src',''); }); //close learning music $('.learning-music-modal .close').click(function(){ $('.learning-music-modal-src').attr('src',''); }); //close video modal $("#video-modal, .close").click(function(){ $('.learning-video-modal-src').attr('src',''); }); //close music modal $("#music-modal, .close").click(function(){ $('.learning-music-modal-src').attr('src',''); }); //view full or few story content $(document).on('click','.view-learning-content',function(){ var storyContent = $(this).attr('content'); if($(this).hasClass('view-learning-content-full')){ $('#story-modal .learning-story-content').html(storyContent); $(this).removeClass('view-learning-content-full'); $(this).addClass('view-learning-content-few'); $(this).html(vocaLang.viewStoryShort); }else{ $('#story-modal .learning-story-content').html(storyContent.substring(0,500)+'...'); $(this).removeClass('view-learning-content-few'); $(this).addClass('view-learning-content-full'); $(this).html(vocaLang.viewStoryFull); } }); //change fault content $(".fault-content").keyup(function(){ var faultContent = $(this).val(); if(faultContent != ""){ $(".btn-send-fault").css({ 'background':'#008DF6', 'color':'#FFF' }); }else{ $(".btn-send-fault").css({ 'background':'#D8EEF9', 'color':'#555' }); } }); //cancel send fault $(".btn-cancel-fault").click(function(){ $(".fault-content").val(""); $('.slt-fault').get(0).selectedIndex = 0; $('.fault-content-error').html(""); $('#feedback-modal').modal('hide'); }); //send fault $(".btn-send-fault").click(function(){ var contentFault = $('.fault-content').val(); var fault = $('.slt-fault').val(); var topic = $(this).attr('topic'); var word = $(this).attr('word'); var synset = $(this).attr('definition'); if(contentFault == ""){ $('.fault-content-error').html(vocaLang.faultContentNotEmpty); return false; }else{ $('.fault-content-error').html(""); } $(".fault-content").val(""); $('.slt-fault').get(0).selectedIndex = 0; $('.fault-menu').slideUp(); $('.fault-content-error').html(""); $.ajax({ url: urlConfig("report-fault"), data: { topic: topic, fault: fault, synset: synset, word: word, faultContent: contentFault }, type: "POST" }).success(function(data) { if(data[0] != 0){ $('.fault-content-error').html(data[1]); $('.fault-content-error').css('color','green'); }else{ $('.fault-content-error').css('color','red'); $('.fault-content-error').html(data[1]); } /* setTimeout(function(){ $(".message-feedback-result").slideUp(); },2000);*/ }); }); //put avatar $(document).on('click','.btn-put-avatar',function(e){ var data = new FormData(); jQuery.each(jQuery('#file-upload')[0].files, function(i, file) { data.append('file_'+i, file); }); $.ajax({ url: urlConfig("update-avatar"), // Url to which the request is send type: "POST", // Type of request to be send, called as method data: data, // Data sent to server, a set of key/value pairs (i.e. form fields and values) contentType: false, // The content type used when sending data to the server. cache: false, // To unable request pages to be cached processData:false, // To send DOMDocument or non processed data file it is set to false success: function(data) // A function to be called if request succeeds { if(data[0] == 1){ $('.avatar-picture').attr('src',data[1]); $('.btn-edit-avatar.avatar-picture.avatar-picture-item').attr('src',data[1]); $('.avatar-picture-item').attr('src',data[1]); $('.img-avatar').attr('src',data[1]); $('.img-student img').attr('src',data[1]); $('.span-avatar .avatar-img').attr('src',data[1]); $('.box-img-absolute.btn-edit-avatar img.user-img').attr('src',data[1]); $('#change-avatar-modal').modal('hide'); }else{ $('.avt-msg').text(data[1]); } } }); }); //put avatar $(document).on('click','.btn-put-avatar-link',function(){ var avt = $(this).attr('avatar'); if(avt !=""){ $('.img-avatar').attr('src',urlConfig('assets/imgs/loading.gif')); $.ajax({ url: urlConfig("update-avatar-link"), data: { url : avt }, type: "POST" }).success(function(data) { $('.avatar-picture').attr('src',avt); $('.btn-edit-avatar.avatar-picture.avatar-picture-item').attr('src',avt); $('.img-avatar').attr('src',avt) $('.user-img').attr('src',avt) $('.img-student img').attr('src',avt) $('.span-avatar .avatar-img').attr('src',avt); $('#change-avatar-modal').modal('hide'); }); } }); $(document).on('submit','.upload-form',function(e){ /*var avt = $(this).attr('avatar'); if(avt !=""){ $('.img-avatar').attr('src',urlConfig('assets/imgs/loading.gif')); $.ajax({ url: urlConfig("update-avatar"), data: { url : avt }, type: "POST" }).success(function(data) { $('.avatar-picture').attr('src',avt); $('.btn-edit-avatar.avatar-picture.avatar-picture-item').attr('src',avt); $('.btn-edit-avatar.avatar-picture.avatar-picture-item').addClass('srctttttt'); $('.img-avatar').attr('src',avt) $('.img-student img').attr('src',avt) $('.span-avatar .avatar-img').attr('src',avt); $('#change-avatar-modal').modal('hide'); }); }*/ e.preventDefault(); $.ajax({ url: urlConfig("update-avatar"), // Url to which the request is send type: "POST", // Type of request to be send, called as method data: new FormData(this), // Data sent to server, a set of key/value pairs (i.e. form fields and values) contentType: false, // The content type used when sending data to the server. cache: false, // To unable request pages to be cached processData:false, // To send DOMDocument or non processed data file it is set to false success: function(data) // A function to be called if request succeeds { $('#loading').hide(); $("#message").html(data); } }); }); //cancel avatar $(document).on('click','.btn-cancel-avatar',function(){ $('.btn-put-avatar').attr('avatar',''); $('#change-avatar-modal').modal('hide'); }); //change full name info in profile $(".profile-full-name").keyup(function(){ var val = $(this).val(); if(val != ""){ $(".btn-update-info").css({ 'background':'rgb(0, 141, 246)', 'color':'#FFF' }); }else{ $(".btn-update-info").css({ 'background':'#EBEBEB', 'color':'#AEBAC6' }); } }); $(document).click(function() { $('.span-avatar .tooltip').css('display','none'); $('.avatar-picture').tooltip('hide'); }); $('.span-avatar').click(function(event){ event.stopPropagation(); $('.btn-bell.open').removeClass('open'); }); $('.span-avatar .tooltip-inner').click(function(event) { event.stopPropagation(); }); $('.btn-bell').click(function(){ $('.span-avatar .tooltip').css('display','none'); $('.avatar-picture').tooltip('hide'); }); //hover level icon $('.dashboard-level-link').mouseover(function() { $('.dashboard-level-link span').css('text-decoration','underline'); $('.dashboard-level-link img').attr('src',urlConfig('assets/imgs/level-icon.png')); }); //mouseout level icon $('.dashboard-level-link').mouseout(function() { $('.dashboard-level-link span').css('text-decoration','none'); $('.dashboard-level-link img').attr('src',urlConfig('assets/imgs/level-disable-icon.png')); }); //hover invite friends icon $('.dashboard-invite-friends').mouseover(function(){ $('.dashboard-invite-friends .fa-info-circle').css('color','#3C599B'); }); //mouseout invite friends icon $('.dashboard-invite-friends').mouseout(function(){ $('.dashboard-invite-friends .fa-info-circle').css('color','#7b7979'); }); //hover ranking icon $('.dashboard-ranking-link').mouseover(function() { $('.dashboard-ranking-link span').css('text-decoration','underline'); $('.dashboard-ranking-link img').attr('src',urlConfig('assets/imgs/ranking-icon.png')); }); //mouseout ranking icon $('.dashboard-ranking-link').mouseout(function() { $('.dashboard-ranking-link span').css('text-decoration','none'); $('.dashboard-ranking-link img').attr('src',urlConfig('assets/imgs/ranking-disable-icon.png')); }); //click support items $('.support-items').click(function(){ var id = $(this).attr('id'); var supportId = $(this).attr('support-id'); if($('#'+id+' ul .support-child-item').length){ $('#'+id+' ul .support-child-item').slideToggle(); $('#'+id).siblings().find('ul .support-child-item').slideUp(); $('#'+id).siblings().find('.flag-caret').removeClass('fa-caret-down'); $('#'+id).siblings().find('.flag-caret').addClass('fa-caret-right'); if($('#'+id +' span .flag-caret').hasClass('fa-caret-right')){ $('#'+id +' span .flag-caret').removeClass('fa-caret-right'); $('#'+id +' span .flag-caret').addClass('fa-caret-down'); }else{ $('#'+id +' span .flag-caret').removeClass('fa-caret-down'); $('#'+id +' span .flag-caret').addClass('fa-caret-right'); } }else{ var supportLink = urlConfig('support/'+supportId); window.location.href = supportLink; return false; } }); $('.support-child-item').click(function(event) { event.stopPropagation(); }); // $('.support-post-item').click(function(){ var id = $(this).attr('support-post-id'); if($('.support-post-item-'+id +' .flag-caret-post').hasClass('fa-caret-right')){ $('.support-post-item-'+id +' .flag-caret-post').removeClass('fa-caret-right'); $('.support-post-item-'+id +' .flag-caret-post').addClass('fa-caret-down'); $(this).css('font-family','OpenSansBold'); }else{ $('.support-post-item-'+id +' .flag-caret-post').removeClass('fa-caret-down'); $('.support-post-item-'+id +' .flag-caret-post').addClass('fa-caret-right'); $(this).css('font-family','OpenSansRegular'); } $(this).siblings().slideToggle(); }); /*Begin zopim chat*/ /*window.$zopim||(function(d,s){var z=$zopim=function(c){z._.push(c)},$=z.s= d.createElement(s),e=d.getElementsByTagName(s)[0];z.set=function(o){z.set. _.push(o)};z._=[];z.set._=[];$.async=!0;$.setAttribute('charset','utf-8'); $.src='//v2.zopim.com/?2aBFL1eRpDl1lE0Hgc3RCZeLw9Vo2Hiu';z.t=+new Date;$. type='text/javascript';e.parentNode.insertBefore($,e)})(document,'script'); $zopim(function() { $zopim.livechat.theme.setColor('#003366'); $zopim.livechat.prechatForm.setGreetings('Please introduce yourself.'); });*/ /*End zopim chat*/ /*Begin vchat*/ /*(function() {var _h1= document.getElementsByTagName('title')[0] || false; var product_name = ''; if(_h1){product_name= _h1.textContent || _h1.innerText;}var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.src = '//live.vnpgroup.net/js/web_client_box.php?hash=6b555e3d0733f04c8ebfa88e57d89cd8&data=eyJoYXNoIjoiMTE3M2UxODdjMjMxZTA2Y2VhNzc2OGYwMTEwMTdhNGEiLCJzc29faWQiOjI4MDc1OTd9&pname='+product_name; var s = document.getElementsByTagName('script');s[0].parentNode.insertBefore(ga, s[0]);})();*/ /*End vchat*/ $('.library-add-vocabulary').click(function(){ event.preventDefault(); }); $('.library-share-fb').click(function(){ event.preventDefault(); }); $('.hide-vocabulary-temp').click(function(){ event.preventDefault(); }); $('.stop-receive-remind-vocabulary').click(function(){ event.preventDefault(); }); $('.receive-remind-vocabulary').click(function(){ event.preventDefault(); }); //add vocabulary to personal page var objaddVocabulary; $('.library-add-vocabulary').click(function(){ objaddVocabulary = $(this); var val = $(this).attr('value'); $.ajax({ url: urlConfig("library/app-vocabulary-to-personal-page"), data: { vocabulary_id : val }, type: "POST" }).success(function(data) { objaddVocabulary.css("display","none"); objaddVocabulary.siblings().removeClass("library-share-fb-margin-top"); $("body").append(''+data[1]+''); $(".toast-msg").fadeIn(400,function(){ setTimeout(function(){ $(".toast-msg").fadeOut(function(){ $(".toast-msg").remove(); }); }, 2000); }); }); }); //click buy now in library page $('.library-buy-now').click(function(){ var val = $(this).attr('value'); window.location.href = urlConfig("buy-product/"+val); }); //hide vocabulary from personal page var objHideVocabulary; $('.hide-vocabulary-temp').click(function(){ var val = $(this).attr('value'); objHideVocabulary = $(this); $.ajax({ url: urlConfig("hide-vocabulary"), data: { vocabulary_id : val }, type: "POST" }).success(function(data) { if(data[0] == 0){ $("body").append(''+data[1]+''); $(".toast-msg").fadeIn(400,function(){ setTimeout(function(){ $(".toast-msg").fadeOut(function(){ $(".toast-msg").remove(); }); }, 2000); }); }else{ objHideVocabulary.parents('.personal-library-product').remove(); } }); }); //hide remind of vocabulary set var objHideRemind; $(document).on('click','.stop-receive-remind-vocabulary',function(){ var val = $(this).attr('value'); objHideRemind = $(this); $.ajax({ url: urlConfig("hide-vocabulary-remind"), data: { vocabulary_id : val }, type: "POST" }).success(function(data) { if(data[0] == 0){ $("body").append(''+data[1]+''); $(".toast-msg").fadeIn(400,function(){ setTimeout(function(){ $(".toast-msg").fadeOut(function(){ $(".toast-msg").remove(); }); }, 2000); }); }else{ $("body").append(''+vocaLang.updateSuccess+''); $(".toast-msg").fadeIn(400,function(){ setTimeout(function(){ $(".toast-msg").fadeOut(function(){ $(".toast-msg").remove(); }); }, 2000); }); } }); }); //visible remind of vocabulary set var objHideRemind; $(document).on('click','.receive-remind-vocabulary',function(){ var val = $(this).attr('value'); objHideRemind = $(this); $.ajax({ url: urlConfig("visible-vocabulary-remind"), data: { vocabulary_id : val }, type: "POST" }).success(function(data) { if(data[0] == 0){ $("body").append(''+data[1]+''); $(".toast-msg").fadeIn(400,function(){ setTimeout(function(){ $(".toast-msg").fadeOut(function(){ $(".toast-msg").remove(); }); }, 2000); }); }else{ $("body").append(''+vocaLang.updateSuccess+''); $(".toast-msg").fadeIn(400,function(){ setTimeout(function(){ $(".toast-msg").fadeOut(function(){ $(".toast-msg").remove(); }); }, 2000); }); } }); }); var checkBox = 1; $(window).click(function(){ if(checkBox == 1){ $('.box-search-vocabulary-result').css('display','none'); } }); $(document).on('click','.box-search-vocabulary-result .box-the-word-change-tab',function(){ var value = $(this).attr('link'); window.location.href = urlConfig('library#'+value); var seg = $(location).attr('pathname'); seg.indexOf(1); seg.toLowerCase(); seg1 = seg.split("/")[2]; seg = seg.split("/")[1]; if(seg == "library" && seg1 == undefined ){ window.location.reload(true); } }); //search library $('.txt-search').click(function(){ checkBox = 0; var value = $(this).val(); if(value.length < 1){ var content = $('.box-search-result-item').html(); if(content == ""){ $.ajax({ url: urlConfig("search-cate"), type:"POST" }).success(function(data) { $('.box-search-result-item').html(data); $('.box-search-vocabulary-result').css('display','block'); $('.box-search-result-item').css('display','block'); $('.box-search-result-item').next().remove(); }); }else{ $('.box-search-vocabulary-result').css('display','block'); $('.box-search-result-item').css('display','block'); $('.box-search-result-item').next().remove(); } }else{ $('.box-search-vocabulary-result').css('display','block'); $('.box-search-result-item').css('display','none'); } setTimeout(function(){ checkBox = 1; },500); }); $('.txt-search').keyup(function(e){ var value = $(this).val(); if(value.trim() != ""){ if(e.keyCode == 13){ window.location.href = urlConfig('library-search/'+value); }else{ if(value.length >= 1){ $.ajax({ url: urlConfig("library-search"), data: { key_word : value }, type:"POST" }).success(function(data) { $('.box-search-result-item').css('display','none'); $('.box-search-result-item').next().remove(); $(data).insertAfter('.box-search-result-item'); }); } } }else{ $('.box-search-result-item').css('display','block'); $('.box-search-result-item').next().remove(); } }); $('.btn-search').click(function(){ var value = $('.txt-search').val(); if(value.trim() != ""){ window.location.href = urlConfig('library-search/'+value); } }); //suggest //refresh-captcha $(document).on('click','.refresh-captcha-search',function(){ $.ajax({ url: urlConfig("auth/get-captcha"), type:"POST" }).success(function( data) { $(".img-captcha").attr("src",data); }); }); $('.put-change-two').css('display',"none"); $(document).on('change','.change-cate-suggest',function(){ if($('.change-cate-suggest').val()==1) { $('.put-change-one').css('display',"block"); $('.put-change-two').css('display',"none"); $('.btn-keep').addClass('btn-send-suggest-home'); $('.btn-keep').removeClass('btn-send-suggest-idea'); } else { $('.put-change-one').css('display',"none"); $('.put-change-two').css('display',"block"); $('.btn-keep').removeClass('btn-send-suggest-home'); $('.btn-keep').addClass('btn-send-suggest-idea'); } }); $(document).on('click','.suggest-the-word-menu-home',function(){ jQuery('.refresh-captcha-search').click(); $('#suggest-the-word-modal-home').modal(); }); $('.btn-send-suggest-home').click(function(){ var type = $('.change-cate-suggest').val(); if(type == 1){ var vocabularyName = $('.txt-name-vocabulary').val(); var idea = $('.summary-idea-home').val(); var source = $('.source-book-home-idea').val(); var captcha = $('.txt-suggest-vocabulary-captcha').val(); if(vocabularyName.trim() != "" && idea.trim() != ""){ $('#suggest-the-word-modal-home').modal('hide'); $.ajax({ url: urlConfig("suggest-vocabulary"), data: { vocabulary_name : vocabularyName, vocabulary_idea : idea, vocabulary_document : source, captcha : captcha }, type:"POST" }).success(function(data) { $("body").append(''+data[1]+''); $(".toast-msg").fadeIn(400,function(){ setTimeout(function(){ $(".toast-msg").fadeOut(function(){ $(".toast-msg").remove(); }); }, 2000); }); }); }else{ $('.suggest-msg-search').text("Please, fill full infomation!"); } }else{ var idea = $('.summary-idea-home-tab-difference').val(); var captcha = $('.txt-suggest-vocabulary-captcha').val(); if(idea.trim() != ""){ $('#suggest-the-word-modal-home').modal('hide'); $.ajax({ url: urlConfig("suggest-idea"), data: { idea : idea, captcha : captcha }, type:"POST" }).success(function(data) { $("body").append(''+data[1]+''); $(".toast-msg").fadeIn(400,function(){ setTimeout(function(){ $(".toast-msg").fadeOut(function(){ $(".toast-msg").remove(); }); }, 2000); }); }); }else{ $('.suggest-msg-search').text("Please, fill full infomation!"); } } }); //choose learning method $('.learning-writing-btn, .learning-speaking-btn, .learning-flashcard-btn,.learning-context-btn').click(function(){ $('.show-choose-learn-words form').attr('action',$(this).attr('url')); }); var uagent = navigator.userAgent.toLowerCase(); if (navigator.userAgent.match(/iPad|iPhone|iPod|Android|Windows Phone/i) != null ){ //var text = '
Hãy học VOCA trên Máy tính hoặc Laptop với các trình duyệt Chrome, Cốc Cốc để được hỗ trợ tốt nhất bạn nhé! ^^
×'; //$('.mobile-notification').html(text); //$('.mobile-notification').css('display','block'); $('.notification').css('display','none'); $('.close-notification').css('display','none'); } $(document).on('click','.mobile-close-notification',function(){ $('.mobile-notification').css('display','none'); $('.mobile-close-notification').css('display','none'); document.cookie="closeMobileNotification=closenotification;path=/"; }); /**begin library community general**/ $('.library-community-back').click(function(){ window.location = urlConfig('library-community'); return; if(history.length === 1){ window.location = urlConfig('library-community'); } else { history.back(); } }); /**end library community general**/ /**Begin pin word group**/ //click pin word icon $('.pin-word').click(function(e){ e.stopPropagation(); var vocabulary = $(this).attr('vocabulary'); var word = $(this).attr('word'); var definition = $(this).attr('definition'); $.ajax({ url: urlConfig("pin-word"), data: { 'vocabulary' : vocabulary, 'word' : word, 'definition' : definition }, type: "POST" }).success(function(data) { $('#pin-word-modal').html(data); $('#pin-word-modal').modal(); }); }); //event modal select archive $(document).on("click",".item-select-archive-word",function(){ $(".btn-acept-archive-select").removeClass("btn-acept-archive-select-active"); if($(this).hasClass("item-select-archive-word-active")){ $(this).removeClass("item-select-archive-word-active"); } else{ $(".item-select-archive-word").removeClass("item-select-archive-word-active"); $(this).addClass("item-select-archive-word-active"); } $('.pin-word-vocabulary-name').prop('checked', false); $(".item-select-archive-word").each(function(){ if($(this).hasClass("item-select-archive-word-active")){ $(this).find('.pin-word-vocabulary-name').prop('checked', true); $(".btn-acept-archive-select").addClass("btn-acept-archive-select-active"); } }); }); //pin word button $(document).on('click','.btn-pin-word',function(){ if ($("input[name='rad_vocabulary_name']:checked").val()) { var name = $("input[name='rad_vocabulary_name']:checked").val(); var vocabulary = $('.pin-word-vocabulary-content').val(); var word = $('.pin-word-word-content').val(); var definition = $('.pin-word-definition-content').val(); $('.pin-word-error').text(''); $.ajax({ url: urlConfig("pin-vocabulary-word"), data: { 'vocabulary' : vocabulary, 'word' : word, 'definition' : definition, 'name' : name }, type: "POST" }).success(function(data) { if(data[0] == 0){ $('.pin-word-error').text(data[1]); }else{ $('#pin-word-modal').modal('hide'); setTimeout(function(){ $('#pin-word-modal').html(data[1]); $('#pin-word-modal').modal('show'); setTimeout(function(){ $('#pin-word-modal').modal('hide'); },2000); },1000); } }); } }); //pin word add vocabulary $(document).on('click','.btn-pin-word-add-vocabulary',function(){ var vocabulary = $('.pin-word-vocabulary-content').val(); var word = $('.pin-word-word-content').val(); var definition = $('.pin-word-definition-content').val(); $.ajax({ url: urlConfig("pin-word-add-vocabulary"), data: { 'vocabulary' : vocabulary, 'word' : word, 'definition' : definition, }, type: "POST" }).success(function(data) { $('#pin-word-modal').modal('hide'); setTimeout(function(){ $('#pin-word-modal').html(data); $('#pin-word-modal').modal('show'); },1000); }); }); $(document).on("click",".add-image-feature",function(){ $(".box-select-img-word").removeClass("animated bounceOutRight"); setTimeout(function(){ $(".box-select-img-word").css("display","block"); $(".box-select-img-word").addClass("animated bounceInRight"); setTimeout(function(){ $(".img-avatar-word").each(function() { var width_img_avatar=$(this).width(); var height_img_avatar=width_img_avatar/2; $( this ).css("height",height_img_avatar); }); },300); },500); $(window).resize(function(){ setTimeout(function(){ $(".img-avatar-word").each(function() { var width_img_avatar=$(this).width(); var height_img_avatar=width_img_avatar/2; $( this ).css("height",height_img_avatar); }); },300); }); }); $(document).on('click','.btn-back-pin-word',function(){ $(".box-select-img-word").removeClass("animated bounceInRight"); $(".box-select-img-word").addClass("animated bounceOutRight"); setTimeout(function(){ $(".box-select-img-word").css("display","none"); },500); }); $(document).on("click",".item-img-select.add-image-vocabulary",function(){ $(".style-btn-update-img").removeClass("style-btn-update-img-active"); if($(this).hasClass("checked-img")){ $(this).removeClass("checked-img"); } else{ $(".item-img-select.add-image-vocabulary").each(function(){ if($(this).hasClass("checked-img")){ $(this).removeClass("checked-img"); $(this).find(".box-opacity-when-hover").css("display","none"); } }); $(this).addClass("checked-img"); } $(".item-img-select.add-image-vocabulary").each(function(){ if($(this).hasClass("checked-img")){ $(".style-btn-update-img").addClass("style-btn-update-img-active"); } }); }); $(document).on("mouseenter",".item-img-select.add-image-vocabulary",function(){ if(!$(this).hasClass("checked-img")){ $(this).find(".box-opacity-when-hover").fadeIn(200); } }); $(document).on("mouseleave",".item-img-select.add-image-vocabulary",function(){ if(!$(this).hasClass("checked-img")){ $(this).find(".box-opacity-when-hover").fadeOut(200); } }); $(document).on("click","#pin-word-modal .box-input-three",function(){ if ($(this).find(".check-box-opacity").is(':checked')) { $(this).find(".check-box-opacity").prop('checked', false); $(this).find(".content-check-agree").css("display","inline-block"); $(this).find(".content-check-agreeed").css("display","none"); $(this).find(".box-check-style").css("background","none"); $(this).find(".box-check-style").css("border","solid 1px #c3c3c3"); } else{ $(this).find(".check-box-opacity").prop('checked', true); $(this).find(".content-check-agree").css("display","none"); $(this).find(".content-check-agreeed").css("display","inline-block"); $(this).find(".box-check-style").css("background","#00bdfd"); $(this).find(".box-check-style").css("border","none"); } }); $(document).on("click",".btn-pin-update-img",function(){ if($(this).hasClass("style-btn-update-img-active")){ var srcImgSelect = ""; $(".item-img-select.add-image-vocabulary").each(function(){ if($(this).hasClass("checked-img")){ srcImgSelect = $(this).find(".img-avatar-word").attr("src"); return; } }); $(".pin-add-vocabulary-image-content").attr("src",srcImgSelect); $(".box-select-img-word").removeClass("animated bounceInRight"); $(".box-select-img-word").addClass("animated bounceOutRight"); setTimeout(function(){ $(".box-select-img-word").css("display","none"); },500); if($(".pin-word-vocabulary-name").val().length > 0 && $(".pin-word-vocabulary-name").val().length <= 35 && $(".pin-word-vocabulary-description").val().length > 0 && $(".pin-word-vocabulary-description").val().length <= 300 && $(".pin-add-vocabulary-image-content").attr("src") != ""){ $(".a-pin-word-add-vocabulary").addClass("style-btn-create-active"); }else{ $(".a-pin-word-add-vocabulary").removeClass("style-btn-create-active"); } } else{ alert("Vui lòng ch?n hình b? t?."); } }); $(document).on("keyup",".pin-word-vocabulary-name,.pin-word-vocabulary-description",function(){ if($(".pin-word-vocabulary-name").val().length > 0 && $(".pin-word-vocabulary-name").val().length <= 35 && $(".pin-word-vocabulary-description").val().length > 0 && $(".pin-word-vocabulary-description").val().length <= 300 && $(".pin-add-vocabulary-image-content").attr("src") != ""){ $(".a-pin-word-add-vocabulary").addClass("style-btn-create-active"); }else{ $(".a-pin-word-add-vocabulary").removeClass("style-btn-create-active"); } }); var isAdded = 0; $(document).on('click','.a-pin-word-add-vocabulary',function(){ if(isAdded == 1){ return; } isAdded = 1; var vocabulary = $('.pin-word-vocabulary-content').val(); var word = $('.pin-word-word-content').val(); var definition = $('.pin-word-definition-content').val(); var name = $('.pin-word-vocabulary-name').val(); var cate = $('.pin-word-vocabulary-cate').val(); var imgLink = $('.pin-add-vocabulary-image-content').attr('src'); var description = $('.pin-word-vocabulary-description').val(); var quantity = $('.pin-word-community-quantity').val(); var isPublic = 0; if($('.pin-word-community-public').is(':checked')){ isPublic = 1; } $.ajax({ url: urlConfig("pin-word-and-add-vocabulary"), data: { 'vocabulary' : vocabulary, 'word' : word, 'definition' : definition, 'name' : name, 'cate' : cate, 'img_link' : imgLink, 'description' : description, 'quantity' : quantity, 'is_public' : isPublic }, type: "POST" }).success(function(data) { if(data[0] == 0){ $('.pin-word-error').text(data[1]); isAdded = 0; }else{ $('#pin-word-modal').modal('hide'); setTimeout(function(){ $('#pin-word-modal').html(data[1]); $('#pin-word-modal').modal('show'); isAdded = 0; },1000); } }); }); $(document).on('change','.slt-topic-cate',function(){ var id = $(this).val(); $('.slt-topic-cate').val(id); $(".pin-add-vocabulary-image-content").attr("src",""); $.ajax({ url: urlConfig("get-image-by-product-cate/"+id), type: "POST" }).success(function(data) { $('.image-community-group').html(data); }); }); /**End pin word group**/ /**begin pin word search**/ $(document).on('keyup','.txt-search-pin-word',function(){ var keyword = $(this).val(); if(keyword.trim() != ""){ $('.remove-search').addClass('remove-search-active'); if(localStorage['pin_key_'+keyword] != undefined){ $('.search-pin-item').next().remove(); $(localStorage['pin_key_'+keyword]).insertAfter('.search-pin-item'); return; } }else{ $('.search-pin-item').next().remove(); $('.remove-search').removeClass('remove-search-active'); return; } clearTimeout($.data(this, 'timersearch')); var id = $(this).attr('vocabulary'); $(this).data('timersearch', setTimeout(function(){ if(keyword.trim() != ""){ //$('.remove-search').addClass('remove-search-active'); $.ajax({ url: urlConfig("search-pin-word-key/"+id), data: { 'keyword' : keyword }, type: "POST" }).success(function(data) { if(data[0] == 1){ $('.search-pin-item').next().remove(); $(data[1]).insertAfter('.search-pin-item'); localStorage['pin_key_'+keyword] = data[1]; } }); }else{ $('.search-pin-item').next().remove(); $('.remove-search').removeClass('remove-search-active'); } }, 500)); }); $(document).on('click','.remove-search-active',function(){ $('.txt-search-pin-word').val(''); $('.txt-search-pin-word').focus(); $('.search-pin-item').next().remove(); $(this).fadeOut(); }); $(document).on('click','.btn-pin-word-icon',function(){ var name = $("#search-pin-word-modal").attr('vocabulary'); var vocabulary = $(this).attr('vocabulary'); var word = $(this).attr('word'); var definition = $(this).attr('def'); $.ajax({ url: urlConfig("pin-vocabulary-word-search"), data: { 'vocabulary' : vocabulary, 'word' : word, 'definition' : definition, 'name' : name }, type: "POST" }).success(function(data) { $('#search-pin-word-modal').modal('hide'); if(data[0] == 1){ if($('.title-vocabulary-all').siblings().hasClass('box-empty-word')){ $('.box-empty-word').remove(); $('
'+data[2]+'
').insertAfter('.title-vocabulary-all'); $('.add-pin-word').fadeIn(); }else{ $('.box-list-vocabulary').children('.row').prepend(data[2]); } var quantity = $('.title-vocabulary-all .style-badge-number-word').html(); quantity = parseInt(quantity); if(!isNaN(quantity)){ $('.title-vocabulary-all .style-badge-number-word').html(quantity + 1); var limit = $('.add-pin-word').attr('limit'); limit = parseInt(limit); if(limit <= (quantity + 1)){ $('.add-pin-word').fadeOut(); setTimeout(function(){ location.reload(); },3000); } } } setTimeout(function(){ if(data[0] == 0){ $('#search-pin-word-modal').html(data[1]); $('#search-pin-word-modal').modal('show'); } setTimeout(function(){ $('#search-pin-word-modal').modal('hide'); setTimeout(function(){ $('.add-pin-word').trigger('click'); },500); },1000); },1000); }); }); $('.msg-pin-word-btn').click(function(){ $('#learning-msg-modal').modal('hide'); setTimeout(function(){ $('.add-pin-word').trigger('click'); },500); }); /**end pin word search**/ /**Begin rating voca community**/ var isRated = 0; $('.star-rating').mouseover(function(){ if(isRated == 1){ return false; } $('.star-rating').removeClass('fa-star'); $('.star-rating').addClass('fa-star-o'); $(this).addClass('fa-star'); $(this).removeClass('fa-star-o'); $(this).prevAll('.fa').addClass('fa-star'); $(this).prevAll('.fa').removeClass('fa-star-o'); }); $('.star-rating').mouseout(function(){ $('.star-rating').removeClass('fa-star'); $('.star-rating').addClass('fa-star-o'); }); $(document).on('click','.star-rating.fa-star',function(){ var c = confirm(ratingMsg); if(c == false){ return false; } // $('.star-rating').removeClass('star-rating'); var rate = $(this).index(); var vocabulary = $(this).parent().attr('vocabulary'); isRated = 1; $('.library-community-rating').nextAll().remove(); $(' '+rate+'').insertAfter($('.library-community-rating')); $.ajax({ url: urlConfig("rating-voca-community/"+vocabulary), data: { 'rate' : rate }, type: "POST" }); }); $('.s-rate').mouseover(function(){ var i = $('.s-rate').index(this); $('.s-rate').each(function(index){ if(index <= i){ $(this).addClass('s-rating'); } }); }); $('.s-rate').mouseout(function(){ $('.s-rate').removeClass('s-rating'); }); $(document).on('click','.s-rate.s-rating',function(){ $('#rating-msg-modal').modal('hide'); var rate = parseInt($(this).index()) + 1; var vocabulary = $('.btn-library-community-rating').attr('vocabulary'); $('.rating-vocabulary, .txt-library-community-rating').addClass('rated-vocabulary'); $.ajax({ url: urlConfig("rating-voca-community/"+vocabulary), data: { 'rate' : rate }, type: "POST" }).success(function(){ $('#rated-msg-modal').modal(); setTimeout(function(){ $('#rated-msg-modal').modal('hide'); },1000) }); }); $('.rating-vocabulary, .txt-library-community-rating').click(function(){ if(!$(this).hasClass('rated-vocabulary')){ $('#rating-msg-modal').modal(); }else{ $('#rated-msg-modal').modal(); } }); /**End rating voca community**/ /**Begin learning community**/ //choose learning method $('.learning-community').click(function(){ $('.choose-learn-community-words form').attr('action',$(this).attr('url')); }); $('.learning-writing-community').click(function(){ $('.choose-learn-community-words form').attr('action',$(this).attr('url')); }); $('.learning-speaking-community').click(function(){ $('.choose-learn-community-words form').attr('action',$(this).attr('url')); }); $('.choose-learning-community-words').click(function(){ console.log(12345); var topic = $(this).attr('topic'); $.ajax({ url: urlConfig("choose-learning-commuinity-words/"+topic), type:"POST" }).success(function(data) { console.log(data); if(data !=0) { $('.choose-learn-community-words .modal-dialog-choose-word').html(data); $('.choose-learn-community-words').modal(); } }); }); /**End learning community**/ jQuery.fn.exists = function(){return this.length>0;} if ($('#sub-menu').exists() && $('#sub-menu').is(":visible")) { $('#voca-wrap').css('padding','100px 0 100px'); } $('.sub-menu-library').mouseover(function(){ $(this).addClass('open'); }); $('.sub-menu-library').mouseout(function(){ $(this).removeClass('open'); }); $('.sub-menu-blog').mouseover(function(){ $(this).addClass('open'); }); $('.sub-menu-blog').mouseout(function(){ $(this).removeClass('open'); }); $('.sub-menu-phone').mouseover(function(){ $(this).addClass('open'); }); $('.sub-menu-phone').mouseout(function(){ $(this).removeClass('open'); }); setTimeout(function(){$('.sub-menu-personal, .sub-menu-library, .sub-menu-library-community, .sub-menu-community,.sub-menu-blog ').has('.menu-active').addClass('sub-menu-item-border');},1000); }); //show music modal function showMusicModal(url){ $('#music-modal .learning-music-modal .learning-music-modal-src').attr('src',url); $('#music-modal').modal('show'); } //show video modal function showVideoModal(url){ $('#video-modal .learning-video-modal .learning-video-modal-src').attr('src',url+'?rel=0'); $('#video-modal').modal('show'); } //show story modal function showStoryModal(url){ $('#story-modal').modal('show'); if(url == 0){ $('#story-modal .learning-music-modal-src').css("display","none"); }else{ $('#story-modal .learning-music-modal-src').attr('src',url+'?rel=0'); } } /* $(function(){ $('.avatar-picture').tooltip({placement: 'bottom', html: true,trigger:'click'}); $('.sidebar-nav').slimScroll({ height: '100%', color:"#555" }); }); $(function(){ $('.bell-notification-content-items').slimScroll({ height: '500px', color:"#efefef" }); }); */ $(window).scroll(function(){ if($(document).scrollTop()>=600){ $('.intro-text-menu img').removeClass('hidden'); }else{ if(!$('.intro-text-menu img').hasClass('hidden')){ $('.intro-text-menu img').addClass('hidden'); } } }); function removeInform(){ $('.inform-bar').fadeOut('slow'); } $(document).ready(function(){ $('.title-tooltip').tooltip({'html':true}); $('.title-tooltip').mouseover(function(){ $(this).parent().parent().next().css('text-decoration','underline'); }); $('.title-tooltip').mouseout(function(){ $(this).parent().parent().next().css('text-decoration','none'); }); var heightScreen = jQuery(window).height()-50; //$('.main-wrapper').css('min-height',heightScreen+'px'); $(document).on('change','.choose-language',function(){ var lang = $(this).val(); $('form#choose-laguage-form').attr('action',urlConfig('set-language/'+ lang)); $('form#choose-laguage-form').submit(); }); $(document).on('mouseup','.btn-edit-avatar',function(){ $.ajax({ url: urlConfig('change-avatar'), data: { }, type: 'POST' }).success(function(data) { $('#change-avatar-modal').html(data); $('#change-avatar-modal').modal(); }); }); $('.close-notification').click(function(){ $('.notification').css('display','none'); $('.close-notification').css('display','none'); document.cookie="closeNotification=closenotification;path=/"; }); var show = 0; $('.hide-show-message').click(function(){ if(show == 0){ $('.message-content').css('bottom', '0px'); show = 1; }else{ show = 0; $('.message-content').css('bottom', '-520px'); } }); $('.hide-message').click(function(){ show = 0; $('.message-content').css('bottom', '-520px'); document.cookie="hideEvent=hideEvent;path=/"; }); if (document.cookie.indexOf("hideEvent") < 0) { setTimeout(function(){ $('.message-content').css('bottom', '0px'); document.cookie="hideEvent=hideEvent;path=/"; show = 1; }, 10000); } $('.voca-vip').mouseover(function(){ $(this).css('text-decoration','underline'); }); $('.voca-vip').mouseout(function(){ $(this).css('text-decoration','none'); }); $(document).on('mouseover','.avatar-picture-item',function(){ $('.btn-edit-avatar.avatar-picture.avatar-picture-item + .change-avatar').css('visibility','visible'); }); $(document).on('mouseout','.avatar-picture-item',function(){ $('.btn-edit-avatar.avatar-picture.avatar-picture-item + .change-avatar').css('visibility','hidden'); }); $(document).on('mouseover','.btn-edit-avatar.avatar-picture.avatar-picture-item + .change-avatar',function(){ $(this).css('visibility','visible'); }); $(document).on('mouseout','.btn-edit-avatar.avatar-picture.avatar-picture-item + .change-avatar',function(){ $(this).css('visibility','hidden'); }); var l = 0; $(".learn-mobile").click(function(){ if(l == 0){ l = 1; $('.nav-mobile').slideDown(); $('.learn-mobile-icon').removeClass('fa-chevron-down'); $('.learn-mobile-icon').addClass('fa-chevron-up'); }else{ l = 0; $('.nav-mobile').slideUp(); $('.learn-mobile-icon').removeClass('fa-chevron-up'); $('.learn-mobile-icon').addClass('fa-chevron-down'); } }); //setting sound type $('.li-set-sound-type').click(function(){ $('.ul-sound-type').slideToggle(); }); }); (function(){ var _z = console; Object.defineProperty( window, "console", { get : function(){ if( _z._commandLineAPI ){ throw "Sorry, VOCA Can't excute YOUR scripts!!!"; } return _z; }, set : function(val){ _z = val; } }); })();