Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
djrandom-py
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
ale
djrandom-py
Commits
9bbbd471
Commit
9bbbd471
authored
13 years ago
by
ale
Browse files
Options
Downloads
Patches
Plain Diff
add an icon/action for "more like this" search on each song
parent
8dfafd5c
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
server/djrandom/frontend/static/js/djr/player.js
+15
-0
15 additions, 0 deletions
server/djrandom/frontend/static/js/djr/player.js
server/djrandom/frontend/templates/_macros.html
+1
-0
1 addition, 0 deletions
server/djrandom/frontend/templates/_macros.html
with
16 additions
and
0 deletions
server/djrandom/frontend/static/js/djr/player.js
+
15
−
0
View file @
9bbbd471
...
...
@@ -192,6 +192,17 @@ djr.Player.prototype.autoExtendCurrentPlaylist = function(callback) {
});
};
// Extend the current playlist with the results of a MoreLikeThis
// search based on a single selected song.
djr
.
Player
.
prototype
.
moreLikeThis
=
function
(
sha1
)
{
var
player
=
this
;
var
songs
=
[
sha1
];
this
.
backend
.
moreLikeThese
(
songs
,
function
(
results
)
{
player
.
createChunk
(
results
,
'
like that
'
);
});
};
djr
.
Player
.
prototype
.
createChunk
=
function
(
songs
,
chunk_title
)
{
// Create the new chunk, with unique songs.
var
chunk
=
this
.
playlist
.
createUniqueChunk
(
songs
,
chunk_title
);
...
...
@@ -263,6 +274,10 @@ djr.Player.prototype.setChunkHtml = function(chunk, chunk_id, songs_html) {
var
sha1
=
$
(
this
).
parent
().
parent
().
attr
(
'
id
'
).
substr
(
5
);
player
.
removeSong
(
sha1
);
});
chunk_div
.
find
(
'
.chunk_inner .ctlbox .ctl_love
'
).
click
(
function
()
{
var
sha1
=
$
(
this
).
parent
().
parent
().
attr
(
'
id
'
).
substr
(
5
);
player
.
moreLikeThis
(
sha1
);
});
};
// Start playing a specific song.
...
...
This diff is collapsed.
Click to expand it.
server/djrandom/frontend/templates/_macros.html
+
1
−
0
View file @
9bbbd471
{% macro render_song(mp3) -%}
<div
class=
"song"
id=
"song_{{ mp3.sha1 }}"
>
<div
class=
"ctlbox"
style=
"display:none;"
>
<a
id=
"song_{{ mp3.sha1 }}_mlt"
class=
"ctl_btn ctl_love"
></a>
<a
id=
"song_{{ mp3.sha1 }}_remove"
class=
"ctl_btn ctl_remove"
></a>
</div>
<a
id=
"play_{{ mp3.sha1 }}"
class=
"song_a"
>
...
...
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