From 4731e8621b09f6c315d2503883fde2acc04c01e4 Mon Sep 17 00:00:00 2001 From: Louis Bailleul Date: Fri, 20 Nov 2015 12:02:51 +0000 Subject: [PATCH] Correct code to match code standards --- html/ajax_setresolution.php | 3 --- html/includes/print-graphrow.inc.php | 12 ++++-------- html/js/librenms.js | 26 ++++++++++++++------------ 3 files changed, 18 insertions(+), 23 deletions(-) diff --git a/html/ajax_setresolution.php b/html/ajax_setresolution.php index 3bf071e52a..e2dc12eba1 100644 --- a/html/ajax_setresolution.php +++ b/html/ajax_setresolution.php @@ -4,6 +4,3 @@ if(isset($_REQUEST['width']) AND isset($_REQUEST['height'])) { $_SESSION['screen_width'] = $_REQUEST['width']; $_SESSION['screen_height'] = $_REQUEST['height']; } - -echo $_SESSION['screen_width']; -?> diff --git a/html/includes/print-graphrow.inc.php b/html/includes/print-graphrow.inc.php index d3000844f9..0e4c7d9d04 100644 --- a/html/includes/print-graphrow.inc.php +++ b/html/includes/print-graphrow.inc.php @@ -37,19 +37,15 @@ else { ); }//end if -if($_SESSION['screen_width']) -{ - if($_SESSION['screen_width'] >= 800) - { +if($_SESSION['screen_width']) { + if($_SESSION['screen_width'] >= 800) { $graph_array['width'] = ($_SESSION['screen_width'] - 400 )/count($periods)+1; - }else - { + }else { $graph_array['width'] = $_SESSION['screen_width'] - 155; } } -if($_SESSION['screen_height']) -{ +if($_SESSION['screen_height']) { $graph_array['height'] = ($_SESSION['screen_height'] - 250)/4; } diff --git a/html/js/librenms.js b/html/js/librenms.js index f84dad6f36..3918c14a99 100644 --- a/html/js/librenms.js +++ b/html/js/librenms.js @@ -137,6 +137,18 @@ function submitCustomRange(frmdata) { return true; } +function updateResolution() +{ + $.post( + 'ajax_setresolution.php', + {width: $(window).width(),height:$(window).height()}, + function(json) {}, + 'json' + ); +} + +$(window).on('resize', function(){ updateResolution();}); + $(document).on("click", '.collapse-neighbors', function(event) { var caller = $(this); @@ -144,11 +156,9 @@ $(document).on("click", '.collapse-neighbors', function(event) var list = caller.find('.neighbors-interface-list'); var continued = caller.find('.neighbors-list-continued'); - if(button.hasClass("glyphicon-plus")) - { + if(button.hasClass("glyphicon-plus")) { button.addClass('glyphicon-minus').removeClass('glyphicon-plus'); - }else - { + }else { button.addClass('glyphicon-plus').removeClass('glyphicon-minus'); } @@ -156,12 +166,4 @@ $(document).on("click", '.collapse-neighbors', function(event) continued.toggle(); }); -function updateResolution() -{ - $.post('ajax_setresolution.php', { width: $(window).width() , height:$(window).height() }, function(json) { - },'json'); -} - -$(window).on('resize', function(){ updateResolution();}); -