From d4a2798dc8332a86308c2af0cd288ca8568ea352 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kasper=20Rynning-T=C3=B8nnesen?= Date: Tue, 21 Nov 2017 17:48:25 +0100 Subject: [PATCH] Controls on mobile, and dragging - Not using #playbar anymore, since the default controls work on mobile - Removed List.dragging code, not in use anymore --- server/public/assets/js/admin.js | 3 - server/public/assets/js/list.js | 76 ----------------------- server/public/assets/js/playercontrols.js | 3 - server/public/layouts/channel.handlebars | 4 +- 4 files changed, 2 insertions(+), 84 deletions(-) diff --git a/server/public/assets/js/admin.js b/server/public/assets/js/admin.js index 0739f5cc..15f6c76e 100755 --- a/server/public/assets/js/admin.js +++ b/server/public/assets/js/admin.js @@ -158,7 +158,6 @@ var Admin = { }); } } - //List.dragging(true); if($(".tabs").length > 0 && !changing_to_frontpage) { $('ul.playlist-tabs-loggedIn').tabs('select_tab', $(".playlist-tabs li a.active").attr("href").substring(1)); } @@ -236,8 +235,6 @@ var Admin = { $(".playlist-tabs").removeClass("hide"); } - //List.dragging(false); - if($("ul.playlist-tabs-loggedIn .playlist-tab-links.active").attr("href") == "#suggestions" && $(".tabs").length > 0 && !changing_to_frontpage) { $('ul.playlist-tabs').tabs('select_tab', 'wrapper'); diff --git a/server/public/assets/js/list.js b/server/public/assets/js/list.js index 920cdf29..a807e3db 100755 --- a/server/public/assets/js/list.js +++ b/server/public/assets/js/list.js @@ -8,77 +8,6 @@ var List = { not_found: [], num_songs: 0, - dragging: function(enabled) { - if(!enabled) { - var jqDraggableItem = $(".list-song"); - try { - $(".list-song").draggable("destroy"); - } catch(e) {} - - jqDraggableItem.off("touchstart", Helper.touchstart); - jqDraggableItem.off("touchmove", Helper.touchmove); - jqDraggableItem.off("touchend", Helper.touchend); - } else { - if(Helper.mobilecheck()) { - var jqDraggableItem = $(".list-song"); - try { - $(".list-song").draggable("destroy"); - } catch(e) {} - - jqDraggableItem.off("touchstart", Helper.touchstart); - jqDraggableItem.off("touchmove", Helper.touchmove); - jqDraggableItem.off("touchend", Helper.touchend); - $( ".list-song" ).draggable({ - axis:"x", - containment: [-60, 0, 10, 0], - scroll: true, - drag: function(event, ui) { - if(Helper.vertScroll) { - return false; - } - if(ui.offset.left <= -10) { - ui.position.left = ui.offset.left; - } else { - ui.position.left = 0; - } - }, - stop: function(event, ui) { - if(ui.offset.left == -50 && !Helper.vertScroll) { - try { - navigator.vibrate = navigator.vibrate || navigator.webkitVibrate || navigator.mozVibrate || navigator.msVibrate; - if (navigator.vibrate) { - navigator.vibrate(100); - } - } catch(e) {} - $(".accept-delete").attr("data-video-id", $(this).attr("data-video-id")); - $("#delete_song_title").html($(this).find(".list-title").html()); - $("#delete_song_alert").modal("open"); - - var that = this; - $(this).addClass("side_away"); - $(this).css("left", "0px"); - setTimeout(function() { - $(that).removeClass("side_away"); - }, 300); - - } else { - var that = this; - $(this).addClass("side_away"); - $(this).css("left", "0px"); - setTimeout(function() { - $(that).removeClass("side_away"); - }, 300); - } - } - }); - - jqDraggableItem.on("touchstart", Helper.touchstart); - jqDraggableItem.on("touchmove", Helper.touchmove); - jqDraggableItem.on("touchend", Helper.touchend); - } - } - }, - channel_function: function(msg) { if(user_auth_started) { user_auth_started = false; @@ -100,7 +29,6 @@ var List = { Player.sendNext({title: full_playlist[0].title, videoId: full_playlist[0].id}); } } - //if(!w_p) List.dragging(true); break; case "added": List.added_song(msg.value); @@ -109,7 +37,6 @@ var List = { } found_array = []; found_array_index = 0; - //if(!w_p) List.dragging(true); break; case "deleted": List.deleted_song(msg.value, msg.removed); @@ -125,7 +52,6 @@ var List = { } found_array = []; found_array_index = 0; - //if(!w_p) List.dragging(true); break; case "song_change": if(window.location.pathname != "/") List.song_change(msg.time, msg.remove); @@ -134,7 +60,6 @@ var List = { } found_array = []; found_array_index = 0; - //if(!w_p) List.dragging(true); break; case "changed_values": List.changedValues(msg.value); @@ -146,7 +71,6 @@ var List = { } found_array = []; found_array_index = 0; - //if(!w_p) List.dragging(true); break; } }, diff --git a/server/public/assets/js/playercontrols.js b/server/public/assets/js/playercontrols.js index 697314e7..a19a3781 100755 --- a/server/public/assets/js/playercontrols.js +++ b/server/public/assets/js/playercontrols.js @@ -3,9 +3,6 @@ var Playercontrols = { stopInterval: false, initYoutubeControls: function() { - if(Helper.mobilecheck() && !window.MSStream) { - $("#controls").appendTo("#playbar"); - } Playercontrols.initControls(); }, diff --git a/server/public/layouts/channel.handlebars b/server/public/layouts/channel.handlebars index a6411faa..d461af22 100755 --- a/server/public/layouts/channel.handlebars +++ b/server/public/layouts/channel.handlebars @@ -8,7 +8,7 @@ {{> channel/players}} {{> channel/tabs}} -
-
+