Initial commit
This commit is contained in:
@@ -0,0 +1,124 @@
|
||||
/**
|
||||
* AI Proxy Manager — стили админки.
|
||||
*/
|
||||
|
||||
.aipmsp-wrap .title {
|
||||
margin-top: 28px;
|
||||
padding-top: 14px;
|
||||
border-top: 1px solid #dcdcde;
|
||||
}
|
||||
|
||||
.aipmsp-proxy-table {
|
||||
max-width: 980px;
|
||||
margin-bottom: 8px;
|
||||
}
|
||||
|
||||
.aipmsp-proxy-table code {
|
||||
background: #f0f0f1;
|
||||
padding: 1px 5px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.aipmsp-recommend {
|
||||
margin-top: 6px;
|
||||
}
|
||||
|
||||
/* Toggle-переключатель */
|
||||
.aipmsp-switch {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
width: 44px;
|
||||
height: 24px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.aipmsp-switch.aipmsp-switch-sm {
|
||||
width: 36px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
.aipmsp-switch input {
|
||||
opacity: 0;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
|
||||
.aipmsp-slider {
|
||||
position: absolute;
|
||||
cursor: pointer;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: #c3c4c7;
|
||||
transition: 0.3s;
|
||||
border-radius: 24px;
|
||||
}
|
||||
|
||||
.aipmsp-slider:before {
|
||||
position: absolute;
|
||||
content: "";
|
||||
height: 18px;
|
||||
width: 18px;
|
||||
left: 3px;
|
||||
bottom: 3px;
|
||||
background-color: #fff;
|
||||
transition: 0.3s;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.aipmsp-switch-sm .aipmsp-slider:before {
|
||||
height: 14px;
|
||||
width: 14px;
|
||||
}
|
||||
|
||||
.aipmsp-switch input:checked + .aipmsp-slider {
|
||||
background-color: #2271b1;
|
||||
}
|
||||
|
||||
.aipmsp-switch input:checked + .aipmsp-slider:before {
|
||||
transform: translateX(20px);
|
||||
}
|
||||
|
||||
.aipmsp-switch-sm input:checked + .aipmsp-slider:before {
|
||||
transform: translateX(16px);
|
||||
}
|
||||
|
||||
.aipmsp-switch input:focus + .aipmsp-slider {
|
||||
box-shadow: 0 0 0 2px #2271b1;
|
||||
}
|
||||
|
||||
.aipmsp-switch-label {
|
||||
margin-left: 10px;
|
||||
vertical-align: middle;
|
||||
color: #50575e;
|
||||
}
|
||||
|
||||
.aipmsp-clear-key {
|
||||
margin-left: 12px;
|
||||
color: #b32d2e;
|
||||
}
|
||||
|
||||
/* Результат health-check */
|
||||
.aipmsp-check-result {
|
||||
margin-left: 8px;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.aipmsp-check-result.aipmsp-ok {
|
||||
color: #008a20;
|
||||
}
|
||||
|
||||
.aipmsp-check-result.aipmsp-fail {
|
||||
color: #b32d2e;
|
||||
}
|
||||
|
||||
.aipmsp-check-result.aipmsp-pending {
|
||||
color: #646970;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* Футер страницы настроек */
|
||||
.aipmsp-footer {
|
||||
color: #646970;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
/**
|
||||
* AI Proxy Manager — скрипты админки.
|
||||
* Health-check прокси через AJAX.
|
||||
*/
|
||||
( function ( $ ) {
|
||||
'use strict';
|
||||
|
||||
$( function () {
|
||||
$( '.aipmsp-check-btn' ).on( 'click', function () {
|
||||
var $btn = $( this );
|
||||
var $result = $btn.siblings( '.aipmsp-check-result' );
|
||||
|
||||
var data = {
|
||||
action: 'aipmsp_check_proxy',
|
||||
nonce: aipmspData.nonce,
|
||||
ip: $btn.data( 'ip' ),
|
||||
port: $btn.data( 'port' ),
|
||||
type: $btn.data( 'type' )
|
||||
};
|
||||
|
||||
$btn.prop( 'disabled', true );
|
||||
$result
|
||||
.removeClass( 'aipmsp-ok aipmsp-fail' )
|
||||
.addClass( 'aipmsp-pending' )
|
||||
.text( aipmspData.checking );
|
||||
|
||||
$.post( aipmspData.ajaxUrl, data )
|
||||
.done( function ( response ) {
|
||||
if ( response && response.success ) {
|
||||
$result
|
||||
.removeClass( 'aipmsp-pending aipmsp-fail' )
|
||||
.addClass( 'aipmsp-ok' )
|
||||
.text( response.data.message );
|
||||
} else {
|
||||
var msg = response && response.data && response.data.message
|
||||
? response.data.message
|
||||
: 'Ошибка';
|
||||
$result
|
||||
.removeClass( 'aipmsp-pending aipmsp-ok' )
|
||||
.addClass( 'aipmsp-fail' )
|
||||
.text( msg );
|
||||
}
|
||||
} )
|
||||
.fail( function () {
|
||||
$result
|
||||
.removeClass( 'aipmsp-pending aipmsp-ok' )
|
||||
.addClass( 'aipmsp-fail' )
|
||||
.text( 'Ошибка запроса' );
|
||||
} )
|
||||
.always( function () {
|
||||
$btn.prop( 'disabled', false );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
} )( jQuery );
|
||||
Reference in New Issue
Block a user