This commit is contained in:
Javier Casares 2025-11-26 08:24:18 +00:00
commit c98dcb7b50
9 changed files with 5952 additions and 0 deletions

22
assets/css/admin.css Normal file
View file

@ -0,0 +1,22 @@
.robotstxt-smtp-tools .card {
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
.robotstxt-smtp-tools .robotstxt-smtp-tool-empty {
margin-top: 1em;
}
.robotstxt-smtp-tools .robotstxt-smtp-tool-meta {
margin: 1em 0;
font-style: italic;
}
.robotstxt-smtp-tools .robotstxt-smtp-tool-actions {
margin: 1em 0;
}
.robotstxt-smtp-tools .robotstxt-smtp-tool-result {
margin-top: 1.5em;
}

52
assets/js/admin.js Normal file
View file

@ -0,0 +1,52 @@
/**
* Admin UI behavior for Robotstxt SMTP settings.
*
* @package RobotstxtSMTP
*/
(function () {
'use strict';
var initializeAdmin = function () {
var security = document.getElementById( 'robotstxt_smtp_security' );
var port = document.getElementById( 'robotstxt_smtp_port' );
if ( ! security || ! port) {
return;
}
var defaultPorts = {
none: 25,
ssl: 465,
tls: 587
};
var previousValue = security.value || 'none';
security.addEventListener(
'change',
function () {
var newValue = security.value || 'none';
var previousDefault = Object.prototype.hasOwnProperty.call( defaultPorts, previousValue )
? defaultPorts[previousValue]
: null;
var newDefault = Object.prototype.hasOwnProperty.call( defaultPorts, newValue )
? defaultPorts[newValue]
: null;
var currentPort = parseInt( port.value, 10 );
if ( ! Number.isNaN( currentPort ) && null !== previousDefault && currentPort === previousDefault && null !== newDefault) {
port.value = newDefault;
}
previousValue = newValue;
}
);
};
if ('loading' !== document.readyState) {
initializeAdmin();
} else {
document.addEventListener( 'DOMContentLoaded', initializeAdmin );
}
})();