From 6b7030c082583b67c2f5319698e512a27ec7f760 Mon Sep 17 00:00:00 2001 From: laf Date: Thu, 11 Feb 2016 23:19:56 +0000 Subject: [PATCH] Added show/hide line numbers button to show config page --- html/js/librenms.js | 21 +++++++++++++++++++++ html/pages/device/showconfig.inc.php | 3 +++ 2 files changed, 24 insertions(+) diff --git a/html/js/librenms.js b/html/js/librenms.js index b910907618..f103ea29b0 100644 --- a/html/js/librenms.js +++ b/html/js/librenms.js @@ -223,3 +223,24 @@ $(document).on("click", '.collapse-neighbors', function(event) list.toggle(); continued.toggle(); }); + + +$(document).ready(function() { + var lines = 'on'; + $("#linenumbers").button().click(function() { + if (lines == 'on') { + $($('.config').find('ol').get().reverse()).each(function(){ + $(this).replaceWith($('')) + lines = 'off'; + $('#linenumbers').val('Show line numbers'); + }); + } + else { + $($('.config').find('ul').get().reverse()).each(function(){ + $(this).replaceWith($('
    '+$(this).html()+'
')); + lines = 'on'; + $('#linenumbers').val('Hide line numbers'); + }); + } + }); +}); diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php index ed9219cf23..1ba06bbfc4 100644 --- a/html/pages/device/showconfig.inc.php +++ b/html/pages/device/showconfig.inc.php @@ -182,7 +182,10 @@ if ($_SESSION['userlevel'] >= '7') { $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); $geshi->set_overall_style('color: black;'); // $geshi->set_line_style('color: #999999'); + echo '
'; + echo ''; echo $geshi->parse_code(); + echo '
'; } }//end if