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

@ -67,13 +67,19 @@
</aside> </aside>
<main id="main_content"> <main id="main_content">
<div id="middle_section"> <div id="middle_section">
<header id="search"><input id="searchbar" autocomplete="off" type="text" name="searchbar" value="" <header id="search">
placeholder="Search..." autofocus></header> <input id="searchbar" autocomplete="off" type="text" name="searchbar" value="" placeholder="Search..."
autofocus>
</header>
<section id="content"> <section id="content">
<div id="container"> <div id="container">
<div id="search_tab" class="main_tabcontent"> <div id="search_tab" class="main_tabcontent">
<div :class="{'hide': results.query != ''}"> <div :class="{'hide': results.query != ''}">
<h2>Start searching!</h2> <h2>Start searching!</h2>
<p>
You can search a track, a whole album, an artist, a plylist.... everything! You can also paste a
Deezer link
</p>
</div> </div>
<div :class="{'hide': results.query == ''}"> <div :class="{'hide': results.query == ''}">
<div class="tab"> <div class="tab">

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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