JS optimized
pull/42/head
Aidaho12 2018-08-30 11:21:03 +06:00
parent 8052f9e8ea
commit da4d9355d7
9 changed files with 97 additions and 247 deletions

View File

@ -33,5 +33,6 @@ output_from_parsed_template = template.render(h2 = 1,
select_id = "serv", select_id = "serv",
selects = servers, selects = servers,
token = token, token = token,
serv = serv,
servbackend = servbackend) servbackend = servbackend)
print(output_from_parsed_template) print(output_from_parsed_template)

View File

@ -20,7 +20,6 @@
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="/inc/js-cookie.js"></script> <script src="/inc/js-cookie.js"></script>
<script src="/inc/script.js"></script> <script src="/inc/script.js"></script>
<script src="/inc/configshow.js"></script>
<script src="/inc/nprogress.js"></script> <script src="/inc/nprogress.js"></script>
<script src="/inc/vertical_scrol/custom_scrollbar.min.js"></script> <script src="/inc/vertical_scrol/custom_scrollbar.min.js"></script>
</head> </head>
@ -102,7 +101,7 @@
</ul> </ul>
</nav> </nav>
<div class="copyright-menu"> <div class="copyright-menu">
HAproxy-WI v3.2.2 HAproxy-WI v3.2.3
<br> <br>
<a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a> <a href="https://www.patreon.com/haproxy_wi" title="Donate" target="_blank" style="color: #fff; margin-left: 30px; color: red;" class="patreon"> Patreon</a>
</div> </div>

View File

@ -14,10 +14,11 @@
<select autofocus required id="{{ select_id }}" name="{{ select_id }}"> <select autofocus required id="{{ select_id }}" name="{{ select_id }}">
<option disabled>Choose server</option> <option disabled>Choose server</option>
{% for select in selects %} {% for select in selects %}
[% if serv == select.2 %] {% if serv == select.2 %}
<option value="{{ select.2 }}" selected>{{ select.1 }}</option> <option value="{{ select.2 }}" selected>{{ select.1 }}</option>
{% else %} {% else %}
<option value="{{ select.2 }}">{{ select.1 }}</option> <option value="{{ select.2 }}">{{ select.1 }}</option>
{% endif %}
{% endfor %} {% endfor %}
</select> </select>
</td> </td>

View File

@ -16,7 +16,7 @@
display: block; display: block;
position: absolute; position: absolute;
right: 0px; right: 0px;
width: 100px; width: 0px;
height: 100%; height: 100%;
box-shadow: 0 0 10px #29d, 0 0 5px #29d; box-shadow: 0 0 10px #29d, 0 0 5px #29d;
opacity: 1.0; opacity: 1.0;
@ -29,8 +29,8 @@
display: block; display: block;
position: fixed; position: fixed;
z-index: 1031; z-index: 1031;
top: 15px; top: 10px;
right: 285px; float: right;
} }
#nprogress .spinner-icon { #nprogress .spinner-icon {
width: 18px; width: 18px;
@ -58,5 +58,4 @@
@keyframes nprogress-spinner { @keyframes nprogress-spinner {
0% { transform: rotate(0deg); } 0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); } 100% { transform: rotate(360deg); }
} }

View File

