| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189 |
- $(document).ready(function () {
- new WOW().init();
- jQuery('#slider').slippry({
- control: false,
- pager: false,
- transition: 'horizontal'
- });
- });
- // Video
- // 2. This code loads the IFrame Player API code asynchronously.
- var tag = document.createElement('script');
- tag.src = "https://www.youtube.com/iframe_api";
- var firstScriptTag = document.getElementsByTagName('script')[0];
- firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
- // 3. This function creates an <iframe> (and YouTube player)
- // after the API code downloads.
- var player;
- var playerWidth = 470;
- function onYouTubeIframeAPIReady() {
- player = new YT.Player('player-video', {
- height: '100%',
- width: '100%',
- videoId: "Ixkd3pLIlY4",
- playerVars: {
- autoplay: 0,
- controls: 0,
- showinfo: 0,
- playsinline: 1,
- rel: 0
- },
- events: {
- // 'onReady': onPlayerReady,
- // 'onStateChange': onPlayerStateChange
- }
- });
- }
- $(document).on('click', '#home-video .layout-video', function () {
- if (isFunction(player.getPlayerState)) {
- if (player.getPlayerState() == 1) {
- player.pauseVideo();
- $("#home-video .layout-video").removeClass('hide-layout');
- } else {
- player.playVideo();
- $("#home-video .layout-video").addClass('hide-layout');
- }
- }
- });
- function isFunction(functionToCheck) {
- return functionToCheck && {}.toString.call(functionToCheck) === '[object Function]';
- }
- function checkToRedirect(url, typeCourse) {
- $.ajax({
- url: "/Home/CheckAccount",
- type: "POST",
- data: {
- typeCourse: typeCourse
- },
- success: function (data) {
- if (data.code == "0") {
- // login already
- window.location.href = url;
- } else {
- //show
- window.location.href = "/Home/LoginByUniId";
- // $('#login-dialog').modal('show');
- }
- },
- error: function (result) {
- }
- });
- }
- function login() {
- $('#login-dialog').modal('show');
- $('#signup-dialog').modal('hide');
- $('#choose-language-dialog').modal('hide');
- $('#free-account-dialog').modal('hide');
- }
- function registerCourse() {
- $('#login-dialog').modal('hide');
- $('#signup-dialog').modal('hide');
- $('#choose-language-dialog').modal('show');
- $('#free-account-dialog').modal('hide');
- }
- function createFree() {
- $('#login-dialog').modal('hide');
- $('#signup-dialog').modal('hide');
- $('#choose-language-dialog').modal('hide');
- $('#free-account-dialog').modal('show');
- }
- function chooseCourse(courseId) {
- $('#free-account-dialog').modal('hide');
- $('#choose-language-dialog').modal('hide');
- $('#login-dialog').modal('hide');
- $('#signup-dialog').modal('hide');
- $("#packageId").val(courseId);
- $.ajax({
- url: urlConfig("/Home/CourseSet"),
- type: "POST",
- data: {
- __RequestVerificationToken: $('input[name=__RequestVerificationToken]').val(),
- courseId: courseId,
- }
- }).success(function (data) {
- if (courseId == 3) {
- // Tieng anh => show register dialog
- $('#signup-dialog').modal('show');
- } else {
- //$('#free-account-dialog').modal('show');
- $('#signup-dialog').modal('show');
- }
- });
- }
- function registerAction(course) {
- // call register api
- $.ajax({
- url: urlConfig("/Home/RegisterSubWithoutCaptcha"),
- type: "POST",
- data: {
- __RequestVerificationToken: $('input[name=__RequestVerificationToken]').val(),
- packageId: course,
- }
- }).success(function (data) {
- if (data.error_code == "100") {
- // success
- $('#sub-register-dialog').modal('show');
- } else {
- console.log(data.error_content);
- $('#message-dialog').modal('show');
- $('#message-content').html(data.error_content);
- }
- });
- }
- function ResentOtp() {
- $.ajax({
- url: urlConfig("/Home/ResentOtp"),
- type: "POST",
- data: {
- __RequestVerificationToken: $('input[name=__RequestVerificationToken]').val(),
- }
- }).success(function (data) {
- if (data.error_code == "100") {
- $("#otp-result").html(data.error_content);
- } else {
- Reload();
- }
- });
- }
- function myFunction() {
- document.getElementById("myDropdown").classList.toggle("show");
- }
- // Close the dropdown menu if the user clicks outside of it
- window.onclick = function (event) {
- if (!event.target.matches('.dropbtn')) {
- var dropdowns = document.getElementsByClassName("dropdown-content");
- var i;
- for (i = 0; i < dropdowns.length; i++) {
- var openDropdown = dropdowns[i];
- if (openDropdown.classList.contains('show')) {
- openDropdown.classList.remove('show');
- }
- }
- }
- }
|