Check if search is already done

fixed continuous search scroll
started working on artist/album/playlsit tabs
This commit is contained in:
RemixDev 2020-04-17 12:15:12 +02:00
parent 0bf2cef78d
commit 579d68f66a
3 changed files with 29 additions and 12 deletions

View File

@ -74,7 +74,7 @@ <h1 v-on:click="changeSearchTab(section)">{{ names[section] }}</h1>
</table>
</div>
<div v-if="section != 'TRACK' && section != 'TOP_RESULT'" class="release_grid firstrow_only">
<div v-for="release in results[section].data.slice(0, 10)" class="release">
<div v-for="release in results[section].data.slice(0, 10)" class="release" v-on:click="window[section.toLowerCase()+'View']()">
<div class="cover_container">
<img v-bind:class="(section == 'ARTIST' ? 'circle' : 'rounded') + ' coverart'" v-bind:src="(section == 'ARTIST' ? 'https://e-cdns-images.dzcdn.net/images/artist/' + release.ART_PICTURE : section == 'ALBUM' ? 'https://e-cdns-images.dzcdn.net/images/cover/' + release.ALB_PICTURE : section == 'PLAYLIST' ? 'https://e-cdns-images.dzcdn.net/images/'+ release.PICTURE_TYPE +'/' + release.PLAYLIST_PICTURE : 'https://e-cdns-images.dzcdn.net/images/cover/' ) + '/156x156-000000-80-0-0.jpg'">
<div role="button" aria-label="download" v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="'https://deezer.com/'+(section == 'ARTIST' ? 'artist/'+release.ART_ID : section == 'ALBUM' ? 'album/'+release.ALB_ID : section == 'PLAYLIST' ? 'playlist/'+release.PLAYLIST_ID : '')" class="download_overlay"><i class="material-icons">get_app</i></div>

View File

@ -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
@ -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 (

View File

@ -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()
}
}
}
})