@ -1,8 +1,6 @@
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress /* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
* @license MIT */ * @license MIT */
;(function(root, factory) { ;(function(root, factory) {
if (typeof define === 'function' && define.amd) { if (typeof define === 'function' && define.amd) {
define(factory); define(factory);
} else if (typeof exports === 'object') { } else if (typeof exports === 'object') {
@ -10,12 +8,9 @@
} else { } else {
root.NProgress = factory(); root.NProgress = factory();
} }
})(this, function() { })(this, function() {
var NProgress = {}; var NProgress = {};
NProgress.version = '0.2.0'; NProgress.version = '0.2.0';
var Settings = NProgress.settings = { var Settings = NProgress.settings = {
minimum: 0.08, minimum: 0.08,
easing: 'linear', easing: 'linear',
@ -29,14 +24,6 @@
parent: 'body', parent: 'body',
template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>' template: '<div class="bar" role="bar"><div class="peg"></div></div><div class="spinner" role="spinner"><div class="spinner-icon"></div></div>'
}; };
/**
* Updates configuration.
*
* NProgress.configure({
* minimum: 0.1
* });
*/
NProgress.configure = function(options) { NProgress.configure = function(options) {
var key, value; var key, value;
for (key in options) { for (key in options) {
@ -46,20 +33,7 @@
return this; return this;
}; };
/**
* Last number.
*/
NProgress.status = null; NProgress.status = null;
/**
* Sets the progress bar status, where `n` is a number from `0.0` to `1.0`.
*
* NProgress.set(0.4);
* NProgress.set(1.0);
*/
NProgress.set = function(n) { NProgress.set = function(n) {
var started = NProgress.isStarted(); var started = NProgress.isStarted();
@ -70,24 +44,16 @@
bar = progress.querySelector(Settings.barSelector), bar = progress.querySelector(Settings.barSelector),
speed = Settings.speed, speed = Settings.speed,
ease = Settings.easing; ease = Settings.easing;
progress.offsetWidth;
progress.offsetWidth; /* Repaint */
queue(function(next) { queue(function(next) {
// Set positionUsing if it hasn't already been set
if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS(); if (Settings.positionUsing === '') Settings.positionUsing = NProgress.getPositioningCSS();
// Add transition
css(bar, barPositionCSS(n, speed, ease)); css(bar, barPositionCSS(n, speed, ease));
if (n === 1) { if (n === 1) {
// Fade out
css(progress, { css(progress, {
transition: 'none', transition: 'none',
opacity: 1 opacity: 1
}); });
progress.offsetWidth; /* Repaint */ progress.offsetWidth;
setTimeout(function() { setTimeout(function() {
css(progress, { css(progress, {
transition: 'all ' + speed + 'ms linear', transition: 'all ' + speed + 'ms linear',
@ -102,24 +68,13 @@
setTimeout(next, speed); setTimeout(next, speed);
} }
}); });
return this; return this;
}; };
NProgress.isStarted = function() { NProgress.isStarted = function() {
return typeof NProgress.status === 'number'; return typeof NProgress.status === 'number';
}; };
/**
* Shows the progress bar.
* This is the same as setting the status to 0%, except that it doesn't go backwards.
*
* NProgress.start();
*
*/
NProgress.start = function() { NProgress.start = function() {
if (!NProgress.status) NProgress.set(0); if (!NProgress.status) NProgress.set(0);
var work = function() { var work = function() {
setTimeout(function() { setTimeout(function() {
if (!NProgress.status) return; if (!NProgress.status) return;
@ -127,37 +82,15 @@
work(); work();
}, Settings.trickleSpeed); }, Settings.trickleSpeed);
}; };
if (Settings.trickle) work(); if (Settings.trickle) work();
return this; return this;
}; };
/**
* Hides the progress bar.
* This is the *sort of* the same as setting the status to 100%, with the
* difference being `done()` makes some placebo effect of some realistic motion.
*
* NProgress.done();
*
* If `true` is passed, it will show the progress bar even if its hidden.
*
* NProgress.done(true);
*/
NProgress.done = function(force) { NProgress.done = function(force) {
if (!force && !NProgress.status) return this; if (!force && !NProgress.status) return this;
return NProgress.inc(0.3 + 0.5 * Math.random()).set(1); return NProgress.inc(0.3 + 0.5 * Math.random()).set(1);
}; };
/**
* Increments by a random amount.
*/
NProgress.inc = function(amount) { NProgress.inc = function(amount) {
var n = NProgress.status; var n = NProgress.status;
if (!n) { if (!n) {
return NProgress.start(); return NProgress.start();
} else if(n > 1) { } else if(n > 1) {
@ -170,37 +103,24 @@
else if (n >= 0.8 && n < 0.99) { amount = 0.005; } else if (n >= 0.8 && n < 0.99) { amount = 0.005; }
else { amount = 0; } else { amount = 0; }
} }
n = clamp(n + amount, 0, 0.994); n = clamp(n + amount, 0, 0.994);
return NProgress.set(n); return NProgress.set(n);
} }
}; };
NProgress.trickle = function() { NProgress.trickle = function() {
return NProgress.inc(); return NProgress.inc();
}; };
/**
* Waits for all supplied jQuery promises and
* increases the progress as the promises resolve.
*
* @param $promise jQUery Promise
*/
(function() { (function() {
var initial = 0, current = 0; var initial = 0, current = 0;
NProgress.promise = function($promise) { NProgress.promise = function($promise) {
if (!$promise || $promise.state() === "resolved") { if (!$promise || $promise.state() === "resolved") {
return this; return this;
} }
if (current === 0) { if (current === 0) {
NProgress.start(); NProgress.start();
} }
initial++; initial++;
current++; current++;
$promise.always(function() { $promise.always(function() {
current--; current--;
if (current === 0) { if (current === 0) {
@ -210,122 +130,67 @@
NProgress.set((initial - current) / initial); NProgress.set((initial - current) / initial);
} }
}); });
return this; return this;
}; };
})(); })();
/**
* (Internal) renders the progress bar markup based on the `template`
* setting.
*/
NProgress.render = function(fromStart) { NProgress.render = function(fromStart) {
if (NProgress.isRendered()) return document.getElementById('nprogress'); if (NProgress.isRendered()) return document.getElementById('nprogress');
addClass(document.documentElement, 'nprogress-busy'); addClass(document.documentElement, 'nprogress-busy');
var progress = document.createElement('div'); var progress = document.createElement('div');
progress.id = 'nprogress'; progress.id = 'nprogress';
progress.innerHTML = Settings.template; progress.innerHTML = Settings.template;
var bar = progress.querySelector(Settings.barSelector), var bar = progress.querySelector(Settings.barSelector),
perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0), perc = fromStart ? '-100' : toBarPerc(NProgress.status || 0),
parent = document.querySelector(Settings.parent), parent = document.querySelector(Settings.parent),
spinner; spinner;
css(bar, { css(bar, {
transition: 'all 0 linear', transition: 'all 0 linear',
transform: 'translate3d(' + perc + '%,0,0)' transform: 'translate3d(' + perc + '%,0,0)'
}); });
if (!Settings.showSpinner) { if (!Settings.showSpinner) {
spinner = progress.querySelector(Settings.spinnerSelector); spinner = progress.querySelector(Settings.spinnerSelector);
spinner && removeElement(spinner); spinner && removeElement(spinner);
} }
if (parent != document.body) { if (parent != document.body) {
addClass(parent, 'nprogress-custom-parent'); addClass(parent, 'nprogress-custom-parent');
} }
parent.appendChild(progress); parent.appendChild(progress);
return progress; return progress;
}; };
/**
* Removes the element. Opposite of render().
*/
NProgress.remove = function() { NProgress.remove = function() {
removeClass(document.documentElement, 'nprogress-busy'); removeClass(document.documentElement, 'nprogress-busy');
removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent'); removeClass(document.querySelector(Settings.parent), 'nprogress-custom-parent');
var progress = document.getElementById('nprogress'); var progress = document.getElementById('nprogress');
progress && removeElement(progress); progress && removeElement(progress);
}; };
/**
* Checks if the progress bar is rendered.
*/
NProgress.isRendered = function() { NProgress.isRendered = function() {
return !!document.getElementById('nprogress'); return !!document.getElementById('nprogress');
}; };
/**
* Determine which positioning CSS rule to use.
*/
NProgress.getPositioningCSS = function() { NProgress.getPositioningCSS = function() {
// Sniff on document.body.style
var bodyStyle = document.body.style; var bodyStyle = document.body.style;
// Sniff prefixes
var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' : var vendorPrefix = ('WebkitTransform' in bodyStyle) ? 'Webkit' :
('MozTransform' in bodyStyle) ? 'Moz' : ('MozTransform' in bodyStyle) ? 'Moz' :
('msTransform' in bodyStyle) ? 'ms' : ('msTransform' in bodyStyle) ? 'ms' :
('OTransform' in bodyStyle) ? 'O' : ''; ('OTransform' in bodyStyle) ? 'O' : '';
if (vendorPrefix + 'Perspective' in bodyStyle) { if (vendorPrefix + 'Perspective' in bodyStyle) {
// Modern browsers with 3D support, e.g. Webkit, IE10
return 'translate3d'; return 'translate3d';
} else if (vendorPrefix + 'Transform' in bodyStyle) { } else if (vendorPrefix + 'Transform' in bodyStyle) {
// Browsers without 3D support, e.g. IE9
return 'translate'; return 'translate';
} else { } else {
// Browsers without translate() support, e.g. IE7-8
return 'margin'; return 'margin';
} }
}; };
/**
* Helpers
*/
function clamp(n, min, max) { function clamp(n, min, max) {
if (n < min) return min; if (n < min) return min;
if (n > max) return max; if (n > max) return max;
return n; return n;
} }
/**
* (Internal) converts a percentage (`0..1`) to a bar translateX
* percentage (`-100%..0%`).
*/
function toBarPerc(n) { function toBarPerc(n) {
return (-1 + n) * 100; return (-1 + n) * 100;
} }
/**
* (Internal) returns the correct CSS for changing the bar's
* position given an n percentage, and speed and ease from Settings
*/
function barPositionCSS(n, speed, ease) { function barPositionCSS(n, speed, ease) {
var barCSS; var barCSS;
if (Settings.positionUsing === 'translate3d') { if (Settings.positionUsing === 'translate3d') {
barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' }; barCSS = { transform: 'translate3d('+toBarPerc(n)+'%,0,0)' };
} else if (Settings.positionUsing === 'translate') { } else if (Settings.positionUsing === 'translate') {
@ -333,16 +198,9 @@
} else { } else {
barCSS = { 'margin-left': toBarPerc(n)+'%' }; barCSS = { 'margin-left': toBarPerc(n)+'%' };
} }
barCSS.transition = 'all '+speed+'ms '+ease; barCSS.transition = 'all '+speed+'ms '+ease;
return barCSS; return barCSS;
} }
/**
* (Internal) Queues a function to be executed.
*/
var queue = (function() { var queue = (function() {
var pending = []; var pending = [];
@ -352,35 +210,22 @@
fn(next); fn(next);
} }
} }
return function(fn) { return function(fn) {
pending.push(fn); pending.push(fn);
if (pending.length == 1) next(); if (pending.length == 1) next();
}; };
})(); })();
/**
* (Internal) Applies css properties to an element, similar to the jQuery
* css method.
*
* While this helper does assist with vendor prefixed property names, it
* does not perform any manipulation of values prior to setting styles.
*/
var css = (function() { var css = (function() {
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ], var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
cssProps = {}; cssProps = {};
function camelCase(string) { function camelCase(string) {
return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) { return string.replace(/^-ms-/, 'ms-').replace(/-([\da-z])/gi, function(match, letter) {
return letter.toUpperCase(); return letter.toUpperCase();
}); });
} }
function getVendorProp(name) {
function getVendorProp(name) {
var style = document.body.style; var style = document.body.style;
if (name in style) return name; if (name in style) return name;
var i = cssPrefixes.length, var i = cssPrefixes.length,
capName = name.charAt(0).toUpperCase() + name.slice(1), capName = name.charAt(0).toUpperCase() + name.slice(1),
vendorName; vendorName;
@ -388,25 +233,20 @@
vendorName = cssPrefixes[i] + capName; vendorName = cssPrefixes[i] + capName;
if (vendorName in style) return vendorName; if (vendorName in style) return vendorName;
} }
return name; return name;
} }
function getStyleProp(name) { function getStyleProp(name) {
name = camelCase(name); name = camelCase(name);
return cssProps[name] || (cssProps[name] = getVendorProp(name)); return cssProps[name] || (cssProps[name] = getVendorProp(name));
} }
function applyCss(element, prop, value) { function applyCss(element, prop, value) {
prop = getStyleProp(prop); prop = getStyleProp(prop);
element.style[prop] = value; element.style[prop] = value;
} }
return function(element, properties) { return function(element, properties) {
var args = arguments, var args = arguments,
prop, prop,
value; value;
if (args.length == 2) { if (args.length == 2) {
for (prop in properties) { for (prop in properties) {
value = properties[prop]; value = properties[prop];
@ -417,64 +257,28 @@
} }
} }
})(); })();
/**
* (Internal) Determines if an element or space separated list of class names contains a class name.
*/
function hasClass(element, name) { function hasClass(element, name) {
var list = typeof element == 'string' ? element : classList(element); var list = typeof element == 'string' ? element : classList(element);
return list.indexOf(' ' + name + ' ') >= 0; return list.indexOf(' ' + name + ' ') >= 0;
} }
/**
* (Internal) Adds a class to an element.
*/
function addClass(element, name) { function addClass(element, name) {
var oldList = classList(element), var oldList = classList(element),
newList = oldList + name; newList = oldList + name;
if (hasClass(oldList, name)) return; if (hasClass(oldList, name)) return;
// Trim the opening space.
element.className = newList.substring(1); element.className = newList.substring(1);
} }
/**
* (Internal) Removes a class from an element.
*/
function removeClass(element, name) { function removeClass(element, name) {
var oldList = classList(element), var oldList = classList(element),
newList; newList;
if (!hasClass(element, name)) return; if (!hasClass(element, name)) return;
// Replace the class name.
newList = oldList.replace(' ' + name + ' ', ' '); newList = oldList.replace(' ' + name + ' ', ' ');
// Trim the opening and closing spaces.
element.className = newList.substring(1, newList.length - 1); element.className = newList.substring(1, newList.length - 1);
} }
/**
* (Internal) Gets a space separated list of the class names on the element.
* The list is wrapped with a single space on each end to facilitate finding
* matches within the list.
*/
function classList(element) { function classList(element) {
return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' '); return (' ' + (element && element.className || '') + ' ').replace(/\s+/gi, ' ');
} }
/**
* (Internal) Removes an element from the DOM.
*/
function removeElement(element) { function removeElement(element) {
element && element.parentNode && element.parentNode.removeChild(element); element && element.parentNode && element.parentNode.removeChild(element);
} }
return NProgress; return NProgress;
}); });

