From 08ec2d996099baf305efd8f28ee267c7fd043390 Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Fri, 2 Oct 2015 14:57:24 -0400 Subject: Completes #5159 All duplicated JS removed to included file --- src/usr/local/www/system_certmanager.php | 162 ------------------------------- 1 file changed, 162 deletions(-) (limited to 'src/usr/local/www/system_certmanager.php') diff --git a/src/usr/local/www/system_certmanager.php b/src/usr/local/www/system_certmanager.php index 3e8cb26..8d0fd65 100644 --- a/src/usr/local/www/system_certmanager.php +++ b/src/usr/local/www/system_certmanager.php @@ -1058,168 +1058,6 @@ print $form; // max) - select.remove(0); - - if (select.options.length < max) - { - for (var i=select.options.length; i<=max; i++) - select.options.add(new Option(i, i), 0); - } - }); - - // Fire immediately - input.change(); - }); - } - - // Complicated function to move all help text associated with this input id to the same id - // on the row above. That way if you delete the last row, you don't lose the help - function moveHelpText(id) { - $('#' + id).parent('div').parent('div').find('input').each(function() { // For each - var fromId = this.id; - var toId = decrStringInt(fromId); - var helpSpan; - - if(!$(this).hasClass('pfIpMask') && !$(this).hasClass('btn')) { - - helpSpan = $('#' + fromId).parent('div').parent('div').find('span:last').clone(); - if($(helpSpan).hasClass('help-block')) { - if($('#' + decrStringInt(fromId)).parent('div').hasClass('input-group')) - $('#' + decrStringInt(fromId)).parent('div').after(helpSpan); - else - $('#' + decrStringInt(fromId)).after(helpSpan); - } - } - }); - } - - // Increment the number at the end of the string - function bumpStringInt( str ) { - var data = str.match(/(\D*)(\d+)(\D*)/), newStr = ""; - - if( data ) - newStr = data[ 1 ] + ( Number( data[ 2 ] ) + 1 ) + data[ 3 ]; - - return newStr || str; - } - - // Decrement the number at the end of the string - function decrStringInt( str ) { - var data = str.match(/(\D*)(\d+)(\D*)/), newStr = ""; - - if( data ) - newStr = data[ 1 ] + ( Number( data[ 2 ] ) - 1 ) + data[ 3 ]; - - return newStr || str; - } - - // Called after a delete so that there are no gaps in the numbering. Most of the time the config system doesn't care about - // gaps, but I do :) - function renumber() { - var idx = 0; - - $('.repeatable').each(function() { - - $(this).find('input').each(function() { - $(this).prop("id", this.id.replace(/\d+$/, "") + idx); - $(this).prop("name", this.name.replace(/\d+$/, "") + idx); - }); - - $(this).find('select').each(function() { - $(this).prop("id", this.id.replace(/\d+$/, "") + idx); - $(this).prop("name", this.name.replace(/\d+$/, "") + idx); - }); - - $(this).find('label').attr('for', $(this).find('label').attr('for').replace(/\d+$/, "") + idx); - - idx++; - }); - } - - function delete_row(row) { - $('#' + row).parent('div').parent('div').remove(); - renumber(); - } - - function add_row() { - // Find the lst repeatable group - var lastRepeatableGroup = $('.repeatable:last'); - - // Clone it - var newGroup = lastRepeatableGroup.clone(true); - - // Increment the suffix number for each input elemnt in the new group - $(newGroup).find('input').each(function() { - $(this).prop("id", bumpStringInt(this.id)); - $(this).prop("name", bumpStringInt(this.name)); - if(!$(this).is('[id^=delete]')) - $(this).val(''); - }); - - // Do the same for selectors - $(newGroup).find('select').each(function() { - $(this).prop("id", bumpStringInt(this.id)); - $(this).prop("name", bumpStringInt(this.name)); - // If this selector lists mask bits, we need it to be reset to all 128 options - // and no items selected, so that automatic v4/v6 selection still works - if($(this).is('[id^=address_subnet]')) { - $(this).empty(); - for(idx=128; idx>0; idx--) { - $(this).append($('