From b9a3a4fc4e410dcc8fdcae6fe326bdf9b1bcfdd0 Mon Sep 17 00:00:00 2001 From: Aidaho12 Date: Sat, 5 May 2018 18:54:33 +0600 Subject: [PATCH] v2.5 Welcome, Jinja2! code is optimized --- inc/configshow.js | 1 + inc/overview.js | 1 + inc/script.js | 30 ++++++++++++++++++++++-------- 3 files changed, 24 insertions(+), 8 deletions(-) diff --git a/inc/configshow.js b/inc/configshow.js index 4d2c0f49..7e452d87 100644 --- a/inc/configshow.js +++ b/inc/configshow.js @@ -1,4 +1,5 @@ $( function() { + $( "input[type=submit], button" ).button(); $( ".configShow" ).accordion({ collapsible: true, heightStyle: "content", diff --git a/inc/overview.js b/inc/overview.js index f3558b4a..0d4514d5 100644 --- a/inc/overview.js +++ b/inc/overview.js @@ -46,4 +46,5 @@ $( function() { $( "#show-all-users" ).text("Show all"); } }); + $('#secIntervals').css('display', 'none'); }); \ No newline at end of file diff --git a/inc/script.js b/inc/script.js index 4def657e..300b6ab2 100644 --- a/inc/script.js +++ b/inc/script.js @@ -14,24 +14,21 @@ function autoRefreshStyle(autoRefresh) { if ( autoRefresh == 60) { timeRange = " minute" autoRefresh = autoRefresh / 60; - margin = '-80px'; } else if ( autoRefresh > 60 && autoRefresh < 3600 ) { timeRange = " minutes" autoRefresh = autoRefresh / 60; - margin = '-93px'; } else if ( autoRefresh >= 3600 && autoRefresh < 86401 ) { timeRange = " hours" - autoRefresh = autoRefresh / 3600; - margin = '-80px'; + autoRefresh = autoRefresh / 3600; } else { timeRange = " seconds"; - margin = '-100px'; } $('#1').text(autoRefresh + timeRange); $('#0').text(autoRefresh + timeRange); $('.auto-refresh-pause').css('display', 'inline'); $('.auto-refresh-resume').css('display', 'none'); - $('.auto-refresh-pause').css('margin-left', margin); + $('.auto-refresh-pause').css('margin-left', "-25px"); + $('.auto-refresh-resume').css('margin-left', "-25px"); $('.auto-refresh img').remove(); } @@ -39,7 +36,7 @@ function setRefreshInterval(interval) { if (interval == "0") { Cookies.remove('auto-refresh'); pauseAutoRefresh(); - $('.auto-refresh').append('restart'); + $('.auto-refresh').prepend('restart'); $('#1').text('Auto-refresh'); $('#0').text('Auto-refresh'); $('.auto-refresh-pause').css('display', 'none'); @@ -224,6 +221,23 @@ function showConfig() { } } ); } +function showUploadConfig() { + $.ajax( { + url: "options.py", + data: { + serv: $("#serv").val(), + act: "configShow", + configver: $('#configver').val() + }, + type: "GET", + success: function( data ) { + $("#ajax").html(data); + window.history.pushState("Show config", "Show config", cur_url[0]+"?serv="+$("#serv").val()+"&open=open&configver="+$('#configver').val()); + var urlConfigShowJs = '/inc/configshow.js'; + $.getScript(urlConfigShowJs); + } + } ); +} function viewLogs() { $.ajax( { url: "options.py", @@ -644,7 +658,7 @@ $( function() { url: "options.py", data: { showif:1, - serv: $("#master").val() + serv: $("#master-add").val() }, success: function( data ) { data = data.replace(/\s+/g,' ');