diff --git a/webapp/assets/js/mstream.js b/webapp/assets/js/mstream.js
index 73f8734..1f7bb43 100644
--- a/webapp/assets/js/mstream.js
+++ b/webapp/assets/js/mstream.js
@@ -173,7 +173,7 @@ function createFileplaylistHtml(dataDirectory) {
\
\
\
- \
+ \
\
\
\
@@ -333,15 +333,6 @@ function getFileExplorerPath() {
return fileExplorerArray.join("/") + "/";
}
-function getDirectoryString(component) {
- var newString = getFileExplorerPath() + component.data("directory");
- if (newString.substring(0,1) !== '/') {
- newString = "/" + newString
- }
-
- return newString;
-}
-
function getDirectoryString2(component) {
var newString = getFileExplorerPath() + component.getAttribute("data-directory");
if (newString.substring(0,1) !== '/') {
@@ -742,7 +733,7 @@ function getAlbumSongs(album, artist) {
function getRecentlyAdded(el) {
setBrowserRootPanel(el, 'Recently Added', 'scrollBoxHeight1');
document.getElementById('filelist').innerHTML = getLoadingSvg();
- document.getElementById('directoryName').innerHTML = 'Get last songs';
+ document.getElementById('directoryName').innerHTML = 'Get last songs';
redoRecentlyAdded();
}
@@ -775,6 +766,12 @@ function redoRecentlyAdded() {
});
}
+function submitRecentlyAdded() {
+ if (event.keyCode === 13) {
+ document.getElementById("recently-added-limit").blur();
+ }
+}
+
////////////// Rated Songs
function getRatedSongs(el) {
setBrowserRootPanel(el, 'Starred', 'scrollBoxHeight1');
@@ -1187,9 +1184,21 @@ function recursiveFileDownload(el) {
document.getElementById('downform').innerHTML = '';
}
-$("#filelist").on('click', '.downloadDir', function () {
+function downloadFileplaylist(el) {
+ const directoryString = getDirectoryString2(el);
+ document.getElementById('downform').action = "/api/v1/download/directory?token=" + MSTREAMAPI.currentServer.token;
+
+ let input = document.createElement("INPUT");
+ input.type = 'hidden';
+ input.name = 'path';
+ input.value = playlistPath;
+ document.getElementById('downform').appendChild(input);
-});
+ //submit form
+ document.getElementById('downform').submit();
+ // clear the form
+ document.getElementById('downform').innerHTML = '';
+}
/////////////////////// Buttons
function onBackButton() {
@@ -1373,34 +1382,6 @@ $(document).ready(function () {
});
}
- $("#filelist").on('click', '.downloadFileplaylist', function () {
- var playlistPath = getDirectoryString($(this));
-
- // Use key if necessary
- $("#downform").attr("action", "/fileplaylist/download?token=" + MSTREAMAPI.currentServer.token);
-
- $('').attr({
- type: 'hidden',
- name: 'path',
- value: playlistPath,
- }).appendTo('#downform');
-
- //submit form
- $('#downform').submit();
- // clear the form
- $('#downform').empty();
- });
-
- $('#libraryColumn').on('keydown', '#recently-added-limit', function(e) {
- if(e.keyCode===13){
- $( "#recently-added-limit" ).blur();
- }
- });
-
- $('#libraryColumn').on('focusout', '#recently-added-limit', function() {
- redoRecentlyAdded();
- });
-
//////////////////////// Auto DJ
$('#filelist').on('click', 'input[name="autodj-folders"]', function(){
// Don't allow user to deselct all options
diff --git a/webapp/index.html b/webapp/index.html
index 3f3f150..b22f375 100644
--- a/webapp/index.html
+++ b/webapp/index.html
@@ -246,7 +246,7 @@