Prevent user from selecting two identical colors (close #12)

parent 4d33a8a2
Pipeline #1666 passed with stage
in 49 seconds
......@@ -166,10 +166,20 @@ window.addEventListener('load', function() {
if (params['signature'])
document.getElementById('signature').value = params['signature'];
// Prevent user from selecting two identical colors
let inputs = document.querySelectorAll('.colorpicker input[type="radio"]');
for (let i = 0; i < inputs.length; ++i) {
inputs[i].addEventListener('click', function(e) {
if (document.querySelector('.colorpicker input[type="radio"][name="bgColor"]:checked').value
== document.querySelector('.colorpicker input[type="radio"][name="fgColor"]:checked').value)
e.preventDefault();
});
}
// Add event listeners to inputs
let inputs = document.querySelectorAll('.colorpicker input[type="radio"], #step3 input[type="radio"], input[type="radio"][name="icon"]');
inputs = document.querySelectorAll('.colorpicker input[type="radio"], #step3 input[type="radio"], input[type="radio"][name="icon"]');
for (let i = 0; i < inputs.length; ++i) {
inputs[i].onchange = draw;
inputs[i].addEventListener('change', draw);
}
document.getElementById('step2value').oninput = draw;
document.getElementById('signature').oninput = draw;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment