Check if search is already done
fixed continuous search scroll started working on artist/album/playlsit tabs
This commit is contained in:
		
							parent
							
								
									0bf2cef78d
								
							
						
					
					
						commit
						579d68f66a
					
				@ -74,7 +74,7 @@
 | 
				
			|||||||
											</table>
 | 
																</table>
 | 
				
			||||||
										</div>
 | 
															</div>
 | 
				
			||||||
										<div v-if="section != 'TRACK' && section != 'TOP_RESULT'" class="release_grid firstrow_only">
 | 
															<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">
 | 
																	<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'">
 | 
																		<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>
 | 
																		<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>
 | 
				
			||||||
 | 
				
			|||||||
@ -2,8 +2,8 @@
 | 
				
			|||||||
const socket = io.connect(window.location.href)
 | 
					const socket = io.connect(window.location.href)
 | 
				
			||||||
localStorage = window.localStorage
 | 
					localStorage = window.localStorage
 | 
				
			||||||
// tabs stuff
 | 
					// tabs stuff
 | 
				
			||||||
let search_selected = ''
 | 
					search_selected = ''
 | 
				
			||||||
let main_selected = ''
 | 
					main_selected = ''
 | 
				
			||||||
// toasts stuff
 | 
					// toasts stuff
 | 
				
			||||||
let toastsWithId = {}
 | 
					let toastsWithId = {}
 | 
				
			||||||
// settings
 | 
					// settings
 | 
				
			||||||
@ -197,7 +197,7 @@ function saveSettings(){
 | 
				
			|||||||
// tabs stuff
 | 
					// tabs stuff
 | 
				
			||||||
function changeTab(evt, section, tabName) {
 | 
					function changeTab(evt, section, tabName) {
 | 
				
			||||||
	console.log( {evt, section, tabName} );
 | 
						console.log( {evt, section, tabName} );
 | 
				
			||||||
	
 | 
					
 | 
				
			||||||
	var i, tabcontent, tablinks
 | 
						var i, tabcontent, tablinks
 | 
				
			||||||
	tabcontent = document.getElementsByClassName(section + '_tabcontent')
 | 
						tabcontent = document.getElementsByClassName(section + '_tabcontent')
 | 
				
			||||||
	for (i = 0; i < tabcontent.length; i++) {
 | 
						for (i = 0; i < tabcontent.length; i++) {
 | 
				
			||||||
@ -212,6 +212,7 @@ function changeTab(evt, section, tabName) {
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
	document.getElementById(tabName).style.display = 'block'
 | 
						document.getElementById(tabName).style.display = 'block'
 | 
				
			||||||
	window[section + '_selected'] = tabName
 | 
						window[section + '_selected'] = tabName
 | 
				
			||||||
 | 
						console.log(section + '_selected', window[section + '_selected'])
 | 
				
			||||||
	evt.currentTarget.className += ' active'
 | 
						evt.currentTarget.className += ' active'
 | 
				
			||||||
	// Check if you need to load more content in the search tab
 | 
						// Check if you need to load more content in the search tab
 | 
				
			||||||
	if (
 | 
						if (
 | 
				
			||||||
 | 
				
			|||||||
@ -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) {
 | 
					function searchUpadate(result) {
 | 
				
			||||||
	console.log(result)
 | 
						console.log(result)
 | 
				
			||||||
	vueTab = null
 | 
						vueTab = null
 | 
				
			||||||
@ -82,7 +92,7 @@ let MainSearch = new Vue({
 | 
				
			|||||||
		changeSearchTab(section) {
 | 
							changeSearchTab(section) {
 | 
				
			||||||
			if (section != 'TOP_RESULT') clickElement('search_' + section.toLowerCase() + '_tab')
 | 
								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)}
 | 
							openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
@ -100,7 +110,7 @@ var trackSearch = new Vue({
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	methods: {
 | 
						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)}
 | 
							openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
@ -118,7 +128,7 @@ var albumSearch = new Vue({
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	methods: {
 | 
						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)}
 | 
							openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
@ -136,7 +146,7 @@ var artistSearch = new Vue({
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	methods: {
 | 
						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)}
 | 
							openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
@ -154,7 +164,7 @@ var playlistSearch = new Vue({
 | 
				
			|||||||
		}
 | 
							}
 | 
				
			||||||
	},
 | 
						},
 | 
				
			||||||
	methods: {
 | 
						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)}
 | 
							openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
@ -172,8 +182,14 @@ $("#searchbar").keyup(function(e){
 | 
				
			|||||||
        sendAddToQueue(term);
 | 
					        sendAddToQueue(term);
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }else{
 | 
					    }else{
 | 
				
			||||||
			document.getElementById("search_tab_content").style.display = "none";
 | 
								if (term != MainSearch.results.QUERY || main_selected == 'search_tab'){
 | 
				
			||||||
			socket.emit("mainSearch", {term: term});
 | 
									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) {
 | 
					socket.on('mainSearch', function (result) {
 | 
				
			||||||
	mainSearchHandler(result)
 | 
						mainSearchHandler(result)
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user