Answer the question
In order to leave comments, you need to log in
Load content on return?
Hello, when you open any link, Loader is shown and the header is in place, and the content of everything in id="contnet" is loaded and the page is not reloaded.
link example
<a href="<?php echo $wo['user']['url']; ?>" data-ajax="?link1=timeline&u=<?php echo $wo['user']['username'];?>">
var box = $('#contnet');
var ISAPI = $('#ISAPI').val();
$(document).on('click', 'a[data-ajax]', function(e) {
$('body').removeAttr('no-more-posts');
if ($('.postText').length) {
if ($('.postText').val().length > 0) {
if (!confirm("<?php echo html_entity_decode($wo['lang']['havent_finished_post'], ENT_QUOTES)?>")) {
return false;
} else {
$('.postText').val("");
}
}
}
Wo_StartBar();
window.post = 0;
var url = $(this).attr('data-ajax');
e.preventDefault();
if (!ISAPI) {
if (url == '?index.php?link1=home') {
$get_value = $('#json-data').val();
if ($get_value) {
$('#load-more-posts').hide();
json_data = JSON.parse($('#json-data').val());
if (json_data.page == 'home') {
$('#posts').html('<div class="posts_load"><div class="wo_loading_post"><div class="wo_loading_post_child"></div></div></div>');
loadposts();
window.history.pushState({state:'new'},'', websiteUrl);
$("html, body").animate({ scrollTop: 0 }, 100);
$('.user-details, .pac-container, .lightbox-container').remove();
Wo_clearPRecording();
Wo_CleanRecordNodes();
Wo_stopRecording();
Wo_StopLocalStream();
return false;
}
}
}
$.post(Wo_Ajax_Requests_Filee() + url, {url:url}, function (data) {
$('.user-details').remove();
json_data = JSON.parse($(data).filter('#json-data').val());
if (json_data.welcome_page == 1 || json_data.redirect == 1) {
window.location.href = websiteUrl;
return false;
}
if ($('.message-option-btns').length > 0) {
if (json_data.url == 'index.php?index.php?link1=home') {
window.location.href = websiteUrl;
} else {
window.location.href = json_data.url;
}
return false;
}
//document.getElementById('#contnet').innerHTML = data;
box.html(data);
if (json_data.is_css_file == 1) {
$('.styled-profile').remove();
$('footer').append(json_data.css_file);
$('.extra-css').html(json_data.css_file_header);
} else {
$('.styled-profile').attr('href', '');
$('.extra-css').empty();
}
Wo_clearPRecording();
Wo_CleanRecordNodes();
Wo_stopRecording();
Wo_StopLocalStream();
if (json_data.page == 'home') {
$('.filterby li.filter-by-li').on('click', function (e) {
$('.filterby li.filter-by-li').each(function(){
$(this).removeClass('avtive');
$(this).find('i').addClass('hidden');
});
$(this).find('i').removeClass('hidden');
$(this).addClass('avtive');
});
window.history.pushState({state:'new'},'', websiteUrl);
//window.history.pushState({}, "<?php echo $wo['config']['site_url']?>", websiteUrl);
} else {
window.history.pushState({state:'new'},'', json_data.url);
//window.history.pushState({}, "<?php echo $wo['config']['site_url']?>", json_data.url);
}
$('.postText').autogrow({vertical: true, horizontal: false, height: 200});
window.onpopstate = function(event) {
$(window).unbind('popstate');
window.location.href = document.location;
};
if (json_data.page == 'timeline' || json_data.page == 'page' || json_data.page == 'group') {
$('.content-container').css('margin-top', '50px');
$('.ad-placement-header-footer').find('.contnet').css('margin-top', '20px');
} else {
$('.content-container').css('margin-top', '50px');
$('.ad-placement-header-footer').find('.contnet').css('margin-top', '0');
}
if (json_data.is_footer == 1 && $('.second-footer').css('display') == 'none') {
$('footer .footer-wrapper').show();
} else {
if ($(window).width() < 720) {
$('footer .footer-wrapper').show();
} else {
$('footer .footer-wrapper, .second-footer').hide();
}
}
document.title = decodeHtml(json_data.title);
document_title = decodeHtml(json_data.title);
$("html, body").animate({ scrollTop: 0 }, 150);
Wo_FinishBar();
$('#hidden-content').empty();
});
$('.user-details, .pac-container, .lightbox-container').remove();
}
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question