Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
LQDN Adminsys
generateur-slogans
Commits
df01a7e3
Verified
Commit
df01a7e3
authored
Nov 20, 2017
by
Thibaut Broggi
Browse files
Prevent user from selecting two identical colors (close
#12
)
parent
4d33a8a2
Pipeline
#1666
passed with stage
in 49 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
static/canvas.js
View file @
df01a7e3
...
...
@@ -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
].
on
change
=
draw
;
inputs
[
i
].
addEventListener
(
'
change
'
,
draw
)
;
}
document
.
getElementById
(
'
step2value
'
).
oninput
=
draw
;
document
.
getElementById
(
'
signature
'
).
oninput
=
draw
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment