jQuery(document).ready(function() {jQuery('.custom-fixed-side').theiaStickySidebar({additionalMarginTop: -15});}); $(function(){ var url = window.location.pathname, urlRegExp = new RegExp(url.replace(/\/$/,'') + "$"); // create regexp to match current url pathname and remove trailing slash if present as it could collide with the link in navigation in case trailing slash wasn't present there // now grab every link from the navigation $('.user-bottom-nav a').each(function(){ // and test its normalized href against the url pathname regexp if(urlRegExp.test(this.href.replace(/\/$/,''))){ $(this).addClass('menuactive'); } }); }); function Wo_open_send_gift(){ $('#send_gift').modal('show'); } function Wo_SendGiftToUser(from, to){ var gift_id = $('#send-gift-button').attr('data-gift-id'); var gift_img = $('#send-gift-button').attr('data-gift-img'); if (!from || !to || !gift_id) { return false; } $('#send_gift').find('.disable_btn').attr('disabled','disabled'); $.ajax({ url: Wo_Ajax_Requests_File(), type: 'GET', dataType: 'json', data: {f: 'send_gift',from:from,to:to,gift_id:gift_id,gift_img:gift_img}, }) .done(function(data) { if (data.status == 200) { if (node_socket_flow == "1") { socket.emit("user_notification", { to_id: to, user_id: _getCookie("user_id")}); } $("body").snackbar({ message: "Đã gửi quà thành công" }); $('#send_gift').find('.disable_btn').removeAttr("disabled"); Wo_Delay(function(){ $("#send_gift").modal('hide'); $('#send-gift-button').attr('data-gift-id', '').attr('data-gift-img', '').attr('disabled',false); },1500); } }) .fail(function() { console.log("error"); }) } function Wo_RegisterPoke(received_user_id , send_user_id){ if (!received_user_id || !send_user_id) { return false; } $.ajax({ url: Wo_Ajax_Requests_File(), type: 'GET', dataType: 'json', data: {f: 'poke',received_user_id:received_user_id,send_user_id:send_user_id}, }) .done(function(data) { if (data.status == 200) { if (node_socket_flow == "1") { socket.emit("user_notification", { to_id: received_user_id, user_id: _getCookie("user_id")}); } $("body").snackbar({ message: "Bạn đã chọc 59dce1d2b" }); $("#pokebutton").remove(); } }) .fail(function() { console.log("error"); }) } function Wo_ActivateFamilyMember(id = false,self = false,member = false){ if (!id || !self || !member) { return false; } $.ajax({ url: Wo_Ajax_Requests_File(), type: 'GET', dataType: 'json', data: {f: 'family',s:'accept_member',id:id,type:member}, }) .done(function(data) { if (data.status == 200) { $("body").snackbar({ message: "Thành viên mới đã được thêm vào danh sách gia đình của bạn thành công!" }); $('[data-family-member="'+id+'"]').slideUp(function(){ $(this).remove(); }) } }) .fail(function() { console.log("error"); }) } function Wo_AcceptRelationRequest(id = false,member = false,type = false ,self = false){ if (!member || !self || !type || !id) { return false; } $.ajax({ url: Wo_Ajax_Requests_File(), type: 'GET', dataType: 'json', data: {f: 'family',s:'accept_relation',id:id,type:type,member:member}, }) .done(function(data) { if (data.status == 200) { window.location = data.url; } }) .fail(function() { console.log("error"); }) } function Wo_DeleteRelationRequest(id = false,user = false,type = false,self = false){ if (!self || !id || !user || !type) { return false; } $.ajax({ url: Wo_Ajax_Requests_File(), type: 'GET', dataType: 'json', data: {f: 'family',s:'delete_relation',id:id,user:user,type:type}, }) .done(function(data) { if (data.status == 200) { $("[data-relationship-request='"+id+"']").slideUp(function(){ $(this).remove(); }) } }) .fail(function() { console.log("error"); }) } function OpenCropModal() { $('#cropImage').modal('show'); setTimeout(function () { $('#image-to-crop img').rcrop({ minSize : [130,130], preserveAspectRatio : true, grid : true, }); }, 250); } function CropImage() { values = $('#image-to-crop img').rcrop('getValues'); $path = $('#image-to-crop img').attr('data-image'); if (!$path) { return false; $('#cropImage').modal('hide'); } $('#cropImage').find('.disable_btn').attr('disabled','disabled'); $.post(Wo_Ajax_Requests_File() + '?f=crop-avatar', {user_id:19745, path: $path, x: values.x, y:values.y, height: values.height, width:values.width}, function(data, textStatus, xhr) { if (data.status == 200) { location.reload(false); } else { $('#cropImage').modal('hide'); } $('#cropImage').find('.disable_btn').removeAttr("disabled"); }); } function Wo_DeleteFamilyMember(id = false){ if (!id) { return false; } $('#delete_family_mbr_modal').find('.disable_btn').attr('disabled','disabled'); $.ajax({ url: Wo_Ajax_Requests_File(), type: 'GET', dataType: 'json', data: {f: 'family',s:'delete_member',id:id}, }) .done(function(data) { if (data.status == 200) { $('[data-family-member="'+id+'"]').slideUp('slow',function(){ $(this).remove(); }) Wo_Delay(function(){ $("#delete_family_mbr_modal").modal('hide'); },1500); } $('#delete_family_mbr_modal').find('.disable_btn').removeAttr("disabled"); }) .fail(function() { console.log("error"); }) } function SelectFamilyList(id) { $("#family_list").val(id); } function Wo_AddFamilyMember(){ var member_type = $("#family_list").val(); if (!member_type || member_type < 1 || member_type > 43) { return false; } $('#add_to_family').find('.disable_btn').attr('disabled','disabled'); $.ajax({ url: Wo_Ajax_Requests_File(), type: 'GET', dataType: 'json', data: { f: 'family', s:'add_member', member_id:'19745', type:member_type }, }) .done(function(data) { if (data.status == 200) { $('.add_to_family_alert').html('
' + data.message + '
'); Wo_Delay(function(){ $("#open_add_to_family_modal").slideUp(function(){ $(this).remove(); $("#add_to_family").modal('hide'); }) location.reload() },1500); } else{ $('.add_to_family_alert').html('
' + data.message + '
'); } $('#add_to_family').find('.disable_btn').removeAttr("disabled"); }) .fail(function() { console.log("error"); }) } function Wo_ReportProfile(id = false,report = true){ var report_text = $("#report-user-text-19745").val(); if (!id) {return false;} else if(report == true){ if (!report_text) {return false;} } $('#report_profile').find('.disable_btn').attr('disabled','disabled'); $.ajax({ url: Wo_Ajax_Requests_File() + '?f=reports&s=report_user', type: 'POST', dataType: 'json', data: {text:report_text,user:id}, }) .done(function(data) { if(data.status == 200 && data.code == 0){ $('#report_status').replaceWith('\
  • \ \ Báo cáo người dùng này\
  • '); } else if (data.status == 200 && data.code == 1) { $("#report-user-text-19745").val(''); $("#report_profile").modal('hide'); $('#report_status').replaceWith('\
  • \ \ Hủy báo cáo\
  • '); } $('#report_profile').find('.disable_btn').removeAttr("disabled"); }) .fail(function() { console.log("error"); }) } function loadposts(user_id) { $.get(Wo_Ajax_Requests_File() + '?f=load_profile_posts', {user_id:user_id}, function(data) { $('.posts_load').html(data); }); } var user_id = $('.profile').attr('data-id'); $(function () { user_id = $('.profile').attr('data-id'); $('form.profile-avatar-changer').ajaxForm({ url: Wo_Ajax_Requests_File() + '?f=update_user_avatar_picture', beforeSend: function () { $('.profile_avatar').fadeOut(100); $('.user-avatar-uploading-container').fadeIn(200); }, success: function (data) { $('.profile_avatar').fadeIn(100); if(data.status == 200) { Wo_GetNewPosts(); $('[id^=updateImage-19745]').attr('data-target', '#ProfileImageModal-Stopped'); $('[id^=updateImage-19745]').attr('onclick', 'Wo_OpenProfilePicture("' + data.img_or + '");'); $('[id^=updateImage-19745]').attr("src", data.img); $('#cropImage').modal('show'); $('#image-to-crop img').attr('src', data.avatar_full); $('#image-to-crop img').attr('data-image', data.avatar_full_or); $('#image-to-crop img').on("load", function() { setTimeout(function () { $('#image-to-crop img').rcrop({ minSize : [130,130], preserveAspectRatio : true, grid : true }); }, 1000); }).each(function() { if(this.complete) $(this).load(); }); if($("ul[data-profile-completion]").length == 1) { if ($('#add-profile-avatar').length == 1) { // window.location.reload(); } } } else { if(data.invalid_file == 3){ $("body").snackbar({ message: "Chúng tôi đã phát hiện thấy một số nội dung người lớn trên hình ảnh bạn đã tải lên, do đó chúng tôi đã từ chối quá trình tải lên của bạn." }); } } $('.user-avatar-uploading-container').fadeOut(200); } }); $('form.cover-position-form').ajaxForm({ url: Wo_Ajax_Requests_File() + '?f=re_cover', dataType: 'json', beforeSend: function() { $('.user-reposition-dragable-container').hide(); $('.user-repositioning-icons-container').html('
    ').fadeIn('fast'); }, success: function(data) { if (data.status == 200) { $('.user-cover-reposition-w img').attr('src', data.url + '?time=' + Math.random()).on("load", function () { $('.when-edit').hide(); $('.when-notedit').show(); $('.user-repositioning-icons-container').fadeOut('fast').html(''); $('.user-cover-reposition-w').show(); $('.user-reposition-container').hide().find('img').css('top', 0); $('.cover-resize-buttons').hide(); $('.default-buttons').show(); $('input.cover-position').val(0); $('.wo_user_profile .card.hovercard .pic-info-cont, .problackback').fadeIn(); }); } } }); $('.profile-cover-changer').ajaxForm({ url: Wo_Ajax_Requests_File() + '?f=update_user_cover_picture', beforeSend: function () { $('.profile_cover').fadeOut(100); $('.user-cover-uploading-container,.user-cover-uploading-progress').fadeIn(200); }, success: function (data) { $('.profile_cover').fadeIn(100); if(data.status == 200) { Wo_GetNewPosts(); $('[id^=cover-image]').attr('data-target', '#ProfileCoverImageModal-Stopped'); $('[id^=cover-image]').attr('onclick', 'Wo_OpenProfileCover("' + data.cover_or + '");'); $('[id^=cover-image]').attr("src", data.img); $('#full-image').attr("src", data.cover_full); $('#full-input-image').val(data.cover_full); $('#cover-input-image').val(data.cover_or); Wo_StartRepositioner(); } else { if(data.invalid_file == 3){ $("body").snackbar({ message: "Chúng tôi đã phát hiện thấy một số nội dung người lớn trên hình ảnh bạn đã tải lên, do đó chúng tôi đã từ chối quá trình tải lên của bạn." }); } } $('.user-cover-uploading-container,.user-cover-uploading-progress').fadeOut(200); } }); }); function Wo_GetFollowing(user_id) { $.get(Wo_Ajax_Requests_File(), { f: 'get_following_users', user_id: user_id }, function (data) { if(data.status == 200) { $('.sidebar-following-users-container').html(data.html); } }); } function Wo_GetFollowers(user_id) { $.get(Wo_Ajax_Requests_File(), { f: 'get_followers_users', user_id: user_id }, function (data) { if(data.status == 200) { $('.sidebar-followers-users-container').html(data.html); } }); } function Wo_GetLikes(user_id) { $.get(Wo_Ajax_Requests_File(), { f: 'pages', s: 'get_likes', user_id: user_id }, function (data) { if(data.status == 200) { $('.sidebar-likes-container').html(data.html); } }); } function Wo_GetMoreFollowing(user_id) { after_last_id = $('.user-data:last').attr('data-user-id'); $.get(Wo_Ajax_Requests_File(), { f: 'get_more_following', user_id: user_id, after_last_id: after_last_id }, function (data) { if(data.status == 200) { if(data.html.length == 0) { $('.load-more').find('button').text("Không có thêm người dùng nào để hiển thị"); } else { $('#following-list').append(data.html); } } }); } function Wo_GetMoreUserLikes(user_id) { after_last_id = $('.user-data:last').attr('data-page-id'); $.get(Wo_Ajax_Requests_File(), { f: 'pages', s: 'get_more_likes', user_id: user_id, after_last_id: after_last_id }, function (data) { if(data.status == 200) { if(data.html.length == 0) { $('.load-more').find('button').text("Không còn trang nào để hiển thị"); } else { $('#likes-list').append(data.html); } } }); } function Wo_GetMoreVideos(user_id) { after_last_id = $('.video-data:last').attr('data-video-id'); $.get(Wo_Ajax_Requests_File(), { f: 'get_more_videos', user_id: user_id, after_last_id: after_last_id }, function (data) { if(data.status == 200) { if(data.html.length == 0) { $('.load-more').find('button').text("Không còn video nào để hiển thị"); } else { $('#videos-list').append(data.html); } } }); } function Wo_GetMoreReelsVideos(user_id) { after_last_id = $('.video-data:last').attr('data-reels-video-id'); $.get(Wo_Ajax_Requests_File(), { f: 'get_more_reels_videos', user_id: user_id, after_last_id: after_last_id }, function (data) { if(data.status == 200) { if(data.html.length == 0) { $('.load-more').find('button').text("Không còn video nào để hiển thị"); } else { $('#reels-videos-list').append(data.html); } } }); } function Wo_GetMorePhotos(user_id) { after_last_id = $('.usr_phts_sectn .photo-data:last').attr('data-photo-id'); $.get(Wo_Ajax_Requests_File(), { f: 'get_more_photos', user_id: user_id, after_last_id: after_last_id }, function (data) { if(data.status == 200) { if(data.html.length == 0) { $('.load-more').find('button').text("Không còn ảnh nào để hiển thị"); } else { $('#photos-list').append(data.html); } } }); } function Wo_GetMoreFollowers(user_id) { after_last_id = $('.user-data:last').attr('data-user-id'); $.get(Wo_Ajax_Requests_File(), { f: 'get_more_followers', user_id: user_id, after_last_id: after_last_id }, function (data) { if(data.status == 200) { if(data.html.length == 0) { $('.load-more').find('button').text("Không có thêm người dùng nào để hiển thị"); } else { $('#followers-list').append(data.html); } } }); } function Wo_UpdateProfileAvatar() { $("form.profile-avatar-changer").submit(); } function Wo_UpdateProfileCover() { $("form.profile-cover-changer").submit(); } function Wo_SetCookieAlert() { $.get(Wo_Ajax_Requests_File(), { f: 'set_admin_alert_cookie' }); } function Wo_OpenProfileCover(image) { $.post(Wo_Ajax_Requests_File() + '?f=get_user_profile_cover_image_post', { image:image }, function (data) { if (data.status == 200) { Wo_OpenLightBox(data.post_id); } else { $('[id^=cover-image]').attr('data-target', '#ProfileCoverImageModal'); $('[id^=cover-image]').attr('data-toggle', 'modal'); $('#ProfileCoverImageModal').modal('show'); } }); } function Wo_OpenProfilePicture(image) { $.post(Wo_Ajax_Requests_File() + '?f=get_user_profile_image_post', { image:image }, function (data) { if (data.status == 200) { Wo_OpenLightBox(data.post_id); } else { $('[id^=updateImage-' + user_id + ']').attr('data-target', '#ProfileImageModal-' + user_id); $('[id^=updateImage-' + user_id + ']').attr('data-toggle', 'modal'); $('#ProfileImageModal-' + user_id).modal('show'); } }); } function Wo_GetMutualFriends(user_id) { Wo_progressIconLoader($('#sidebar-mutual-list-container').find('span')); $.get(Wo_Ajax_Requests_File(), { f: 'get_mutual_users', user_id: user_id }, function (data) { if(data.status == 200) { $('.sidebar-mutual-users-container').html(data.html); } Wo_progressIconLoader($('#sidebar-mutual-list-container').find('span')); }); }