From c95dabdd19faa6c1221638861306cd387fb1958f Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Tue, 12 Jan 2016 08:56:58 -0500 Subject: Improved infoblock system no longer needs sufficies if more than one per page Removed long commented out script --- src/usr/local/www/jquery/pfSenseHelpers.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/usr/local/www/jquery/pfSenseHelpers.js') diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js index f447b65..ebf00e0 100644 --- a/src/usr/local/www/jquery/pfSenseHelpers.js +++ b/src/usr/local/www/jquery/pfSenseHelpers.js @@ -387,25 +387,29 @@ $('[id^=delete]').click(function(event) { // "More information" handlers -------------------------------------------------------------------- // If there is an infoblock, automatically add an info icon that toggles its display -// If there is n=more than one infoblock on a page, each must use a unique class suffic. e.g.: infoblock_01 or infoblock_open_19 -$('[class^="infoblock"], [class^="infoblock_open"]').each(function() { - var classname = $(this).attr("class"); - var sfx = classname.substr(9); +var sfx = 0; - if (classname.indexOf("infoblock_open") == -1) { +$('.infoblock').each(function() { + // If the block has hte class "blockopen" it is initiall open + if (! $(this).hasClass("blockopen")) { $(this).hide(); + } else { + $(this).removeClass("blockopen"); } - $(this).before(''); + // Add the "i" icon before the infoblock, incrementing hte icon id for each block (in case there are multiple infoblocks on a page) + $(this).before(''); + $(this).removeClass("infoblock"); + $(this).addClass("infoblock" + sfx.toString()); + sfx++; }); // Show the help on clicking the info icon $('[id^="showinfo"]').click(function() { var id = $(this).attr("id"); - var target = "infoblock" + id.substr(8); - $('.' + target).toggle(); + $('.' + "infoblock" + id.substr(8)).toggle(); }); // ------------------------------------------------------------------------------------------------ -- cgit v1.1