added global alias for js folders, removed modules folder in js

This commit is contained in:
Roberto Tonino 2020-06-24 19:10:10 +02:00
parent e32b7b7959
commit 2cb0986928
23 changed files with 117 additions and 100 deletions

1
.gitignore vendored
View file

@ -3,6 +3,7 @@ __pycache__
.DS_Store
node_modules
jsconfig.json
# pyinstaller build dirs
/dist

File diff suppressed because one or more lines are too long

View file

@ -25,6 +25,14 @@ export default {
{
find: 'vue',
replacement: 'vue/dist/vue.esm'
},
{
find: '@',
replacement: __dirname + '/src'
},
{
find: '@components',
replacement: __dirname + '/src/js/components'
}
]
}),

View file

@ -1,25 +1,27 @@
// Global Vue components
import './modules/components/LoadingPlaceholder.js'
import '@components/LoadingPlaceholder.js'
// Vue views components
import './modules/components/artist-tab.js'
import './modules/components/charts-tab.js'
import './modules/components/errors-tab.js'
import './modules/components/favorites-tab.js'
import './modules/components/home-tab.js'
import './modules/components/link-analyzer-tab.js'
import './modules/components/main-search.js'
import './modules/components/settings-tab.js'
import './modules/components/tracklist-tab.js'
import '@components/artist-tab.js'
import '@components/charts-tab.js'
import '@components/errors-tab.js'
import '@components/favorites-tab.js'
import '@components/home-tab.js'
import '@components/link-analyzer-tab.js'
import '@components/main-search.js'
import '@components/settings-tab.js'
import '@components/tracklist-tab.js'
import '@components/TestComponent.vue'
import $ from 'jquery'
import { socket } from './modules/socket.js'
import { toast } from './modules/toasts.js'
import Downloads from './modules/downloads.js'
import QualityModal from './modules/quality-modal.js'
import Tabs from './modules/tabs.js'
import Search from './modules/search.js'
import TrackPreview from './modules/track-preview.js'
import { socket } from '@/js/socket.js'
import { toast } from '@/js/toasts.js'
import Downloads from '@/js/downloads.js'
import QualityModal from '@/js/quality-modal.js'
import Tabs from '@/js/tabs.js'
import Search from '@/js/search.js'
import TrackPreview from '@/js/track-preview.js'
/* ===== App initialization ===== */
@ -61,15 +63,15 @@ function setCurrentUserTheme() {
/* ===== Socketio listeners ===== */
// Debug messages for socketio
socket.on('message', function (msg) {
socket.on('message', function(msg) {
console.log(msg)
})
socket.on('logging_in', function () {
socket.on('logging_in', function() {
toast('Logging in', 'loading', false, 'login-toast')
})
socket.on('init_autologin', function () {
socket.on('init_autologin', function() {
let arl = localStorage.getItem('arl')
let accountNum = localStorage.getItem('accountNum')
if (arl) {
@ -82,7 +84,7 @@ socket.on('init_autologin', function () {
}
})
socket.on('logged_in', function (data) {
socket.on('logged_in', function(data) {
switch (data.status) {
case 1:
case 3:
@ -130,7 +132,7 @@ socket.on('logged_in', function (data) {
}
})
socket.on('logged_out', function () {
socket.on('logged_out', function() {
toast('Logged out', 'done', true, 'login-toast')
localStorage.removeItem('arl')
$('#login_input_arl').val('')
@ -141,34 +143,34 @@ socket.on('logged_out', function () {
document.getElementById('home_not_logged_in').classList.remove('hide')
})
socket.on('cancellingCurrentItem', function (uuid) {
socket.on('cancellingCurrentItem', function(uuid) {
toast('Cancelling current item.', 'loading', false, 'cancelling_' + uuid)
})
socket.on('currentItemCancelled', function (uuid) {
socket.on('currentItemCancelled', function(uuid) {
toast('Current item cancelled.', 'done', true, 'cancelling_' + uuid)
})
socket.on('startAddingArtist', function (data) {
socket.on('startAddingArtist', function(data) {
toast(`Adding ${data.name} albums to queue`, 'loading', false, 'artist_' + data.id)
})
socket.on('finishAddingArtist', function (data) {
socket.on('finishAddingArtist', function(data) {
toast(`Added ${data.name} albums to queue`, 'done', true, 'artist_' + data.id)
})
socket.on('startConvertingSpotifyPlaylist', function (id) {
socket.on('startConvertingSpotifyPlaylist', function(id) {
toast('Converting spotify tracks to deezer tracks', 'loading', false, 'spotifyplaylist_' + id)
})
socket.on('finishConvertingSpotifyPlaylist', function (id) {
socket.on('finishConvertingSpotifyPlaylist', function(id) {
toast('Spotify playlist converted', 'done', true, 'spotifyplaylist_' + id)
})
socket.on('errorMessage', function (error) {
socket.on('errorMessage', function(error) {
toast(error, 'error')
})
socket.on('alreadyInQueue', function (data) {
socket.on('alreadyInQueue', function(data) {
toast(`${data.title} is already in queue!`, 'playlist_add_check')
})

View file

@ -1,9 +1,9 @@
import { isEmpty, orderBy } from 'lodash-es'
import Vue from 'vue'
import { socket } from '../socket.js'
import Downloads from '../downloads.js'
import QualityModal from '../quality-modal.js'
import { showView } from '../tabs.js'
import { socket } from '@/js/socket.js'
import Downloads from '@/js/downloads.js'
import QualityModal from '@/js/quality-modal.js'
import { showView } from '@/js/tabs.js'
const ArtistTab = new Vue({
data() {

View file

@ -1,10 +1,10 @@
import Vue from 'vue'
import { socket } from '../socket.js'
import { showView } from '../tabs.js'
import Downloads from '../downloads.js'
import QualityModal from '../quality-modal.js'
import TrackPreview from '../track-preview.js'
import Utils from '../utils.js'
import { socket } from '@/js/socket.js'
import { showView } from '@/js/tabs.js'
import Downloads from '@/js/downloads.js'
import QualityModal from '@/js/quality-modal.js'
import TrackPreview from '@/js/track-preview.js'
import Utils from '@/js/utils.js'
const ChartsTab = new Vue({
data() {

View file

@ -1,11 +1,11 @@
import Vue from 'vue'
import { socket } from '../socket.js'
import { showView } from '../tabs.js'
import Downloads from '../downloads.js'
import QualityModal from '../quality-modal.js'
import TrackPreview from '../track-preview.js'
import Utils from '../utils.js'
import { toast } from '../toasts'
import { socket } from '@/js/socket.js'
import { showView } from '@/js/tabs.js'
import Downloads from '@/js/downloads.js'
import QualityModal from '@/js/quality-modal.js'
import TrackPreview from '@/js/track-preview.js'
import Utils from '@/js/utils.js'
import { toast } from '@/js/toasts'
const FavoritesTab = new Vue({
data() {

View file

@ -1,10 +1,8 @@
import Vue from 'vue'
import { socket } from '../socket.js'
import { showView } from '../tabs.js'
import Downloads from '../downloads.js'
import QualityModal from '../quality-modal.js'
// import TrackPreview from '../track-preview.js'
// import Utils from '../utils.js'
import { socket } from '@/js/socket.js'
import { showView } from '@/js/tabs.js'
import Downloads from '@/js/downloads.js'
import QualityModal from '@/js/quality-modal.js'
const HomeTab = new Vue({
data() {

View file

@ -1,7 +1,7 @@
import Vue from 'vue'
import { socket } from '../socket.js'
import { showView } from '../tabs.js'
import Utils from '../utils.js'
import { socket } from '@/js/socket.js'
import { showView } from '@/js/tabs.js'
import Utils from '@/js/utils.js'
const LinkAnalyzerTab = new Vue({
data() {
@ -65,7 +65,7 @@ const LinkAnalyzerTab = new Vue({
this.data = data
this.id = id
},
notSupported(){
notSupported() {
this.link = 'error'
}
},

View file

@ -1,10 +1,10 @@
import Vue from 'vue'
import { socket } from '../socket.js'
import { showView } from '../tabs.js'
import Downloads from '../downloads.js'
import QualityModal from '../quality-modal.js'
import TrackPreview from '../track-preview.js'
import Utils from '../utils.js'
import { socket } from '@/js/socket.js'
import { showView } from '@/js/tabs.js'
import Downloads from '@/js/downloads.js'
import QualityModal from '@/js/quality-modal.js'
import TrackPreview from '@/js/track-preview.js'
import Utils from '@/js/utils.js'
const MainSearch = new Vue({
data: {

View file

@ -1,7 +1,7 @@
import Vue from 'vue'
import { toast } from '../toasts.js'
import { socket } from '../socket.js'
import TestComponent from './TestComponent.vue'
import { toast } from '@/js/toasts.js'
import { socket } from '@/js/socket.js'
import TestComponent from '@components/TestComponent.vue'
const SettingsTab = new Vue({
components: {
@ -81,7 +81,9 @@ const SettingsTab = new Vue({
},
accountChanged(user, accountNum) {
this.$refs.username.innerText = user.name
this.$refs.userpicture.src = `https://e-cdns-images.dzcdn.net/images/user/${user.picture}/125x125-000000-80-0-0.jpg`
this.$refs.userpicture.src = `https://e-cdns-images.dzcdn.net/images/user/${
user.picture
}/125x125-000000-80-0-0.jpg`
this.accountNum = accountNum
localStorage.setItem('accountNum', this.accountNum)
},

View file

@ -1,11 +1,11 @@
import { isEmpty } from 'lodash-es'
import Vue from 'vue'
import { socket } from '../socket.js'
import { showView } from '../tabs.js'
import Downloads from '../downloads.js'
import QualityModal from '../quality-modal.js'
import TrackPreview from '../track-preview.js'
import Utils from '../utils.js'
import { socket } from '@/js/socket.js'
import { showView } from '@/js/tabs.js'
import Downloads from '@/js/downloads.js'
import QualityModal from '@/js/quality-modal.js'
import TrackPreview from '@/js/track-preview.js'
import Utils from '@/js/utils.js'
const TracklistTab = new Vue({
data: () => ({

View file

@ -1,7 +1,7 @@
import $ from 'jquery'
import { socket } from './socket.js'
import { toast } from './toasts.js'
import { showErrors } from './tabs.js'
import { socket } from '@/js/socket.js'
import { toast } from '@/js/toasts.js'
import { showErrors } from '@/js/tabs.js'
/* ===== Locals ===== */
const tabMinWidth = 250
@ -141,7 +141,9 @@ function addToQueue(queueItem, current = false) {
$('#bar_' + queueItem.uuid).css('width', queueItem.progress + '%')
if (queueItem.failed >= 1 && $('#download_' + queueItem.uuid + ' .queue_failed').length == 0) {
$('#download_' + queueItem.uuid + ' .download_info_status').append(
`<span class="secondary-text inline-flex"><span class="download_slim_separator">(</span><span class="queue_failed_button inline-flex"><span class="queue_failed">${queueItem.failed}</span><i class="material-icons">error_outline</i></span><span class="download_slim_separator">)</span></span>`
`<span class="secondary-text inline-flex"><span class="download_slim_separator">(</span><span class="queue_failed_button inline-flex"><span class="queue_failed">${
queueItem.failed
}</span><i class="material-icons">error_outline</i></span><span class="download_slim_separator">)</span></span>`
)
}
if (queueItem.downloaded + queueItem.failed == queueItem.size) {
@ -152,8 +154,8 @@ function addToQueue(queueItem, current = false) {
let failed_button = $('#download_' + queueItem.uuid).find('.queue_failed_button')
result_icon.addClass('clickable')
failed_button.addClass('clickable')
result_icon.bind('click', {item:queueItem}, showErrors)
failed_button.bind('click', {item:queueItem}, showErrors)
result_icon.bind('click', { item: queueItem }, showErrors)
failed_button.bind('click', { item: queueItem }, showErrors)
if (queueItem.failed >= queueItem.size) {
result_icon.text('error')
} else {
@ -254,8 +256,8 @@ function finishDownload(uuid) {
let failed_button = $('#download_' + uuid).find('.queue_failed_button')
result_icon.addClass('clickable')
failed_button.addClass('clickable')
result_icon.bind('click', {item:queueList[uuid]}, showErrors)
failed_button.bind('click', {item:queueList[uuid]}, showErrors)
result_icon.bind('click', { item: queueList[uuid] }, showErrors)
failed_button.bind('click', { item: queueList[uuid] }, showErrors)
if (queueList[uuid].failed >= queueList[uuid].size) {
result_icon.text('error')
} else {
@ -287,7 +289,7 @@ function removeAllDownloads(currentItem) {
let tempQueueItem = queueList[currentItem]
queueList = {}
queueList[currentItem] = tempQueueItem
$('.download_object').each(function (index) {
$('.download_object').each(function(index) {
if ($(this).attr('id') != 'download_' + currentItem) $(this).remove()
})
}
@ -323,7 +325,7 @@ function updateQueue(update) {
} else {
$('#download_' + uuid + ' .queue_failed').text(queueList[uuid].failed)
}
queueList[uuid].errors.push({message: update.error, data: update.data})
queueList[uuid].errors.push({ message: update.error, data: update.data })
}
if (progress) {
queueList[uuid].progress = progress

View file

@ -1,4 +1,4 @@
import Downloads from './downloads.js'
import Downloads from '@/js/downloads.js'
const QualityModal = {
// Defaults

View file

@ -1,9 +1,9 @@
import MainSearch from './components/main-search.js'
import Utils from './utils.js'
import QualityModal from './quality-modal.js'
import Downloads from './downloads.js'
import { socket } from './socket.js'
import Tabs from './tabs.js'
import MainSearch from '@components/main-search.js'
import Utils from '@/js/utils.js'
import QualityModal from '@/js/quality-modal.js'
import Downloads from '@/js/downloads.js'
import { socket } from '@/js/socket.js'
import Tabs from '@/js/tabs.js'
function linkListeners() {
document.getElementById('content').addEventListener('scroll', Utils.debounce(handleContentScroll, 100))

View file

@ -1,11 +1,11 @@
import ArtistTab from './components/artist-tab.js'
import TracklistTab from './components/tracklist-tab.js'
import LinkAnalyzerTab from './components/link-analyzer-tab.js'
import ErrorsTab from './components/errors-tab.js'
import { socket } from './socket.js'
import SettingsTab from './components/settings-tab.js'
import MainSearch from './components/main-search.js'
import TrackPreview from './track-preview.js'
import ArtistTab from '@components/artist-tab.js'
import TracklistTab from '@components/tracklist-tab.js'
import LinkAnalyzerTab from '@components/link-analyzer-tab.js'
import ErrorsTab from '@components/errors-tab.js'
import SettingsTab from '@components/settings-tab.js'
import MainSearch from '@components/main-search.js'
import { socket } from '@/js/socket.js'
import TrackPreview from '@/js/track-preview.js'
/* ===== Globals ====== */
window.search_selected = ''
@ -242,7 +242,10 @@ function showTab(type, id, back = false) {
if (windows_stack.length == 0) {
windows_stack.push({ tab: main_selected })
} else if (!back) {
if (currentStack.type === 'artist') currentStack.selected = ArtistTab.getCurrentTab()
if (currentStack.type === 'artist') {
currentStack.selected = ArtistTab.getCurrentTab()
}
windows_stack.push(currentStack)
}
@ -254,6 +257,7 @@ function showTab(type, id, back = false) {
for (let i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = 'none'
}
document.getElementById(tab).style.display = 'block'
TrackPreview.stopStackedTabsPreview()
}