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
0508c054
Verified
Commit
0508c054
authored
Sep 27, 2017
by
Thibaut Broggi
Browse files
Add randomize button. It needs more work (see
#4
)
parent
55c7c866
Changes
2
Show whitespace changes
Inline
Side-by-side
canvas.js
View file @
0508c054
...
...
@@ -106,3 +106,15 @@ window.onload = function() {
let
hash
=
window
.
location
.
hash
||
'
#step1
'
;
document
.
querySelector
(
'
nav > a[href="
'
+
hash
+
'
"]
'
).
click
();
}
let
randomElement
=
function
(
selector
)
{
let
elems
=
document
.
querySelectorAll
(
selector
);
return
elems
[
Math
.
round
(
Math
.
random
()
*
elems
.
length
)];
}
document
.
getElementById
(
'
randomize
'
).
onclick
=
function
(
e
)
{
randomElement
(
'
input[name="bg-color"]
'
).
click
();
randomElement
(
'
input[name="fg-color"]
'
).
click
();
randomElement
(
'
input[name="font"]
'
).
click
();
draw
();
}
index.html
View file @
0508c054
...
...
@@ -19,7 +19,7 @@
</nav>
<div
id=
"inputs"
>
<div>
<button
id=
"randomize"
>
CHOISIR AU HASARD
</button>
<button
id=
"randomize"
>
CHOISIR AU HASARD
<span
class=
"fa fa-random"
></span>
</button>
</div>
<div
id=
"step1"
>
<h2>
Choisissez la couleur de fond
</h2>
...
...
Write
Preview
Markdown
is supported
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