Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
spotify
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
web
spotify
Commits
88fc95c1
Commit
88fc95c1
authored
3 years ago
by
Benoît Harrault
Browse files
Options
Downloads
Plain Diff
Merge branch '23-add-a-pick-random-artists-button' into 'master'
Resolve "Add a "pick random artists" button" Closes
#23
See merge request
!14
parents
57451541
64e1f62e
No related branches found
No related tags found
1 merge request
!14
Resolve "Add a "pick random artists" button"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
public/js/scripts.js
+9
-0
9 additions, 0 deletions
public/js/scripts.js
template.php
+7
-4
7 additions, 4 deletions
template.php
with
16 additions
and
4 deletions
public/js/scripts.js
+
9
−
0
View file @
88fc95c1
/* pick some random artists */
function
pickRandomArtists
()
{
var
pickedArtistsCount
=
6
+
Math
.
floor
(
Math
.
random
()
*
6
);
var
artistElements
=
document
.
getElementsByClassName
(
"
checkbox-artist
"
);
for
(
var
i
=
0
;
i
<
pickedArtistsCount
;
i
++
)
{
var
random
=
Math
.
floor
(
Math
.
random
()
*
artistElements
.
length
);
artistElements
[
random
].
click
();
}
}
This diff is collapsed.
Click to expand it.
template.php
+
7
−
4
View file @
88fc95c1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
lang=
"en"
>
<head>
<meta
charset=
"utf-8"
>
...
...
@@ -9,7 +9,6 @@
<link
rel=
"icon"
type=
"image/png"
href=
"img/favicon.png"
/>
<link
rel=
"stylesheet"
href=
"css/bootstrap.min.css"
type=
"text/css"
media=
"all"
/>
<link
rel=
"stylesheet"
href=
"css/styles.css"
type=
"text/css"
media=
"all"
/>
<script
src=
"js/bootstrap.min.js"
></script>
<script
src=
"js/scripts.js"
></script>
</head>
...
...
@@ -62,7 +61,7 @@
<div
class=
"custom-control custom-checkbox"
>
<input
type=
"checkbox"
class=
"custom-control-input"
class=
"custom-control-input
checkbox-artist
"
id=
"check-top-artist-
<?php
echo
$artist
->
id
;
?>
"
name=
"selected-artist[]"
value=
"
<?php
echo
$artist
->
id
;
?>
"
...
...
@@ -92,7 +91,10 @@
</label>
</div>
<div
class=
"col-md-4 col-sm-12"
>
<button
name=
"generate-playlist-top-artists"
type=
"submit"
class=
"btn btn-secondary float-end"
>
🎶 Generate!
</button>
<div
class=
"btn-group float-end"
role=
"group"
aria-label=
"Action buttons"
>
<button
name=
"pick-random-artist"
type=
"button"
class=
"btn btn-secondary"
onclick=
"pickRandomArtists()"
>
🎲 Pick random artists
</button>
<button
name=
"generate-playlist-top-artists"
type=
"submit"
class=
"btn btn-primary float-end"
>
🎶 Generate!
</button>
</div>
</div>
</div>
</form>
...
...
@@ -145,6 +147,7 @@
</div>
<script
src=
"js/bootstrap.min.js"
></script>
</body>
</html>
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment