Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/network-.../dist
File: netsposts-public.js
(function() {
[0] Fix | Delete
const pages = {};
[1] Fix | Delete
[2] Fix | Delete
document.addEventListener('DOMContentLoaded', function () {
[3] Fix | Delete
const wrappers = document.querySelectorAll('.netsposts-screen.ajax_load');
[4] Fix | Delete
for(const parentPostWrapper of wrappers) {
[5] Fix | Delete
attachNavigationClickListeners(parentPostWrapper);
[6] Fix | Delete
}
[7] Fix | Delete
});
[8] Fix | Delete
[9] Fix | Delete
function setWrapperId(wrapper){
[10] Fix | Delete
const id = Math.round(Math.random() * 1000) + 1;
[11] Fix | Delete
wrapper.setAttribute('data-id', id);
[12] Fix | Delete
return id;
[13] Fix | Delete
}
[14] Fix | Delete
[15] Fix | Delete
function attachNavigationClickListeners(wrapper){
[16] Fix | Delete
const paginationLinks = wrapper.querySelectorAll('.netsposts-paginate a.page-numbers');
[17] Fix | Delete
for (const link of paginationLinks) {
[18] Fix | Delete
link.addEventListener('click', handlePaginationLinkClick);
[19] Fix | Delete
}
[20] Fix | Delete
}
[21] Fix | Delete
[22] Fix | Delete
function handlePaginationLinkClick(e){
[23] Fix | Delete
e.preventDefault();
[24] Fix | Delete
const link = e.target;
[25] Fix | Delete
const url = link.getAttribute('href');
[26] Fix | Delete
const parent = link.parentElement.parentElement.parentElement;
[27] Fix | Delete
loadPosts(url, parent);
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
function loadPosts(url, parentScreen){
[31] Fix | Delete
showPreloader(parentScreen);
[32] Fix | Delete
let currentPostWrapper = parentScreen.querySelector('.netsposts-block-wrapper.current');
[33] Fix | Delete
const parentScreenId = parentScreen.getAttribute('id');
[34] Fix | Delete
if(isPageLoaded(parentScreenId, url)){
[35] Fix | Delete
setTimeout(function(){
[36] Fix | Delete
// Hide previous page
[37] Fix | Delete
currentPostWrapper.classList.add('hidden');
[38] Fix | Delete
currentPostWrapper.classList.remove('current');
[39] Fix | Delete
/*
[40] Fix | Delete
* Assign and show the new page.
[41] Fix | Delete
*/
[42] Fix | Delete
const pageId = pages[parentScreenId][url];
[43] Fix | Delete
const selector = ".netsposts-block-wrapper[data-id='" + pageId + "']";
[44] Fix | Delete
const nextParentPostWrapper = parentScreen.querySelector(selector);
[45] Fix | Delete
nextParentPostWrapper.classList.remove('hidden');
[46] Fix | Delete
nextParentPostWrapper.classList.add('current');
[47] Fix | Delete
hidePreloader(parentScreen);
[48] Fix | Delete
}, 200);
[49] Fix | Delete
} else {
[50] Fix | Delete
getPageDoc(url).then(function (pageDoc) {
[51] Fix | Delete
const postWrapperSelector = '#' + parentScreenId + ' > .netsposts-block-wrapper';
[52] Fix | Delete
const wrapper = pageDoc.querySelector(postWrapperSelector);
[53] Fix | Delete
if(!pages[parentScreenId]){
[54] Fix | Delete
pages[parentScreenId] = {};
[55] Fix | Delete
}
[56] Fix | Delete
pages[parentScreenId][url] = setWrapperId(wrapper);
[57] Fix | Delete
[58] Fix | Delete
currentPostWrapper.classList.add('hidden');
[59] Fix | Delete
currentPostWrapper.classList.remove('current');
[60] Fix | Delete
[61] Fix | Delete
const preloader = parentScreen.querySelector('.netsposts-preloader');
[62] Fix | Delete
parentScreen.insertBefore(wrapper, preloader);
[63] Fix | Delete
attachNavigationClickListeners(wrapper);
[64] Fix | Delete
hidePreloader(parentScreen);
[65] Fix | Delete
});
[66] Fix | Delete
}
[67] Fix | Delete
//window.history.pushState({}, document.title, url);
[68] Fix | Delete
}
[69] Fix | Delete
[70] Fix | Delete
function showPreloader(parent){
[71] Fix | Delete
const preloader = parent.querySelector('.netsposts-preloader');
[72] Fix | Delete
preloader.classList.remove('hidden');
[73] Fix | Delete
}
[74] Fix | Delete
[75] Fix | Delete
function hidePreloader(parent){
[76] Fix | Delete
const preloader = parent.querySelector('.netsposts-preloader');
[77] Fix | Delete
preloader.classList.add('hidden');
[78] Fix | Delete
}
[79] Fix | Delete
[80] Fix | Delete
function isPageLoaded(screenId, url){
[81] Fix | Delete
return pages.hasOwnProperty(screenId) && pages[screenId].hasOwnProperty(url);
[82] Fix | Delete
}
[83] Fix | Delete
[84] Fix | Delete
function getPageDoc(url){
[85] Fix | Delete
return loadPage(url).then(pageContent => {
[86] Fix | Delete
const loadedDoc = document.implementation.createHTMLDocument();
[87] Fix | Delete
loadedDoc.documentElement.innerHTML = pageContent;
[88] Fix | Delete
return loadedDoc;
[89] Fix | Delete
});
[90] Fix | Delete
}
[91] Fix | Delete
[92] Fix | Delete
function loadPage(url){
[93] Fix | Delete
return fetch(url).then(response => response.text());
[94] Fix | Delete
}
[95] Fix | Delete
})();
[96] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function