@@ -41377,8 +41382,8 @@ const HomeTab = new Vue({
artistView,
albumView,
playlistView,
- openSettings(e){
- document.getElementById("main_settings_tablink").click();
+ openSettings(e) {
+ document.getElementById('main_settings_tablink').click();
},
addToQueue(e) {
e.stopPropagation();
@@ -41393,6 +41398,10 @@ const HomeTab = new Vue({
}
},
mounted() {
+ if (localStorage.getItem('arl')) {
+ this.$refs.notLogged.classList.add('hide');
+ }
+
socket.on('init_home', this.initHome);
}
}).$mount('#home_tab');
@@ -41600,17 +41609,24 @@ const SettingsTab = new Vue({
}
},
mounted() {
- socket.on('init_settings', this.initSettings);
- socket.on('updateSettings', this.updateSettings);
+ this.$refs.loggedInInfo.classList.add('hide');
- let spotyUser = localStorage.getItem('spotifyUser');
+ if (localStorage.getItem('arl')) {
+ this.$refs.loginInput.value = localStorage.getItem('arl');
+ }
- if ('' !== spotyUser) {
- this.lastUser = spotyUser;
- this.spotifyUser = spotyUser;
+ let spotifyUser = localStorage.getItem('spotifyUser');
+
+ if (spotifyUser) {
+ this.lastUser = spotifyUser;
+ this.spotifyUser = spotifyUser;
+ socket.emit('update_userSpotifyPlaylists', spotifyUser);
}
this.changeSlimDownloads = 'true' === localStorage.getItem('slimDownloads');
+
+ socket.on('init_settings', this.initSettings);
+ socket.on('updateSettings', this.updateSettings);
}
}).$mount('#settings_tab');
@@ -41843,6 +41859,7 @@ function handleSidebarClick(event) {
changeTab(sidebarEl, 'main', 'search_tab');
break
case 'main_home_tablink':
+ console.log('al laod', sidebarEl);
changeTab(sidebarEl, 'main', 'home_tab');
break
case 'main_charts_tablink':
@@ -42002,20 +42019,15 @@ function backTab() {
}
function init$3() {
- let selectedTheme = localStorage.getItem('selectedTheme');
-
- if (selectedTheme) {
- document.querySelector('.theme_toggler--active').classList.remove('theme_toggler--active');
- document
- .querySelector(`.theme_toggler[data-theme-variant="${selectedTheme}"]`)
- .classList.add('theme_toggler--active');
- }
+ // Open default tab
+ changeTab(document.getElementById('main_home_tablink'), 'main', 'home_tab');
linkListeners$2();
}
var Tabs = {
init: init$3,
+ changeTab,
artistView,
albumView,
playlistView,
@@ -42074,6 +42086,39 @@ var Search = {
linkListeners: linkListeners$3
};
+/* ===== App initialization ===== */
+
+function startApp() {
+ // Setting current theme
+ setUserTheme();
+
+ Downloads.init();
+ QualityModal$1.init();
+ Tabs.init();
+ Search.linkListeners();
+ TrackPreview.init();
+}
+
+document.addEventListener('DOMContentLoaded', startApp);
+
+/* ===== General functions ===== */
+
+/**
+ * Sets the current theme according to
+ * the localStorage saved theme.
+ * @since 0.1.6
+ */
+function setUserTheme() {
+ let selectedTheme = localStorage.getItem('selectedTheme');
+
+ if (selectedTheme) {
+ let activeClass = 'theme_toggler--active';
+
+ document.querySelector(`.${activeClass}`).classList.remove(activeClass);
+ document.querySelector(`.theme_toggler[data-theme-variant="${selectedTheme}"]`).classList.add(activeClass);
+ }
+}
+
/* ===== Socketio listeners ===== */
// Debug messages for socketio
@@ -42144,41 +42189,8 @@ socket.on('logged_out', function () {
jquery('#login_input_arl').val('');
jquery('#open_login_prompt').show();
document.getElementById('logged_in_info').classList.add('hide');
- // $('#logged_in_info').hide()
jquery('#settings_username').text('Not Logged');
jquery('#settings_picture').attr('src', `https://e-cdns-images.dzcdn.net/images/user/125x125-000000-80-0-0.jpg`);
document.getElementById('home_not_logged_in').classList.remove('hide');
});
-
-/* ===== App initialization ===== */
-function startApp() {
- Downloads.init();
- QualityModal$1.init();
- Tabs.init();
- Search.linkListeners();
- TrackPreview.init();
-
- document.getElementById('logged_in_info').classList.add('hide');
-
- if (localStorage.getItem('arl')) {
- let arl = localStorage.getItem('arl');
-
- jquery('#login_input_arl').val(arl);
- document.getElementById('home_not_logged_in').classList.add('hide');
- }
-
- if ('true' === localStorage.getItem('slimDownloads')) {
- document.getElementById('download_list').classList.add('slim');
- }
-
- let spotifyUser = localStorage.getItem('spotifyUser');
-
- if (spotifyUser != '') {
- socket.emit('update_userSpotifyPlaylists', spotifyUser);
- }
- // Open default tab
- document.getElementById('main_home_tablink').click();
-}
-
-document.addEventListener('DOMContentLoaded', startApp);
//# sourceMappingURL=bundle.js.map
diff --git a/public/js/bundle.js.map b/public/js/bundle.js.map
index 1f821fd..dad0627 100644
--- a/public/js/bundle.js.map
+++ b/public/js/bundle.js.map
@@ -1 +1 @@
-{"version":3,"file":"bundle.js","sources":["../../node_modules/jquery/dist/jquery.js","../../src/js/modules/socket.js","../../node_modules/toastify-js/src/toastify.js","../../src/js/modules/toasts.js","../../src/js/modules/downloads.js","../../src/js/modules/quality-modal.js","../../node_modules/lodash/lodash.js","../../node_modules/vue/dist/vue.esm.js","../../src/js/modules/components/artist-tab.js","../../src/js/modules/track-preview.js","../../src/js/modules/components/tracklist-tab.js","../../src/js/modules/utils.js","../../src/js/modules/components/link-analyzer-tab.js","../../src/js/modules/components/home-tab.js","../../src/js/modules/components/charts-tab.js","../../src/js/modules/components/favorites-tab.js","../../src/js/modules/components/settings-tab.js","../../src/js/modules/components/main-search.js","../../src/js/modules/tabs.js","../../src/js/modules/search.js","../../src/js/app.js"],"sourcesContent":["/*!\n * jQuery JavaScript Library v3.5.1\n * https://jquery.com/\n *\n * Includes Sizzle.js\n * https://sizzlejs.com/\n *\n * Copyright JS Foundation and other contributors\n * Released under the MIT license\n * https://jquery.org/license\n *\n * Date: 2020-05-04T22:49Z\n */\n( function( global, factory ) {\n\n\t\"use strict\";\n\n\tif ( typeof module === \"object\" && typeof module.exports === \"object\" ) {\n\n\t\t// For CommonJS and CommonJS-like environments where a proper `window`\n\t\t// is present, execute the factory and get jQuery.\n\t\t// For environments that do not have a `window` with a `document`\n\t\t// (such as Node.js), expose a factory as module.exports.\n\t\t// This accentuates the need for the creation of a real `window`.\n\t\t// e.g. var jQuery = require(\"jquery\")(window);\n\t\t// See ticket #14549 for more info.\n\t\tmodule.exports = global.document ?\n\t\t\tfactory( global, true ) :\n\t\t\tfunction( w ) {\n\t\t\t\tif ( !w.document ) {\n\t\t\t\t\tthrow new Error( \"jQuery requires a window with a document\" );\n\t\t\t\t}\n\t\t\t\treturn factory( w );\n\t\t\t};\n\t} else {\n\t\tfactory( global );\n\t}\n\n// Pass this if window is not defined yet\n} )( typeof window !== \"undefined\" ? window : this, function( window, noGlobal ) {\n\n// Edge <= 12 - 13+, Firefox <=18 - 45+, IE 10 - 11, Safari 5.1 - 9+, iOS 6 - 9.1\n// throw exceptions when non-strict code (e.g., ASP.NET 4.5) accesses strict mode\n// arguments.callee.caller (trac-13335). But as of jQuery 3.0 (2016), strict mode should be common\n// enough that all such attempts are guarded in a try block.\n\"use strict\";\n\nvar arr = [];\n\nvar getProto = Object.getPrototypeOf;\n\nvar slice = arr.slice;\n\nvar flat = arr.flat ? function( array ) {\n\treturn arr.flat.call( array );\n} : function( array ) {\n\treturn arr.concat.apply( [], array );\n};\n\n\nvar push = arr.push;\n\nvar indexOf = arr.indexOf;\n\nvar class2type = {};\n\nvar toString = class2type.toString;\n\nvar hasOwn = class2type.hasOwnProperty;\n\nvar fnToString = hasOwn.toString;\n\nvar ObjectFunctionString = fnToString.call( Object );\n\nvar support = {};\n\nvar isFunction = function isFunction( obj ) {\n\n // Support: Chrome <=57, Firefox <=52\n // In some browsers, typeof returns \"function\" for HTML