Merge pull request #469 from zoff-music/feature/intelligent-mobile

Added intelligent playlist on mobile also
This commit is contained in:
Kasper Rynning-Tønnesen
2019-01-21 17:43:07 +01:00
committed by GitHub
4 changed files with 31 additions and 2 deletions

View File

@@ -21,6 +21,13 @@ function removeAllListeners() {
socket.removeEventListener(id); socket.removeEventListener(id);
} }
function say_updated() {
setTimeout(function() {
before_toast();
M.toast({html: "The list was updated, want to refresh? <a class='waves-effect waves-light btn light-green' href='#' id='refresh_mobile' style='cursor:pointer;pointer-events:all;margin-left:10px;'> yes</a><a class='waves-effect waves-light btn red lighten' id='dont_refresh_list' style='cursor:pointer;pointer-events:all;margin-left:10px;'>no</a>", displayLength: 10000000});
}, 500);
}
function sendDescription() { function sendDescription() {
emit("suggest_description", {channel: chan, description: document.getElementById("description_input").value}); emit("suggest_description", {channel: chan, description: document.getElementById("description_input").value});
document.getElementById("description_input").value = ""; document.getElementById("description_input").value = "";

View File

@@ -406,6 +406,9 @@ var List = {
type: "add", type: "add",
element: added, element: added,
}); });
if(Helper.mobilecheck()) {
say_updated();
}
} else { } else {
List.insertAtIndex(added, true); List.insertAtIndex(added, true);
Helper.css(document.querySelector("#wrapper").children[List.page + List.can_fit], "display", "none"); Helper.css(document.querySelector("#wrapper").children[List.page + List.can_fit], "display", "none");
@@ -432,6 +435,9 @@ var List = {
element: full_playlist[index], element: full_playlist[index],
index: index, index: index,
}); });
if(Helper.mobilecheck()) {
say_updated();
}
if(index != -1) full_playlist.splice(index, 1); if(index != -1) full_playlist.splice(index, 1);
var this_element = document.getElementById(deleted); var this_element = document.getElementById(deleted);
Helper.addClass(this_element, "disabled-vote"); Helper.addClass(this_element, "disabled-vote");
@@ -547,6 +553,9 @@ var List = {
element: song_voted_on element: song_voted_on
}); });
List.sortList(); List.sortList();
if(Helper.mobilecheck()) {
say_updated();
}
} else { } else {
List.sortList(); List.sortList();
Helper.removeElement("#"+voted); Helper.removeElement("#"+voted);

View File

@@ -451,6 +451,19 @@ function addDynamicListeners() {
} }
}); });
if(Helper.mobilecheck()) {
addListener("click", "#refresh_mobile", function(event) {
this.preventDefault();
clearIntelligentQueue();
before_toast();
});
addListener("click", "#dont_refresh_list", function(event) {
this.preventDefault();
before_toast();
});
}
addListener("click", "#player_overlay", function(event) { addListener("click", "#player_overlay", function(event) {
if(chromecastAvailable) { if(chromecastAvailable) {
Player.playPauseVideo(); Player.playPauseVideo();

View File

@@ -4,7 +4,7 @@
</div> </div>
<div class="collapsible-body info_collapsible"> <div class="collapsible-body info_collapsible">
<ul> <ul>
<li class="hide-on-small-only hide-on-mobile-only"> <li class="">
<span class="switch-text"> <span class="switch-text">
Intelligent Intelligent
</span> </span>
@@ -77,7 +77,7 @@
<li> <li>
<div class="row"> <div class="row">
<div class="col s10 offset-s1"> <div class="col s10 offset-s1">
<p class="initial-line-height hide-on-mobile-only hide-on-small-only"> <p class="initial-line-height">
When enabling intelligent playlist, playlist elements are not updated and moved around when the playlist is in focus. If things are jumping too much around in the playlist when voting, you should enable this. When enabling intelligent playlist, playlist elements are not updated and moved around when the playlist is in focus. If things are jumping too much around in the playlist when voting, you should enable this.
</p> </p>
{{#unless client}} {{#unless client}}