diff --git a/public/index.html b/public/index.html index c616925..07f5684 100644 --- a/public/index.html +++ b/public/index.html @@ -74,7 +74,7 @@

{{ names[section] }}

-
+
get_app
diff --git a/public/js/app/app.js b/public/js/app/app.js index 2a5944c..1ca24db 100644 --- a/public/js/app/app.js +++ b/public/js/app/app.js @@ -2,8 +2,8 @@ const socket = io.connect(window.location.href) localStorage = window.localStorage // tabs stuff -let search_selected = '' -let main_selected = '' +search_selected = '' +main_selected = '' // toasts stuff let toastsWithId = {} // settings @@ -197,7 +197,7 @@ function saveSettings(){ // tabs stuff function changeTab(evt, section, tabName) { console.log( {evt, section, tabName} ); - + var i, tabcontent, tablinks tabcontent = document.getElementsByClassName(section + '_tabcontent') for (i = 0; i < tabcontent.length; i++) { @@ -212,6 +212,7 @@ function changeTab(evt, section, tabName) { } document.getElementById(tabName).style.display = 'block' window[section + '_selected'] = tabName + console.log(section + '_selected', window[section + '_selected']) evt.currentTarget.className += ' active' // Check if you need to load more content in the search tab if ( diff --git a/public/js/app/search.js b/public/js/app/search.js index 6283832..c18e1e4 100644 --- a/public/js/app/search.js +++ b/public/js/app/search.js @@ -22,6 +22,16 @@ function scrolledSearch(vueTab) { } } +function artistView(){ + console.log("ARTIST") +} +function albumView(){ + console.log("ALBUM") +} +function playlistView(){ + console.log("PLAYLIST") +} + function searchUpadate(result) { console.log(result) vueTab = null @@ -82,7 +92,7 @@ let MainSearch = new Vue({ changeSearchTab(section) { if (section != 'TOP_RESULT') clickElement('search_' + section.toLowerCase() + '_tab') }, - addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + addToQueue: function(e){e.stopPropagation(); sendAddToQueue(e.currentTarget.dataset.link)}, openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -100,7 +110,7 @@ var trackSearch = new Vue({ } }, methods: { - addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + addToQueue: function(e){e.stopPropagation(); sendAddToQueue(e.currentTarget.dataset.link)}, openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -118,7 +128,7 @@ var albumSearch = new Vue({ } }, methods: { - addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + addToQueue: function(e){e.stopPropagation(); sendAddToQueue(e.currentTarget.dataset.link)}, openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -136,7 +146,7 @@ var artistSearch = new Vue({ } }, methods: { - addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + addToQueue: function(e){e.stopPropagation(); sendAddToQueue(e.currentTarget.dataset.link)}, openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -154,7 +164,7 @@ var playlistSearch = new Vue({ } }, methods: { - addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + addToQueue: function(e){e.stopPropagation(); sendAddToQueue(e.currentTarget.dataset.link)}, openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -172,8 +182,14 @@ $("#searchbar").keyup(function(e){ sendAddToQueue(term); } }else{ - document.getElementById("search_tab_content").style.display = "none"; - socket.emit("mainSearch", {term: term}); + if (term != MainSearch.results.QUERY || main_selected == 'search_tab'){ + document.getElementById("search_tab_content").style.display = "none"; + socket.emit("mainSearch", {term: term}); + }else{ + document.getElementById('search_all_tab').click() + document.getElementById('search_tab_content').style.display = 'block' + document.getElementById('main_search_tablink').click() + } } } }) @@ -195,4 +211,4 @@ function mainSearchHandler(result) { socket.on('mainSearch', function (result) { mainSearchHandler(result) -}) \ No newline at end of file +})