View File

@ -49,11 +49,10 @@ if(Cookies.get('restart')) {
if (cur_url[0] == "overview.py") { if (cur_url[0] == "overview.py") {
$("#apply_div").css('width', '650px'); $("#apply_div").css('width', '650px');
$("#apply_div").html("You made changes to the server: "+ip+". Changes will take effect only after<a id='"+ip+"' class='restart' title='Restart HAproxy service'>restart</a><a href='#' title='close' id='apply_close' style='float: right'><b>X</b></a>"); $("#apply_div").html("You made changes to the server: "+ip+". Changes will take effect only after<a id='"+ip+"' class='restart' title='Restart HAproxy service'>restart</a><a href='#' title='close' id='apply_close' style='float: right'><b>X</b></a>");
$.getScript('/inc/overview.js');
} else { } else {
$("#apply_div").html("You made changes to the server: "+ip+". Changes will take effect only after restart. <a href='overview.py' title='Overview'>Go to Overview page and restart</a><a href='#' title='close' id='apply_close' style='float: right'><b>X</b></a>"); $("#apply_div").html("You made changes to the server: "+ip+". Changes will take effect only after restart. <a href='overview.py' title='Overview'>Go to Overview page and restart</a><a href='#' title='close' id='apply_close' style='float: right'><b>X</b></a>");
$.getScript('/inc/overview.js');
} }
$.getScript('/inc/overview.js');
} }
} }
} ); } );
@ -90,6 +89,7 @@ function autoRefreshStyle(autoRefresh) {
function setRefreshInterval(interval) { function setRefreshInterval(interval) {
if (interval == "0") { if (interval == "0") {
Cookies.remove('auto-refresh', { path: '' }); Cookies.remove('auto-refresh', { path: '' });
Cookies.remove('auto-refresh-pause', { path: '' });
pauseAutoRefresh(); pauseAutoRefresh();
$('.auto-refresh').prepend('<img src=/image/pic/update.png alt="restart" class="icon">'); $('.auto-refresh').prepend('<img src=/image/pic/update.png alt="restart" class="icon">');
$('.auto-refresh').css('margin-top', '-3px'); $('.auto-refresh').css('margin-top', '-3px');
@ -196,9 +196,12 @@ function showOverviewWaf() {
success: function( data ) { success: function( data ) {
$("#ajaxwafstatus").empty(); $("#ajaxwafstatus").empty();
$("#ajaxwafstatus").html(data); $("#ajaxwafstatus").html(data);
$.getScript('/inc/overview.js'); $.getScript('/inc/overview.js');
$.getScript('/inc/waf.js'); if (cur_url[0] == "waf.py") {
$.getScript(url); $.getScript('/inc/waf.js');
$( "input[type=submit], button" ).button();
$( "input[type=checkbox]" ).checkboxradio();
}
} }
} ); } );
} }
@ -306,7 +309,6 @@ function showCompare() {
type: "GET", type: "GET",
success: function( data ) { success: function( data ) {
$("#ajax").html(data); $("#ajax").html(data);
$.getScript(url);
} }
} ); } );
} }
@ -322,7 +324,8 @@ function showCompareConfigs() {
type: "GET", type: "GET",
success: function( data ) { success: function( data ) {
$("#ajax-compare").html(data); $("#ajax-compare").html(data);
$.getScript(url); $( "input[type=submit], button" ).button();
$( "select" ).selectmenu();
} }
} ); } );
} }
@ -337,8 +340,7 @@ function showConfig() {
type: "GET", type: "GET",
success: function( data ) { success: function( data ) {
$("#ajax").html(data); $("#ajax").html(data);
var urlConfigShowJs = '/inc/configshow.js'; $.getScript('/inc/configshow.js');
$.getScript(urlConfigShowJs);
} }
} ); } );
} }
@ -364,8 +366,7 @@ function showUploadConfig() {
} else { } else {
window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&configver="+$('#configver').val()); window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&configver="+$('#configver').val());
} }
var urlConfigShowJs = '/inc/configshow.js'; $.getScript('/inc/configshow.js');
$.getScript(urlConfigShowJs);
} }
} ); } );
} }

