diff --git a/server/public/assets/css/style.css b/server/public/assets/css/style.css index cc57cf3f..1a43c37e 100755 --- a/server/public/assets/css/style.css +++ b/server/public/assets/css/style.css @@ -390,6 +390,10 @@ li.disabled span { margin: auto; } +.category-advanced { + margin-top: 0px; +} + .bottom-filter-container { padding-top: 15px; } diff --git a/server/public/assets/js/channel.js b/server/public/assets/js/channel.js index b2d17303..d56eb553 100644 --- a/server/public/assets/js/channel.js +++ b/server/public/assets/js/channel.js @@ -153,6 +153,8 @@ var Channel = { document.getElementById("filtersearch_input").focus(); } }); + + M.FormSelect.init(document.querySelector('.category-advanced-select')); M.Modal.init(document.getElementById("help")); M.Modal.init(document.getElementById("contact")); M.Modal.init(document.getElementById("channel-share-modal")); diff --git a/server/public/assets/js/functions.js b/server/public/assets/js/functions.js index e14e1f88..e1d57111 100644 --- a/server/public/assets/js/functions.js +++ b/server/public/assets/js/functions.js @@ -23,6 +23,11 @@ function removeAllListeners() { function filterPlaylistElements(page) { var value = document.getElementById("filtersearch_input").value; + var search_type = document.querySelector(".category-advanced-select").value; + if(search_type != "category" && search_type != "title") { + document.querySelector(".filter-results").innerHTML = "Something went wrong with fetching data.."; + return; + } if(value == "") return; Helper.ajax({ type: "POST", @@ -32,8 +37,8 @@ function filterPlaylistElements(page) { url: "/api/search/" + chan.toLowerCase(), data: { searchQuery: value, - token: zoff_api_token, - page: page + page: page, + type: search_type }, success: function(data){ var json = JSON.parse(data); @@ -49,10 +54,14 @@ function filterPlaylistElements(page) { document.querySelector(".filter-results").innerHTML = "Couldn't find any items with those tags.."; } }, - error: function() { - toast("Couldn't find any items with those tags..", "red"); + error: function(e) { + if(e.status != 429) { + toast("Couldn't find any items with those tags..", "red"); - document.querySelector(".filter-results").innerHTML = "Couldn't find any items with those tags.."; + document.querySelector(".filter-results").innerHTML = "Couldn't find any items with those tags.."; + } else { + toast("You are doing that too much..", "red"); + } } }); } diff --git a/server/public/partials/channel/modal.handlebars b/server/public/partials/channel/modal.handlebars index a7662c23..9218d69a 100644 --- a/server/public/partials/channel/modal.handlebars +++ b/server/public/partials/channel/modal.handlebars @@ -1,43 +1,43 @@ {{#unless client}} -