moved scroll on top on country selection in charts tab; prevented empty search in frontend

This commit is contained in:
Roberto Tonino
2020-05-14 19:59:05 +02:00
parent 88b51c09ac
commit 370609d284
6 changed files with 35 additions and 22 deletions

View File

@@ -30,6 +30,8 @@ const ChartsTab = new Vue({
QualityModal.open(e.currentTarget.dataset.link)
},
getTrackList(e) {
document.getElementById('content').scrollTo(0, 0)
this.country = e.currentTarget.dataset.title
localStorage.setItem('chart', this.country)
this.id = e.currentTarget.dataset.id

View File

@@ -90,6 +90,7 @@ const MainSearch = new Vue({
numberWithDots: Utils.numberWithDots,
convertDuration: Utils.convertDuration,
search(type) {
console.log('searcho')
socket.emit('search', {
term: this.results.query,
type: type,

View File

@@ -25,27 +25,31 @@ function handleContentScroll(event) {
}
function handleSearchBarKeyup(e) {
if (e.keyCode == 13) {
let term = this.value
if (Utils.isValidURL(term)) {
if (e.ctrlKey) {
QualityModal.open(term)
} else {
if (window.main_selected == 'analyzer_tab') {
Tabs.analyzeLink(term)
} else {
Downloads.sendAddToQueue(term)
}
}
// Enter key
if (e.keyCode !== 13) return
let term = this.value
if (Utils.isValidURL(term)) {
if (e.ctrlKey) {
QualityModal.open(term)
} else {
if (term != MainSearch.query || main_selected == 'search_tab') {
document.getElementById('search_tab_content').style.display = 'none'
socket.emit('mainSearch', { term: term })
if (window.main_selected == 'analyzer_tab') {
Tabs.analyzeLink(term)
} else {
document.getElementById('search_tab_content').style.display = 'block'
document.getElementById('main_search_tablink').click()
Downloads.sendAddToQueue(term)
}
}
} else {
if (term === '') return
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_tab_content').style.display = 'block'
document.getElementById('main_search_tablink').click()
}
}
}