__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
if (wps_js.isset(wps_js.global, 'request_params', 'page') && wps_js.global.request_params.page === "optimization") {
const wpStatisticsOptimization = {
actions: [
{
button: '#populate-submit-button',
result: '#populate-submit-result',
action: 'wp_statistics_update_country_data',
messageKey: 'confirm_refresh_country'
},
{
button: '#populate-source-channel-submit',
result: '#populate-source-channel-result',
action: 'wp_statistics_update_source_channel_data',
messageKey: 'confirm_update_channel'
},
{
button: '#hash-ips-submit',
result: '#hash-ips-result',
action: 'wp_statistics_hash_ips',
messageKey: 'confirm_hash_ips'
},
{
button: '#repair-schema-submit-button',
result: '#repair-schema-result',
action: 'wp_statistics_repair_schema',
messageKey: 'confirm_repair_schema'
},
{
button: '#re-check-schema-submit-button',
result: '#re-check-schema-result',
action: 'wp_statistics_recheck_schema'
}
],
showModal: function (message = wps_js._('are_you_sure'), onConfirm) {
const $modal = $('#setting-confirmation');
if (!$modal.length) return console.error('Modal not found.');
$modal.find('.wps-modal__description').text(message);
const $ok = $modal.find('button[data-action="resolve"]');
$ok.off('click').on('click', () => {
$ok.addClass('wps-loading-button');
onConfirm();
});
$modal.addClass('wps-modal--open');
},
ajaxAction: function (action, $result, $button) {
const $modal = $('#setting-confirmation');
const $ok = $modal.find('button[data-action="resolve"]');
const parseMessage = (response, defaultMsg = wps_js._('operation_completed')) => {
try {
const parsed = typeof response === 'string' ? JSON.parse(response) : response;
if (parsed?.data?.message) {
return parsed.data.message;
}
if (parsed?.message) {
return parsed.message;
}
if (parsed?.data) {
return JSON.stringify(parsed.data);
}
return defaultMsg;
} catch {
return typeof response === 'string' ? response : JSON.stringify(response);
}
};
const parseErrorMessage = (jqXHR, textStatus, errorThrown) => {
try {
const parsed = JSON.parse(jqXHR.responseText);
return parsed.data?.message
? parsed.data.message
: parsed.message || JSON.stringify(parsed);
} catch {
return jqXHR.responseText || `${textStatus}: ${errorThrown}`;
}
};
$button.addClass('wps-loading-button');
jQuery.ajax({
url: wps_js.global.ajax_url,
type: 'post',
data: {
action: action,
wps_nonce: wps_js.global.rest_api_nonce
}
})
.done(function (response) {
const msg = parseMessage(response);
if (response.success) {
$result.html(`<div class="wps-alert wps-alert__success"><p>${msg}</p></div>`);
} else {
$result.html(`<div class="wps-alert wps-alert__danger"><p>${msg}</p></div>`);
}
})
.fail(function (jqXHR, textStatus, errorThrown) {
const msg = parseErrorMessage(jqXHR, textStatus, errorThrown);
$result.html(`<div class="wps-alert wps-alert__danger"><p>${msg}</p></div>`);
})
.always(function () {
$button.removeClass('wps-loading-button');
$ok.removeClass('wps-loading-button');
$modal.removeClass('wps-modal--open');
});
},
initMaintenanceAction: function ({button, result, action, messageKey}) {
const $btn = $(button);
const $res = $(result);
$btn.off('click').on('click', e => {
e.preventDefault();
if (!messageKey) {
this.ajaxAction(action, $res, $btn);
} else {
const msg = wps_js._(messageKey);
this.showModal(msg, () => this.ajaxAction(action, $res, $btn));
}
});
},
initMigrationActions: function () {
const self = this;
$('.wps-migration-btn[data-confirmation]').each(function () {
const $link = $(this);
const requiresConfirmation = $link.attr('data-confirmation') === '1';
if ($link.hasClass('disabled') || $link.attr('aria-disabled') === 'true') {
return;
}
$link.off('click').on('click', function (e) {
e.preventDefault();
const href = $link.attr('href');
if (requiresConfirmation) {
const confirmationMessage = wps_js._('confirmation') + '\n' + wps_js._('this_action_cannot_be_undone');
self.showModal(confirmationMessage, function () {
window.location.href = href;
});
} else {
window.location.href = href;
}
});
});
},
init: function () {
this.actions.forEach(a => this.initMaintenanceAction(a));
this.initMigrationActions();
}
};
jQuery(document).ready(() => {
wpStatisticsOptimization.init();
});
}| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| add-ons.js | File | 28.96 KB | 0644 |
|
| author-analytics.js | File | 16.02 KB | 0644 |
|
| browser.js | File | 832 B | 0644 |
|
| category-analytics.js | File | 4.5 KB | 0644 |
|
| content-analytics.js | File | 5.3 KB | 0644 |
|
| countries.js | File | 489 B | 0644 |
|
| exclusions.js | File | 1.02 KB | 0644 |
|
| generate-filters.js | File | 765 B | 0644 |
|
| geographic.js | File | 5.19 KB | 0644 |
|
| hits.js | File | 666 B | 0644 |
|
| lock-page.js | File | 1.37 KB | 0644 |
|
| optimization.js | File | 6.26 KB | 0644 |
|
| overview.js | File | 28.4 KB | 0644 |
|
| platform.js | File | 833 B | 0644 |
|
| privacy-audit.js | File | 11.27 KB | 0644 |
|
| referrals.js | File | 2.76 KB | 0644 |
|
| setting.js | File | 12.65 KB | 0644 |
|
| settings.js | File | 18.65 KB | 0644 |
|
| taxonomies.js | File | 706 B | 0644 |
|
| tracker-debugger.js | File | 2.16 KB | 0644 |
|
| visitors.js | File | 3.8 KB | 0644 |
|
| welcome.js | File | 22 B | 0644 |
|