File: //proc/self/root/proc/self/root/proc/self/root/proc/self/cwd/siteseo-pro.zip
PK '+l\�h��
assets/css/metabox.cssnu �[��� .siteseo-validation-tools .description{
display: block;
margin-top: 5px;
font-style: italic;
color: #666;
}
.siteseo-structured-data-metabox label{
display: block;
font-weight: bold;
margin-top: 10px;
}
.siteseo-structured-data-metabox select,
.siteseo-structured-data-metabox input[type="text"],
.siteseo-structured-data-metabox textarea{
width: 100%;
margin-bottom: 10px;
}
.hidden{
display: none;
}
.siteseo_structured_data_custom{
font-family: monospace;
font-size: 13px;
}
/** structured data preview**/
.siteseo-schema-preview{
margin-top: 20px;
width: 100%;
background: white;
color:white;
padding: 15px;
border: 1px solid #333;
border-radius: 4px;
position: relative;
}
#siteseo_validate_schema{
position: absolute;
top: 15px;
right: 15px;
}
.siteseo-schema-preview h4{
color: black;
margin-top: 0;
margin-bottom: 10px;
}
.siteseo-schema-preview pre{
overflow: auto;
max-height: 300px;
white-space: pre-wrap;
font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
font-size: 14px;
line-height: 1.5;
padding: 10px;
background: rgb(40, 49, 66);
border-radius: 3px;
}
.siteseo-schema-preview pre .bracket{
color: #f8f8f8;
}
.siteseo-validation-tools{
margin-top: 20px;
padding: 15px;
background: #f5f5f5;
border: 1px solid #e5e5e5;
width: 100%;
border-radius: 4px;
}
.siteseo-metabox-schema{
padding:15px;
}
.siteseo-metabox-schema textarea:focus,
.siteseo-metabox-schema select:focus,
.siteseo-metabox-schema input[type="text"]:focus{
border: 2px solid #003399;
}
.siteseo-schema-preview a{
margin-right:10px;
top:20px;
}
PK )+l\Z +x x assets/css/admin.cssnu �[��� .siteseopro-setting-content{
display:flex;
}
.siteseopro-tab-group{
padding:0;
}
.siteseopro-license-table{
background-color: #FFF;
border-radius:5px;
border: 1px solid #ccc;
padding: 10px;
}
.siteseopro-btn-primary{
background-color: #00308F;
border: 1px solid #3d5afe;
color: #FFF;
}
.siteseopro-btn-primary:hover,
a.siteseopro-btn-primary:hover{
background-color:#0529f7;
transform: translateY(-1px);
transition: background-color 0.6s, transform 0.4s;
color:#FFF;
}
.siteseopro-btn{
outline: none;
border: none;
border-radius: 3px;
box-shadow: 1px 0 5px 0 #ccc;
padding: 8px 10px;
font-weight: bold;
font-size:0.7rem;
cursor:pointer;
vertical-align:top;
}
a.siteseopro-btn{
text-decoration: none;
vertical-align:baseline;
text-align:center;
padding:5px 10px;
}
.siteseopro_license_notices{
position: fixed;
top: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 999;
backdrop-filter: blur(1px);
background-color: rgba(255, 255, 255, 0.5);
padding-left:35%;
padding-right:20%;
padding-top:21%;
}
.spinner{
display: none;
}
.spinner.is-active{
display: inline-block;
}
.tab-content{
display: none;
}
.tab-content.active{
display: block;
}
.siteseo-analysis-block{
clear: both;
}
.siteseo-audit-title{
display:flex;
align-items:center;
gap: 10px;
position: relative;
}
/* main below code*/
.siteseo-audit-title:focus{
color: #191e23;
border: none;
box-shadow: none;
outline-offset: -2px;
outline: 1px dotted #555d66;
}
.siteseo-audit-title:hover{
background: #f3f4f5;
}
.siteseo-audit-title {
display:flex;
position: relative;
background: #fff;
color: #1e1e1e;
width: 100%;
border: 0;
margin: 0;
padding: 15px 5px;
line-height: unset;
text-align: center;
font-size: 14px;
font-weight: 600;
cursor: pointer;
transition: all 300ms linear;
}
.description{
padding: 0 1rem 0.5rem 1rem;
display: none;
width: 100%;
}
.siteseo-pro-fechtime{
padding: 3px 12px;
margin-top:5px;
border-radius: 50px;
display:inline-flex;
justify-content:center;
align-self:center;
background: #00308f05;
border:1px solid #00308f45;
}
.siteseo-pro-details{
display:inline-flex;
padding: 3px 17px;
justify-content:center;
align-self:center;
border:1px solid #d3d3d3;
border-radius: 50px;
margin:10px 0;
}
.siteseopro-flex-wrapper{
display: flex;
justify-content:center;
}
.siteseo-circular-chart.siteseopro-flex-wrapper{
display: flex;
flex-flow: row nowrap;
}
.siteseo-single-chart{
width: 33%;
justify-content: space-around;
}
.siteseo-circular-chart{
display: block;
margin: 10px auto;
max-width: 80%;
max-height: 160px;
}
.siteseo-circle-bg{
fill: none;
stroke: #eee;
stroke-width: 3.8;
}
.siteseo-circle{
fill: none;
stroke-width: 2.8;
stroke-linecap: round;
animation: siteseo-progress 1s ease-out forwards;
}
@keyframes siteseo-progress{
0%{
stroke-dasharray: 0 100;
}
}
.siteseo-percentage{
fill: #666;
font-family: sans-serif;
font-size: 0.5em;
text-anchor: middle;
}
.siteseo-circle{
stroke: #3c9ee5;
}
.siteseo_notice {
padding:10px,12px;
margin-left:35%;
background: #00308f05;
border-radius:5px;
border: 1px solid #00308f45;
}
.siteseo-inner-tab:hover {
background-color:#f3f4f5;
}
.siteseo-pagespeed-input-wrapper{
display:flex;
justify-content:center;
gap:5px;
align-items:center;
}
.siteseo-pagespeed-input-wrapper input{
width: 35%;
}
#siteseopro-pagespeed-results ul.siteseo-inner-tabs{
width: unset !important;
max-width: unset !important;
padding: unset !important;
}
#siteseopro-pagespeed-results ul.siteseo-inner-tabs li{
padding: 0 20px;
}
.siteseo-audit-tabs{
display:flex;
flex-direction:column;
width: 50%;
align-self:center;
}
.siteseo-ps-device-toggle{
cursor: pointer;
display:flex;
height:60px;
width:100px;
align-items:center;
justify-content:center;
border: 2px solid transparent;
background-color:transparent;
}
input[name=ps_device_type]:checked + label{
border-bottom: 2px solid #00308F !important;
color: #00308F;
}
.siteseo-toggleCnt{
display: flex;
align-items: center;
padding-left:20px;
}
.siteseo-toggleSw{
position: relative;
width: 47px;
height: 20px;
background-color: #ccc;
border-radius: 20px;
cursor: pointer;
margin-right: 10px;
transition: background-color 0.3s;
}
.siteseo-toggleSw::before{
content: '';
position: absolute;
width: 24px;
height: 24px;
background-color: white;
border: 2px solid #ccc;
border-radius: 50%;
top: -4px;
left: -2px;
transition: 0.3s;
}
.siteseo-toggleCnt span{
font-size: 14px;
color: #555;
font-weight: bold;
}
.siteseo-toggleSw.active{
background-color: #003399;
}
.siteseo-toggleSw.active::before{
left: 27px;
border-color: #003399;
}
.siteseo-arrow{
margin-right: 5px;
font-size: 14px;
color: #555;
font-weight: bold;
}
.siteseo-toggle-label{
font-style: italic;
font-size: 11px;
font-weight: normal;
}
.siteseo-arrow-icon{
font-size: 10%;
padding-top:3px;
}
.siteseo-metabox-subtabs{
display:flex;
flex-wrap:nowrap;
justify-content:center;
font-weight:500;
font-size:1.05em;
}
.siteseo-metabox-subtabs input{
display:none;
}
.siteseo-metabox-subtabs > div{
cursor:pointer;
padding: 20px;
display:inline-flex;
align-items:center;
justify-content:center;
text-align:center;
user-select: none;
}
.siteseo-metabox-subtabs > div{
border-bottom: 2px solid transparent;
}
.siteseo-metabox-tab-label-active{
border-bottom: 2px solid #00308F !important;
color: #00308F;
}
.siteseo-notice-pro{
position: relative;
display: grid;
flex-direction: column;
background: #00308f05;
padding: 10px;
width: calc(100% - 20px);
z-index: 10;
border-radius: 5px;
width: auto;
display: flex;
border:1px solid #00308f45;
}
/* UTILITY CLASSES
NOTE: WRITE ALL YOUR CSS ABOVE THIS
*/
.siteseo-flex{
display:flex;
}
.siteseo-justify-center{
justify-content:center;
}
.siteseo-direction-column{
flex-direction:column;
}
/* DO NOT WRITE ANY CSS AFTER THIS */
PK ,+l\_O^(k k assets/js/index-highlight.jsnu �[��� /***
The MIT License (MIT)
Copyright (c) luyilin <luyilin12@gmail.com> (https://github.com/luyilin)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
***/
const defaultColors = {
keyColor: '#9CCC65',
numberColor: 'lightskyblue',
stringColor: 'lightcoral',
trueColor: 'lightseagreen',
falseColor: '#f66578',
nullColor: 'cornflowerblue'
}
const entityMap = {
'&': '&',
'<': '<',
'>': '>',
'"': '"',
"'": ''',
'`': '`',
'=': '='
};
function escapeHtml (html){
return String(html).replace(/[&<>"'`=]/g, function (s) {
return entityMap[s];
});
}
function highlightJson (json, colorOptions = {}) {
const valueType = typeof json
if (valueType !== 'string') {
json = JSON.stringify(json, null, 2) || valueType
}
let colors = Object.assign({}, defaultColors, colorOptions)
json = json.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>')
return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+]?\d+)?)/g, (match) => {
let color = colors.numberColor
let style = ''
if (/^"/.test(match)) {
if (/:$/.test(match)) {
color = colors.keyColor
} else {
color = colors.stringColor;
match = '"' + escapeHtml(match.substr(1, match.length - 2)) + '"';
style = 'word-wrap:break-word;white-space:pre-wrap;';
}
} else {
color = /true/.test(match)
? colors.trueColor
: /false/.test(match)
? colors.falseColor
: /null/.test(match)
? colors.nullColor
: color
}
return `<span style="${style}color:${color}">${match}</span>`
})
}
document.addEventListener("DOMContentLoaded", () => {
let jsonElement = document.getElementById("siteseo_highlighter");
if(jsonElement && jsonElement.textContent){
try{
jsonElement.innerHTML = highlightJson(JSON.parse(jsonElement.textContent));
} catch(e){
console.log("Error parsing JSON for highlighting:", e);
}
}
});
PK /+l\}7QB� � assets/js/block.jsnu �[��� (function (blocks, element, editor) {
const el = element.createElement;
const { InspectorControls } = editor;
const { PanelBody, ToggleControl } = wp.components;
blocks.registerBlockType('siteseo-pro/local-business', {
title: 'Local Business',
icon: 'store',
category: 'siteseo',
attributes: {
displayOnHomepage: {
type: 'boolean',
default: true
}
},
edit: function (props) {
return [
el('div', { className: props.className },
el('div', { className: 'local-business-preview' },
el('h3', null, 'Local Business'),
el('div', { dangerouslySetInnerHTML: { __html: siteseoProLocalBusiness.previewData } })
)
),
el(InspectorControls, null,
el(PanelBody, { title: 'Settings' },
el(ToggleControl, {
label: 'Display on Homepage Only',
checked: props.attributes.displayOnHomepage,
onChange: (newVal) => props.setAttributes({ displayOnHomepage: newVal })
})
)
)
];
},
save: function () {
return null; // Use dynamic rendering
}
});
})(window.wp.blocks, window.wp.element, window.wp.blockEditor);PK 1+l\g�X X assets/js/metabox.jsnu �[��� jQuery(document).ready(function($){
$(document).on('click', '#siteseo_validate_schema', function(e){
e.preventDefault();
// Fetch Schema
var schemaContentWrap = $("#siteseo_schema_preview #raw_schema");
if(!schemaContentWrap.length){
schemaContentWrap = $("#siteseo_schema_preview");
}
let schemaContent = schemaContentWrap.text(),
$form = $("<form>", {
"method": "POST",
"action": "https://search.google.com/test/rich-results",
"target": "_blank"
}),
$input = $("<input>", {
"type": "hidden",
"name": "code_snippet",
"value": schemaContent
});
$form.append($input);
$("body").append($form);
$form.submit();
$form.remove();
});
$(document).on('change', '.siteseo_structured_data_type', function(e){
e.preventDefault();
let schemaType = $(this).val(),
propertiesContainer = $('#siteseo_schema_properties_container'),
customSchemaContainer = $('#siteseo_custom_schema_container'),
propertiesDiv = $('.siteseo-schema-properties');
$('.siteseo_structured_data_type').val(schemaType);
propertiesDiv.empty();
if(schemaType === ''){
propertiesContainer.addClass('hidden');
customSchemaContainer.addClass('hidden');
$('#siteseo_schema_preview').html('');
$('#raw_schema').text('');
return;
}
if(schemaType === 'CustomSchema'){
propertiesContainer.addClass('hidden');
customSchemaContainer.removeClass('hidden');
updateCustomSchemaPreview();
return;
} else{
propertiesContainer.removeClass('hidden');
customSchemaContainer.addClass('hidden');
}
// schemas load
let properties = structuredDataMetabox.propertyTemplates[schemaType] || {};
// Create form fields for each property
$.each(properties, function(property, defaultValue){
var label = property.replace(/([a-z])([A-Z])/g, '$1 $2');
label = label.charAt(0).toUpperCase() + label.slice(1);
let field = '',
is_textarea_fields = ['description', 'instructions', 'reviewBody', 'questions', 'step', 'ingredients', 'recipeInstructions', 'courseDescription', 'bookDescription', 'softwareRequirements', 'menu'],
is_date_type_fields = ['datePublished', 'dateModified', 'uploadDate', 'startDate', 'endDate', 'foundingDate', 'releaseDate'];
if(is_textarea_fields.includes(property)){
field = $('<textarea/>').attr({ name: 'schema_properties[' + property + ']', id: 'siteseo_schema_property_' + property, rows: 3, class: 'widefat'}).val(defaultValue);
} else if (is_date_type_fields.includes(property)){
field = $('<input/>').attr({ type: 'datetime-local', name: 'schema_properties[' + property + ']', id: 'siteseo_schema_property_' + property,
class: 'widefat'}).val(defaultValue);
} else {
field = $('<input/>').attr({ type: 'text', name: 'schema_properties[' + property + ']', id: 'siteseo_schema_property_' + property,
class: 'widefat'}).val(defaultValue);
}
$('<p/>')
.append($('<label/>').attr('for', 'siteseo_schema_property_' + property).text(label + ':'))
.append(field)
.appendTo(propertiesDiv);
});
// preview update
updatePreview();
$(document).on('input', '.siteseo-schema-properties input, #schema_properties textarea', updatePreview);
});
// preview function
function updatePreview(){
var schemaType = $('.siteseo_structured_data_type').val();
if(schemaType === 'CustomSchema'){
updateCustomSchemaPreview();
return;
}
var schemaData = {
'@context': 'https://schema.org',
'@type': schemaType
};
$('.siteseo-schema-properties input, #siteseo-schema-properties textarea').each(function(){
var propertyName = $(this).attr('name').match(/\[(.*?)\]/)[1];
var propertyValue = $(this).val();
if(propertyValue !== ''){
schemaData[propertyName] = propertyValue;
}
});
var jsonString = JSON.stringify(schemaData, null, 2);
$('#raw_schema').text(jsonString);
// Make sure highlighter element exists
if($('#siteseo_schema_preview #siteseo_highlighter').length === 0){
$('#siteseo_schema_preview').html('<div id="siteseo_highlighter"></div><div id="raw_schema" style="display:none;"></div>');
}
$('#siteseo_schema_preview #siteseo_highlighter').html(highlightJson(jsonString));
}
// Custom schema preview
function updateCustomSchemaPreview(){
var customSchema = $('.siteseo_structured_data_custom').val() || '';
$('#raw_schema').text(customSchema);
// highlighter element exists
if($('#siteseo_schema_preview #siteseo_highlighter').length === 0){
$('#siteseo_schema_preview').html('<div id="siteseo_highlighter"></div><div id="raw_schema" style="display:none;"></div>');
}
try{
if(customSchema.trim()){
var jsonObj = JSON.parse(customSchema);
$('#siteseo_schema_preview #siteseo_highlighter').html(highlightJson(jsonObj));
} else{
$('#siteseo_schema_preview #siteseo_highlighter').html('');
}
} catch(e){
$('#siteseo_schema_preview #siteseo_highlighter').text(customSchema);
}
}
// as per schema change update preview
$('.siteseo_structured_data_custom').on('input', updateCustomSchemaPreview);
// Initial preview update
if($('.siteseo_structured_data_type').val() !== ''){
if($('.siteseo_structured_data_type').val() === 'CustomSchema'){
updateCustomSchemaPreview();
} else{
updatePreview();
$(document).on('input', '#siteseo-schema-properties input, #siteseo-schema-properties textarea', updatePreview);
}
}
});
PK 4+l\"R���* �* assets/js/admin.jsnu �[��� jQuery(document).ready(function($){
$('#siteseopro-pagespeed-results .siteseo-metabox-tab-label').click(function(){
$('.siteseo-metabox-tab-label').removeClass('siteseo-metabox-tab-label-active');
$('.siteseo-metabox-tab').hide();
$(this).addClass('siteseo-metabox-tab-label-active');
var activeTab = $(this).data('tab');
$('.' + activeTab).show();
});
$('input[name="ps_device_type"]').on('change', function(){
jEle = jQuery(this),
val = jEle.val();
if(val == 'mobile'){
jQuery('#siteseo-ps-mobile').css('display', 'flex');
jQuery('#siteseo-ps-mobile').find('.siteseo-metabox-tab-label:first-child').trigger('click');
jQuery('#siteseo-ps-desktop').hide();
} else {
jQuery('#siteseo-ps-mobile').hide();
jQuery('#siteseo-ps-desktop').css('display', 'flex');
jQuery('#siteseo-ps-desktop').find('.siteseo-metabox-tab-label:first-child').trigger('click');
}
});
$('#siteseopro-pagespeed-btn').on('click', function(){
$('#siteseopro-pagespeed-results').empty();
let spinner = $(this).next(),
input = $(this).closest('div').find('input');
spinner.addClass('is-active'),
siteseo_pagespeed_request(input.val(), true);
siteseo_pagespeed_request(input.val(), false);
});
$('#siteseopro-clear-Page-speed-insights').on('click', function(){
$.ajax({
url: siteseo_pro.ajax_url,
type: 'POST',
data: {
action: 'siteseo_pro_pagespeed_insights_remove_results',
nonce: siteseo_pro.nonce
},
success: function(response){
$('#siteseopro-pagespeed-results').empty();
}
});
});
$('.siteseo-audit-title').next('.description').hide();
$('.siteseo-audit-title').on('click', function(e){
var description = $(this).next('.description');
var icon = $(this).find(".toggle-icon");
if(description.is(':visible')){
description.hide();
icon.addClass('class', 'toggle-icon dashicons dashicons-arrow-up-alt2');
} else {
description.show();
icon.addClass('class', 'toggle-icon dashicons dashicons-arrow-down-alt2');
}
});
// create robots txt
$('#siteseo-create-robots').on('click', function(){
event.preventDefault();
let spinner = $(event.target).next('.spinner');
if(spinner.length){
spinner.addClass('is-active');
}
$.ajax({
method : 'POST',
url : siteseo_pro.ajax_url,
data : {
action : 'siteseo_pro_create_robots',
_ajax_nonce : siteseo_pro.nonce
},
success: function(res){
if(spinner.length){
spinner.removeClass('is-active');
}
if(res.success){
alert(res.data);
window.location.reload();
return;
}
alert('Unable to create the robots.txt file');
}
});
});
//htaccess
$('#siteseo_htaccess_btn').on('click', function(){
event.preventDefault();
let spinner = $(event.target).next('.spinner');
if(spinner.length){
spinner.addClass('is-active');
}
let htaccess_code = $('#siteseo_htaccess_file').val(),
htaccess_enable = $('#siteseo_htaccess_enable').is(':checked') ? 1 : 0;
$.ajax({
url : siteseo_pro.ajax_url,
method: 'POST',
data: {
action: 'siteseo_pro_update_htaccess',
htaccess_code: htaccess_code,
htaccess_enable: htaccess_enable,
_ajax_nonce : siteseo_pro.nonce
},
success: function(res){
if(spinner.length){
spinner.removeClass('is-active');
}
if(res.success){
alert(res.data);
return;
}
if(res.data){
alert(res.data)
return;
}
alert('Something went wrong, updating the file');
}
});
});
// Csv download
$('#siteseo-export-csv').on('click', function(event){
event.preventDefault();
$.ajax({
method: 'POST',
url: siteseo_pro.ajax_url,
data: {
action: 'siteseo_pro_export_redirect_csv',
_ajax_nonce: siteseo_pro.nonce
},
beforeSend: function(){
$('#siteseo-export-csv').prop('disabled', true);
},
xhrFields:{
responseType: 'blob'
},
success: function(response, status, xhr){
var filename = 'siteseo-redirect-data-' + new Date().toISOString().slice(0,10) + '.csv';
var disposition = xhr.getResponseHeader('Content-Disposition');
if(disposition){
var match = disposition.match(/filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/);
if(match && match[1]){
filename = match[1].replace(/['"]/g, '');
}
}
var blob = new Blob([response], { type: 'text/csv' });
var url = window.URL.createObjectURL(blob);
var a = document.createElement('a');
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(a);
},
error: function(){
alert('Error connecting to the server');
},
complete: function(){
$('#siteseo-export-csv').prop('disabled', false);
}
});
});
// Clear all redirect logs
$('#siteseo_redirect_all_logs').on('click', function(){
event.preventDefault();
if(!confirm('Are you sure you want to clear all logs?')){
return;
}
let spinner = $(event.target).next('.spinner');
if(spinner.length){
spinner.addClass('is-active');
}
$.ajax({
method: 'POST',
url: siteseo_pro.ajax_url,
data: {
action: 'siteseo_pro_clear_all_logs',
_ajax_nonce: siteseo_pro.nonce
},
success: function(res){
if(spinner.length){
spinner.removeClass('is-active');
}
if(res.success){
alert(res.data);
window.location.reload();
return;
}
alert('Unable to clear logs.');
},
error: function(){
alert('Error clearing logs.');
if(spinner.length){
spinner.removeClass('is-active');
}
}
});
});
// update robots file
$('#siteseo-update-robots').on('click', function(){
event.preventDefault();
let spinner = $(event.target).next('.spinner');
if(spinner.length){
spinner.addClass('is-active');
}
$.ajax({
method : 'POST',
url : siteseo_pro.ajax_url,
data : {
action : 'siteseo_pro_update_robots',
robots : $('#siteseo_robots_file_content').val(),
_ajax_nonce : siteseo_pro.nonce
},
success: function(res){
if(spinner.length){
spinner.removeClass('is-active');
}
if(res.success){
alert(res.data);
window.location.reload();
return;
}
if(res.data){
alert(res.data);
return;
}
alert('Unable to create the robots.txt file');
}
});
});
$('#select-all-logs').on('click', function(){
$('.log-selector').prop('checked', this.checked);
});
//Delete specific recoder
$('#siteseo-remove-selected-log').on('click', function(){
var selectedIds = [];
$('.log-selector:checked').each(function(){
selectedIds.push($(this).val());
});
if(selectedIds.length === 0){
alert('Please select at least one log to delete');
return;
}
if(!confirm('Are you sure you want to delete the selected logs?')){
return;
}
$.ajax({
type : 'POST',
url: siteseo_pro.ajax_url,
data:{
action: 'siteseo_pro_remove_selected_logs',
ids: selectedIds,
_ajax_nonce: siteseo_pro.nonce
},
success: function(response){
if(response.success){
$('.log-selector:checked').closest('tr').remove();
alert('Selected logs deleted successfully');
}else{
alert('Error: ' + response.data);
}
},
error: function(){
alert('Failed to delete logs. Please try again.');
}
});
});
// handel ajax toggle
$('.siteseo-toggleSw').on('click', function(){
const $toggle = $(this);
const toggleKey = $toggle.data('toggle-key');
const action = $toggle.data('action');
saveToggle($toggle, toggleKey, action);
});
function saveToggle($toggle, toggleKey, action){
const $container = $toggle.closest('.siteseo-toggleCnt');
const $stateText = $container.find(`.toggle_state_${toggleKey}`);
const $input = $(`#${toggleKey}`);
$container.addClass('loading');
$toggle.toggleClass('active');
const newValue = $toggle.hasClass('active') ? '1' : '0';
$input.val(newValue);
$stateText.text($toggle.hasClass('active') ? 'Click to disable this feature' : 'Click to enable this feature');
$.ajax({
url: ajaxurl,
type: 'POST',
data: {
action: action,
toggle_value: newValue,
nonce: $toggle.data('nonce')
},
success: function(response){
if(response.success){
// Show the custom toast message
ToastMsg('Your settings have been saved.');
} else{
console.error('Failed to save toggle state');
toggleError($toggle, $input, $stateText);
ToastMsg(response.data.message || 'Failed to save toggle state', 'error');
}
},
error: function() {
console.error('Ajax request failed');
toggleError($toggle, $input, $stateText);
ToastMsg('Unable to save settings', 'error');
},
complete: function() {
$container.removeClass('loading');
}
});
}
//toast
function ToastMsg(message, type = 'success') {
const toast = $('<div>')
.addClass('siteseo-toast')
.addClass(type)
.html(`<span class="dashicons dashicons-yes"></span> ${message}`);
$('body').append(toast);
// 3 seconds
toast.fadeIn(300).delay(3000).fadeOut(300, function () {
toast.remove();
});
}
// error hadeler
function toggleError($toggle, $input, $stateText) {
$toggle.toggleClass('active');
$input.val($toggle.hasClass('active') ? '1' : '0');
$stateText.text($toggle.hasClass('active') ? 'Disable' : 'Enable');
}
// media uploader for image logo
$('#siteseopro_structured_data_upload_img').click(function(e) {
var mediaUploader;
e.preventDefault();
if (mediaUploader) {
mediaUploader.open();
return;
}
mediaUploader = wp.media.frames.file_frame = wp.media({
title: 'Media',
button: {
text: 'Select'
},
multiple: false
});
mediaUploader.on('select', function() {
var attachment = mediaUploader.state().get('selection').first().toJSON();
$('#structured_data_image_url').val(attachment.url);
});
mediaUploader.open();
});
});
async function siteseo_pagespeed_request(url, is_mobile = false){
jQuery.ajax({
url: siteseo_pro.ajax_url,
type: 'POST',
data: {
action: 'siteseo_pro_get_pagespeed_insights',
is_mobile : is_mobile,
test_url : url,
nonce: siteseo_pro.nonce
},
success: function(response){
if(!response.success){
alert(response.data ?? 'Something went wrong');
return;
}
if(siteseo_pro.pagespeed_response){
//spinner.removeClass('is-active');
location.reload(true);
return;
}
siteseo_pro['pagespeed_response'] = true;
}
});
}PK 6+l\YSI� � "