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-20911]').attr('data-target', '#ProfileImageModal-Stopped'); $('[id^=updateImage-20911]').attr('onclick', 'Wo_OpenProfilePicture("' + data.img_or + '");'); $('[id^=updateImage-20911]').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')); }); }