Support Pasting into CIDR Input, and '/' to move to Network Size Input
This commit is contained in:
parent
2fe1714e17
commit
cbf30a67b0
1 changed files with 22 additions and 7 deletions
29
dist/js/main.js
vendored
29
dist/js/main.js
vendored
|
@ -42,12 +42,27 @@ const minSubnetSizes = {
|
||||||
AWS: 28,
|
AWS: 28,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$('input#network').on('paste', function (e) {
|
||||||
|
let pastedData = window.event.clipboardData.getData('text')
|
||||||
|
if (pastedData.includes('/')) {
|
||||||
|
let [network, netSize] = pastedData.split('/')
|
||||||
|
$('#network').val(network)
|
||||||
|
$('#netsize').val(netSize)
|
||||||
|
}
|
||||||
|
e.preventDefault()
|
||||||
|
});
|
||||||
|
|
||||||
|
$("input#network").on('keydown', function (e) {
|
||||||
|
if (e.key === '/') {
|
||||||
|
e.preventDefault()
|
||||||
|
$('input#netsize').focus().select()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
$('input#network,input#netsize').on('input', function() {
|
$('input#network,input#netsize').on('input', function() {
|
||||||
$('#input_form')[0].classList.add('was-validated');
|
$('#input_form')[0].classList.add('was-validated');
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
$('#color_palette div').on('click', function() {
|
$('#color_palette div').on('click', function() {
|
||||||
// We don't really NEED to convert this to hex, but it's really low overhead to do the
|
// We don't really NEED to convert this to hex, but it's really low overhead to do the
|
||||||
// conversion here and saves us space in the export/save
|
// conversion here and saves us space in the export/save
|
||||||
|
@ -731,25 +746,25 @@ $( document ).ready(function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
errorPlacement: function(error, element) {
|
errorPlacement: function(error, element) {
|
||||||
console.log(error);
|
//console.log(error);
|
||||||
console.log(element);
|
//console.log(element);
|
||||||
if (error[0].innerHTML !== '') {
|
if (error[0].innerHTML !== '') {
|
||||||
console.log('Error Placement - Text')
|
//console.log('Error Placement - Text')
|
||||||
if (!element.data('errorIsVisible')) {
|
if (!element.data('errorIsVisible')) {
|
||||||
bootstrap.Tooltip.getInstance(element).setContent({'.tooltip-inner': error[0].innerHTML})
|
bootstrap.Tooltip.getInstance(element).setContent({'.tooltip-inner': error[0].innerHTML})
|
||||||
element.tooltip('show');
|
element.tooltip('show');
|
||||||
element.data('errorIsVisible', true)
|
element.data('errorIsVisible', true)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log('Error Placement - Empty')
|
//console.log('Error Placement - Empty')
|
||||||
console.log(element);
|
//console.log(element);
|
||||||
if (element.data('errorIsVisible')) {
|
if (element.data('errorIsVisible')) {
|
||||||
element.tooltip('hide');
|
element.tooltip('hide');
|
||||||
element.data('errorIsVisible', false)
|
element.data('errorIsVisible', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
console.log(element);
|
//console.log(element);
|
||||||
},
|
},
|
||||||
// This success function appears to be required as errorPlacement() does not fire without the success function
|
// This success function appears to be required as errorPlacement() does not fire without the success function
|
||||||
// being defined.
|
// being defined.
|
||||||
|
|
Loading…
Reference in a new issue