Skip to content
GitLab
Menu
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
cf60df09
Verified
Commit
cf60df09
authored
Oct 02, 2017
by
Thibaut Broggi
Browse files
Avoid identical colors being chosen on random
close
#4
parent
8a5e28d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
canvas.js
View file @
cf60df09
...
...
@@ -129,7 +129,10 @@ let randomElement = function(selector) {
document
.
getElementById
(
'
randomize
'
).
onclick
=
function
(
e
)
{
randomElement
(
'
input[name="bg-color"]
'
).
checked
=
true
;
randomElement
(
'
input[name="fg-color"]
'
).
checked
=
true
;
do
{
randomElement
(
'
input[name="fg-color"]
'
).
checked
=
true
;
}
while
(
document
.
querySelector
(
'
.colorpicker input[type="radio"][name="bg-color"]:checked
'
).
value
==
document
.
querySelector
(
'
.colorpicker input[type="radio"][name="fg-color"]:checked
'
).
value
);
randomElement
(
'
input[name="font"]
'
).
checked
=
true
;
randomElement
(
'
input[name="icon"]
'
).
checked
=
true
;
document
.
getElementById
(
'
step2value
'
).
value
=
document
.
getElementById
(
'
step2value
'
).
innerText
=
sampleTexts
[
Math
.
trunc
(
Math
.
random
()
*
sampleTexts
.
length
)];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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