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>
<main id="main_content">
<div id="middle_section">
<header id="search"><input id="searchbar" autocomplete="off" type="text" name="searchbar" value=""
placeholder="Search..." autofocus></header>
<header id="search">
<input id="searchbar" autocomplete="off" type="text" name="searchbar" value="" placeholder="Search..."
autofocus>
</header>
<section id="content">
<div id="container">
<div id="search_tab" class="main_tabcontent">
<div :class="{'hide': results.query != ''}">
<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 :class="{'hide': results.query == ''}">
<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)
},
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,8 +25,11 @@ function handleContentScroll(event) {
}
function handleSearchBarKeyup(e) {
if (e.keyCode == 13) {
// Enter key
if (e.keyCode !== 13) return
let term = this.value
if (Utils.isValidURL(term)) {
if (e.ctrlKey) {
QualityModal.open(term)
@ -38,7 +41,9 @@ function handleSearchBarKeyup(e) {
}
}
} else {
if (term != MainSearch.query || main_selected == 'search_tab') {
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 {
@ -46,7 +51,6 @@ function handleSearchBarKeyup(e) {
document.getElementById('main_search_tablink').click()
}
}
}
}
export default {