From ba83c36c1c0424bf42a45684e13ab1263d317c19 Mon Sep 17 00:00:00 2001 From: jcorporation Date: Sun, 29 Jul 2018 23:19:35 +0100 Subject: [PATCH] fix: get outputnames after websocket reconnect --- htdocs/js/mpd.js | 5 +++-- htdocs/js/mpd.min.js | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index b76fc39..5c5bc5e 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -609,6 +609,7 @@ function webSocketConnect() { showNotification('Connected to myMPD', '', '', 'success'); modalConnectionError.hide(); appRoute(); + sendAPI({"cmd":"MPD_API_GET_OUTPUTNAMES"}, parseOutputnames); } socket.onmessage = function got_packet(msg) { @@ -646,8 +647,8 @@ function webSocketConnect() { console.log('disconnected'); modalConnectionError.show(); setTimeout(function() { - console.log('reconnect'); - webSocketConnect(); + console.log('reconnect'); + webSocketConnect(); }, 3000); } diff --git a/htdocs/js/mpd.min.js b/htdocs/js/mpd.min.js index 9d4810d..5a6b387 100644 --- a/htdocs/js/mpd.min.js +++ b/htdocs/js/mpd.min.js @@ -44,8 +44,8 @@ b.nodeName&&b.classList.remove("dragover")},!1);b.addEventListener("dragover",fu document.getElementById(a.dataTransfer.getData("Text")).classList.remove("opacity05")},!1);b.addEventListener("drop",function(c){c.stopPropagation();c.preventDefault();var e=c.target;"TD"==c.target.nodeName&&(e=c.target.parentNode);var d=document.getElementById(c.dataTransfer.getData("Text")).getAttribute("data-songpos"),f=e.getAttribute("data-songpos");document.getElementById(c.dataTransfer.getData("Text")).remove();dragEl.classList.remove("opacity05");b.insertBefore(dragEl,e);c=b.querySelectorAll(".dragover"); e=c.length;for(var g=0;g