wps_js.pages_meta_box = {
view: function (args = []) {
let t = '';
if (args.pages && args.pages.length > 0) {
t += `
${wps_js._('title')} |
${wps_js._('views')} |
|
`;
const siteUrl = wps_js.global.admin_url.replace('/wp-admin/', '');
let i = 1;
args.pages.forEach(function (value) {
const statisticsPagesWidget =document.getElementById('wp-statistics-pages-widget');
let viewContentLabel =wps_js._('view');
if(statisticsPagesWidget) {
const isInsideDashboardWidgets = statisticsPagesWidget.closest('#dashboard-widgets') !== null;
viewContentLabel = isInsideDashboardWidgets ? wps_js._('view') : window.innerWidth <= 500 ? wps_js._('view') : wps_js._('view_content');
}
t += `
${value['title']} |
${value['number']} |
${viewContentLabel} |
`;
i++;
});
t += `
`;
return t;
} else {
return wps_js.no_meta_box_data()
}
}
};
window.addEventListener('resize', function () {
window.addEventListener('resize', function () {
const statisticsPagesWidget= document.getElementById('wp-statistics-pages-widget');
let isInsideDashboardWidgets = null ;
if(statisticsPagesWidget) {
isInsideDashboardWidgets = statisticsPagesWidget.closest('#dashboard-widgets') !== null;
}
const metaBoxes = document.querySelectorAll('.wps-view-content');
if(metaBoxes.length > 0){
metaBoxes.forEach(function (metaBox) {
metaBox.textContent =isInsideDashboardWidgets ? wps_js._('view') : window.innerWidth <= 500 ? wps_js._('view') : wps_js._('view_content'); ;
});
}
});
});