View File

@ -101,7 +101,7 @@ pre {
margin-left: auto; margin-left: auto;
float: right; float: right;
margin-top: 5px; margin-top: 5px;
margin-right: 30px; margin-right: 5px;
} }
.auto-refresh a { .auto-refresh a {
color: #fff !important; color: #fff !important;
@ -609,6 +609,9 @@ a:focus {
background-color: #fff3cd; background-color: #fff3cd;
border-color: #ffeeba; border-color: #ffeeba;
} }
#errorMess {
float: right;
}
.added { .added {
position: absolute; position: absolute;
margin-left: 30px; margin-left: 30px;

View File

@ -141,14 +141,19 @@ $( function() {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-users").append(data); $("#ajax-users").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove(); $('.alert-danger').remove();
$("#ajax-users").append(data); $("#ajax-users").append(data);
$( ".newuser" ).addClass( "update", 1000, callbackUser ); $( ".newuser" ).addClass( "update", 1000, callbackUser );
$.getScript(url);
$.getScript(awesome); $.getScript(awesome);
$.getScript(users); //$.getScript(url);
$( "input[type=submit], button" ).button();
$( "input[type=checkbox]" ).checkboxradio();
$( "select" ).selectmenu();
} }
} }
} ); } );
@ -167,7 +172,10 @@ $( function() {
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-group").append(data); $("#ajax-group").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
var getId = new RegExp('[0-9]+'); var getId = new RegExp('[0-9]+');
var id = data.match(getId); var id = data.match(getId);
@ -218,12 +226,18 @@ $( function() {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-servers").append(data); $("#ajax-servers").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove(); $('.alert-danger').remove();
$("#ajax-servers").append(data); $("#ajax-servers").append(data);
$(".newserver").addClass( "update", 1000, callbackServer ); $(".newserver").addClass( "update", 1000, callbackServer );
$.getScript(url); //$.getScript(url);
$( "input[type=submit], button" ).button();
$( "input[type=checkbox]" ).checkboxradio();
$( "select" ).selectmenu();
$.getScript(awesome); $.getScript(awesome);
} }
} }
@ -251,17 +265,26 @@ $( function() {
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-ssh").append(data); $("#ajax-ssh").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
var getId = new RegExp('ssh-table-[0-9]+'); var getId = new RegExp('ssh-table-[0-9]+');
var id = data.match(getId) + ''; var id = data.match(getId) + '';
id = id.split('-').pop();; id = id.split('-').pop();;
$("#ssh_enable_table").append(data); $("#ssh_enable_table").append(data);
$( ".newgroup" ).addClass( "update", 1000, callbackGroup ); $( ".new_ssh" ).addClass( "update", 1000 );
setTimeout(function() {
$( ".new_ssh" ).removeClass( "update" );
}, 2500 );
$('select:regex(id, credentials)').append('<option value='+id+'>'+$('#new-ssh-add').val()+'</option>').selectmenu("refresh"); $('select:regex(id, credentials)').append('<option value='+id+'>'+$('#new-ssh-add').val()+'</option>').selectmenu("refresh");
$('select:regex(id, ssh-key-name)').append('<option value='+$('#new-ssh-add').val()+'>'+$('#new-ssh-add').val()+'</option>').selectmenu("refresh"); $('select:regex(id, ssh-key-name)').append('<option value='+$('#new-ssh-add').val()+'>'+$('#new-ssh-add').val()+'</option>').selectmenu("refresh");
$.getScript(awesome); $.getScript(awesome);
$.getScript(url); //$.getScript(url);
$( "input[type=submit], button" ).button();
$( "input[type=checkbox]" ).checkboxradio();
$( "select" ).selectmenu();
} }
} }
} ); } );
@ -281,12 +304,18 @@ $( function() {
success: function( data ) { success: function( data ) {
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-telegram").append(data); $("#ajax-telegram").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$("#checker_table").append(data); $("#checker_table").append(data);
$( ".newgroup" ).addClass( "update", 1000, callbackGroup ); $( ".newgroup" ).addClass( "update", 1000, callbackGroup );
$.getScript(awesome); $.getScript(awesome);
$.getScript(url); //$.getScript(url);
$( "input[type=submit], button" ).button();
$( "input[type=checkbox]" ).checkboxradio();
$( "select" ).selectmenu();
} }
} }
} ); } );
@ -405,7 +434,10 @@ function updateSettings(param, val) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax").append(data); $("#ajax").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove(); $('.alert-danger').remove();
$("#"+param).parent().parent().addClass( "update", 1000 ); $("#"+param).parent().parent().addClass( "update", 1000 );
@ -622,13 +654,16 @@ function updateUser(id) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-users").append(data); $("#ajax-users").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove(); $('.alert-danger').remove();
$("#user-"+id).addClass( "update", 1000 ); $("#user-"+id).addClass( "update", 1000 );
setTimeout(function() { setTimeout(function() {
$( "#user-"+id ).removeClass( "update" ); $( "#user-"+id ).removeClass( "update" );
}, 2500 ); }, 2500 );
} }
} }
} ); } );
@ -647,7 +682,10 @@ function updateGroup(id) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-group").append(data); $("#ajax-group").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove(); $('.alert-danger').remove();
$("#group-"+id).addClass( "update", 1000 ); $("#group-"+id).addClass( "update", 1000 );
@ -701,7 +739,10 @@ function updateServer(id) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-servers").append(data); $("#ajax-servers").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove(); $('.alert-danger').remove();
$("#server-"+id).addClass( "update", 1000 ); $("#server-"+id).addClass( "update", 1000 );
@ -761,7 +802,10 @@ function updateSSH(id) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-ssh").append(data); $("#ajax-ssh").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove(); $('.alert-danger').remove();
$("#ssh-table-"+id).addClass( "update", 1000 ); $("#ssh-table-"+id).addClass( "update", 1000 );
@ -791,7 +835,10 @@ function updateTelegram(id) {
data = data.replace(/\s+/g,' '); data = data.replace(/\s+/g,' ');
if (data.indexOf('error') != '-1') { if (data.indexOf('error') != '-1') {
$("#ajax-ssh").append(data); $("#ajax-ssh").append(data);
$.getScript(users); $('#errorMess').click(function() {
$('#error').remove();
$('.alert-danger').remove();
});
} else { } else {
$('.alert-danger').remove(); $('.alert-danger').remove();
$("#telegram-table-"+id).addClass( "update", 1000 ); $("#telegram-table-"+id).addClass( "update", 1000 );

View File

@ -1,5 +0,0 @@
$( function() {
$('.alert-danger').click(function() {
$('.alert-danger').remove();
});
});