Fixed #96
authorRemixDev <deezloaderremix@gmail.com>
Sat, 23 Nov 2019 12:21:19 +0000 (13:21 +0100)
committerRemixDev <deezloaderremix@gmail.com>
Sat, 23 Nov 2019 12:21:19 +0000 (13:21 +0100)
app/public/js/frontend.js
app/views/index.ejs

index 10fac0329fa41fbc702c88561fb3955af5019409..e82c94970c998239d993e35db40bbf990c76f959 100644 (file)
@@ -10,7 +10,6 @@ var modalQuality = document.getElementById('modal_quality');
 modalQuality.open = false
 let userSettings = {}
 let spotifySettings = {}
-let modalsArray = []
 
 var downloadQueue = []
 
@@ -212,33 +211,7 @@ $(document).ready(function () {
        M.AutoInit()
        preview_track.volume = 0
        var tabs = M.Tabs.getInstance(document.getElementById("tab-nav"))
-       $('.modal').modal({
-               onOpenStart: function(){
-                       modalsArray.push('#'+this.id)
-                       history.pushState(null,null, '#'+this.id);
-               },
-               onCloseStart: function(){
-                       modalsArray.pop()
-                       if (!this.$el.attr("fromBack")){
-                               console.log("removing")
-                               $(modalsArray[modalsArray.length-1]).attr("fromButton", true)
-                               history.back()
-                       }else{
-                               this.$el.removeAttr("fromBack")
-                       }
-               }
-       })
-       $(window).on('popstate', function (ev) {
-               if (modalsArray.length > 0){
-                       var modal = $(modalsArray[modalsArray.length-1])
-                       if (!modal.attr("fromButton")){
-                               modal.attr("fromBack", true)
-                               modal.modal('close')
-                       }else{
-                               modal.removeAttr("fromButton")
-                       }
-               }
-  });
+       $('.modal').modal()
        socket.emit("getUserSettings")
        $("main.container").addClass('animated fadeIn').on('webkitAnimationEnd', function () {
                $(this).removeClass('animated fadeOut')
@@ -713,7 +686,7 @@ function showResults_table_track(tracks) {
                var currentResultTrack = tracks[i]
                $(tableBody).append(
                        `<tr>
-                       <td><a href="" class="rounded ${(currentResultTrack.preview ? `single-cover" preview="${currentResultTrack.preview}"><i class="material-icons preview_controls white-text">play_arrow</i>` : '">')}<img style="width:56px;" class="rounded" src="${(currentResultTrack.album.cover_small ? currentResultTrack.album.cover_small : "img/noCover.jpg" )}"/></a></td>
+                       <td><a href="#" class="rounded ${(currentResultTrack.preview ? `single-cover" preview="${currentResultTrack.preview}"><i class="material-icons preview_controls white-text">play_arrow</i>` : '">')}<img style="width:56px;" class="rounded" src="${(currentResultTrack.album.cover_small ? currentResultTrack.album.cover_small : "img/noCover.jpg" )}"/></a></td>
                        <td class="hide-on-med-and-up">
                                <p class="remove-margin">${(currentResultTrack.explicit_lyrics ? ' <i class="material-icons valignicon tiny materialize-red-text">explicit</i>' : '')} ${currentResultTrack.title}</p>
                                <p class="remove-margin secondary-text">${currentResultTrack.artist.name}</p>
@@ -836,7 +809,7 @@ var trackListModalApp = new Vue({
 
 // Generate Button for tracklist with selection
 function generateShowTracklistSelectiveButton(link) {
-       var btn_showTrackListSelective = $('<a href="" class="waves-effect btn-flat"><i class="material-icons">list</i></a>')
+       var btn_showTrackListSelective = $('<a href="#" class="waves-effect btn-flat"><i class="material-icons">list</i></a>')
        $(btn_showTrackListSelective).click(function (ev){
                ev.preventDefault()
                showTrackListSelective(link)
@@ -891,7 +864,7 @@ $('#download_track_selection').on('contextmenu', function(e){
 
 // Generate Button for tracklist without selection
 function generateShowTracklistButton(link) {
-       var btn_showTrackList = $('<a href="" class="waves-effect btn-flat"><i class="material-icons">list</i></a>')
+       var btn_showTrackList = $('<a href="#" class="waves-effect btn-flat"><i class="material-icons">list</i></a>')
        $(btn_showTrackList).click(function (ev) {
                ev.preventDefault()
                showTrackList(link)
@@ -956,10 +929,10 @@ socket.on("getTrackList", function (data) {
                                $(tableBody).append(
                                        `<tr>
                                        <td class="hide-on-med-and-up">
-                                               <a href="" class="album_chip" data-link="${trackList[i].link}"><div class="chip"><img src="${trackList[i].cover_small}"/>${(trackList[i].explicit_lyrics ? `<i class="material-icons valignicon tiny materialize-red-text tooltipped" data-tooltip="${i18n("Explicit")}">explicit</i> ` : '')}${trackList[i].title}</div></a>
+                                               <a href="#" class="album_chip" data-link="${trackList[i].link}"><div class="chip"><img src="${trackList[i].cover_small}"/>${(trackList[i].explicit_lyrics ? `<i class="material-icons valignicon tiny materialize-red-text tooltipped" data-tooltip="${i18n("Explicit")}">explicit</i> ` : '')}${trackList[i].title}</div></a>
                                                <p class="remove-margin secondary-text">${trackList[i].record_type[0].toUpperCase() + trackList[i].record_type.substring(1)} • ${trackList[i].release_date}</p>
                                        </td>
-                                       <td class="hide-on-small-only breakline"><a href="" class="album_chip" data-link="${trackList[i].link}"><div class="chip"><img src="${trackList[i].cover_small}"/>${(trackList[i].explicit_lyrics ? `<i class="material-icons valignicon tiny materialize-red-text tooltipped" data-tooltip="${i18n("Explicit")}">explicit</i> ` : '')}${trackList[i].title}</div></a></td>
+                                       <td class="hide-on-small-only breakline"><a href="#" class="album_chip" data-link="${trackList[i].link}"><div class="chip"><img src="${trackList[i].cover_small}"/>${(trackList[i].explicit_lyrics ? `<i class="material-icons valignicon tiny materialize-red-text tooltipped" data-tooltip="${i18n("Explicit")}">explicit</i> ` : '')}${trackList[i].title}</div></a></td>
                                        <td class="hide-on-small-only">${trackList[i].release_date}</td>
                                        <td class="hide-on-small-only">${trackList[i].record_type[0].toUpperCase() + trackList[i].record_type.substring(1)}</td>
                                        </tr>`
@@ -1177,7 +1150,7 @@ socket.on("getChartsTrackListByCountry", function (data) {
                $(chartsTableBody).append(
                                `<tr>
                                <td>${(i + 1)}</td>
-                               <td><a href="" class="rounded ${(currentChartTrack.preview ? `single-cover" preview="${currentChartTrack.preview}"><i class="material-icons preview_controls white-text">play_arrow</i>` : '">')}<img style="width:56px;" src="${(currentChartTrack.album.cover_small ? currentChartTrack.album.cover_small : "img/noCover.jpg")}" class="rounded" /></a></td>
+                               <td><a href="#" class="rounded ${(currentChartTrack.preview ? `single-cover" preview="${currentChartTrack.preview}"><i class="material-icons preview_controls white-text">play_arrow</i>` : '">')}<img style="width:56px;" src="${(currentChartTrack.album.cover_small ? currentChartTrack.album.cover_small : "img/noCover.jpg")}" class="rounded" /></a></td>
                                <td class="hide-on-med-and-up">
                                        <p class="remove-margin">${(currentChartTrack.explicit_lyrics ? `<i class="material-icons valignicon tiny materialize-red-text tooltipped" data-tooltip="${i18n("Explicit")}">explicit</i> ` : '')}${currentChartTrack.title}</p>
                                        <p class="remove-margin secondary-text">${currentChartTrack.artist.name}</p>
@@ -1377,7 +1350,7 @@ function addObjToQueue(data){
                                <td colspan="4" class="progress"><div class="changeThis indeterminate"></div></td>
                        </tr>`)
 
-       var btn_remove = $('<a href="" class="btn-flat waves-effect"><i class="material-icons">remove</i></a>')
+       var btn_remove = $('<a href="#" class="btn-flat waves-effect"><i class="material-icons">remove</i></a>')
 
        $(btn_remove).click(function (ev) {
                ev.preventDefault()
@@ -1576,7 +1549,7 @@ function getTypeFromLink(link) {
 }
 
 function generateDownloadLink(url) {
-       var btn_download = $('<a href="" class="waves-effect btn-flat" oncontextmenu="return false;"><i class="material-icons">file_download</i></a>')
+       var btn_download = $('<a href="#" class="waves-effect btn-flat" oncontextmenu="return false;"><i class="material-icons">file_download</i></a>')
        $(btn_download).on('contextmenu', function(e){
     e.preventDefault();
                $(modalQuality).data("url", url)
index 60c8c24240a01e067a107f3d89ddac99f69458b4..562627f67b23dcdec344788b93c21aa9a95f081d 100644 (file)
                                <!--<iframe id="modal_login_iframe_captcha" src="cap://deezer.com/"></iframe>-->
                        </div>
                        <div class="card-action row">
-                               <a href="" class="deezloader-primary col s12 m2 waves-effect waves-light btn" id="modal_login_btn_login"><%= __('Log in')%></a>
-                               <a href="" class="deezloader-secondary col s12 m2 waves-effect waves-light btn" id="modal_login_btn_signup"><%= __('Sign up')%></a>
+                               <a href="#" class="deezloader-primary col s12 m2 waves-effect waves-light btn" id="modal_login_btn_login"><%= __('Log in')%></a>
+                               <a href="#" class="deezloader-secondary col s12 m2 waves-effect waves-light btn" id="modal_login_btn_signup"><%= __('Sign up')%></a>
                        </div>
                </div>
        </div>
        <div class="modal-footer">
-               <a href="" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
+               <a href="#" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
        </div>
 </div>
 <!--#############################################MODAL_SETTINGS############################################-->
@@ -80,7 +80,7 @@
                        <div class="col s12 hide" id="logged_in_info">
                                <img id="modal_settings_picture" src="" alt="Profile Picture" class="circle left" style="height:125px; margin-right: 12px;"/>
                                <p><%= __('You are logged in as')%> <b id="modal_settings_username"></b></p>
-                               <a href="" class="waves-effect waves-light btn" id="modal_settings_btn_logout"><%= __('Logout')%></a>
+                               <a href="#" class="waves-effect waves-light btn" id="modal_settings_btn_logout"><%= __('Logout')%></a>
                        </div>
                        <p class="col s12" id="login_email_btn_container">
                                <a href="#modal_login" class="modal-trigger waves-effect waves-light btn" id="login_email_btn" style="width:100%;"><%= __('Login with e-mail')%></a>
@@ -92,7 +92,7 @@
                                <button class="btn btn-input btn-flat deezloader-primary white-text" id="modal_settings_btn_copyArl"><i class="material-icons">assignment</i></button>
                        </div>
                        <p class="col s12"><a href="https://notabug.org/RemixDevs/DeezloaderRemix/wiki/Login+via+userToken" target="_blank"><%= __('How do I get my userToken?')%></a></p>
-                       <p class="col s12"><a href="" class="deezloader-secondary waves-effect waves-light btn" style="width:100%;" id="modal_settings_btn_updateArl"><%= __('Update userToken')%></a></p>
+                       <p class="col s12"><a href="#" class="deezloader-secondary waves-effect waves-light btn" style="width:100%;" id="modal_settings_btn_updateArl"><%= __('Update userToken')%></a></p>
                </div>
 
                <h6 class="col s12 secondary-text"><%= __('Path Settings')%></h6><hr>
 
        </div>
        <div class="modal-footer">
-               <a href="" class="modal-close waves-effect waves-light deezloader-primary btn" id="modal_settings_btn_saveSettings"><i
+               <a href="#" class="modal-close waves-effect waves-light deezloader-primary btn" id="modal_settings_btn_saveSettings"><i
                        class="material-icons right">save</i><%= __('Save')%></a>
-               <a href="" class="waves-effect btn-flat" id="modal_settings_btn_defaultSettings"><i
+               <a href="#" class="waves-effect btn-flat" id="modal_settings_btn_defaultSettings"><i
                        class="material-icons right">settings_backup_restore</i><span class="hide-on-small-only"><%= __('Default Settings')%></span></a>
-               <a href="" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
+               <a href="#" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
        </div>
 </div>
 
                </div>
        </div>
        <div class="modal-footer">
-               <a href="" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
+               <a href="#" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
        </div>
 </div>
 
                </div>
        </div>
        <div class="modal-footer">
-               <a href="" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
+               <a href="#" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
        </div>
 </div>
 
                </div>
        </div>
        <div class="modal-footer">
-               <a href="" id="download_all_tracks" v-bind:data-link="link" class="btn btn-flat waves-effect waves-light left"><%= __('Download {{ type }}', {type: '{{ type }}'})%></a>
-               <a href="" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
+               <a href="#" id="download_all_tracks" v-bind:data-link="link" class="btn btn-flat waves-effect waves-light left"><%= __('Download {{ type }}', {type: '{{ type }}'})%></a>
+               <a href="#" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
        </div>
 </div>
 
                </div>
        </div>
        <div class="modal-footer">
-               <a href="" id="download_all_tracks_selective" v-bind:data-link="link" class="btn btn-flat waves-effect waves-light left"><%= __('Download {{ type }}', {type: '{{ type }}'})%></a>
-               <a href="" id="download_track_selection" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><span class="hide-on-small-only"><%= __('Download selection')%><i class="material-icons right">file_download</i></span><i class="material-icons hide-on-med-and-up">file_download</i></a>
-               <a href="" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
+               <a href="#" id="download_all_tracks_selective" v-bind:data-link="link" class="btn btn-flat waves-effect waves-light left"><%= __('Download {{ type }}', {type: '{{ type }}'})%></a>
+               <a href="#" id="download_track_selection" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><span class="hide-on-small-only"><%= __('Download selection')%><i class="material-icons right">file_download</i></span><i class="material-icons hide-on-med-and-up">file_download</i></a>
+               <a href="#" class="modal-close waves-effect btn-flat"><%= __('Close')%></a>
        </div>
 </div>
 
                </div>
        </div>
        <div class="modal-footer">
-               <a href="" class="modal-close waves-effect waves-light btn"><%= __('I got it!')%></a>
+               <a href="#" class="modal-close waves-effect waves-light btn"><%= __('I got it!')%></a>
        </div>
 </div>
 
                </table>
        </div>
        <div class="modal-footer">
-               <a href="" class="modal-close waves-effect waves-light btn"><%= __('Close')%></a>
+               <a href="#" class="modal-close waves-effect waves-light btn"><%= __('Close')%></a>
        </div>
 </div>
 
                                </div>
                        </li>
                </ul>
-               <a href="" data-target="slide-out" class="sidenav-trigger hide-on-med-and-up right"><i class="material-icons">menu</i></a>
+               <a href="#" data-target="slide-out" class="sidenav-trigger hide-on-med-and-up right"><i class="material-icons">menu</i></a>
                <ul id="nav-mobile" class="right hide-on-small-only">
                        <li>
                                <a href="#modal_settings" id="nav_btn_openSettingsModal" class="waves-effect waves-light modal-trigger">
 <div id="modal_quality" class="smallmodal">
        <!-- Modal content -->
        <div class="smallmodal-content">
-               <a onclick="modalQualityButton(9)" href="" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: 'FLAC'})%></a><br>
-               <a onclick="modalQualityButton(3)" href="" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: 'MP3 320kbps'})%></a><br>
-               <a onclick="modalQualityButton(1)" href="" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: 'MP3 128kbps'})%></a><br>
-               <a onclick="modalQualityButton(15)" href="" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: '360 Reality Audio [HQ]'})%></a><br>
-               <a onclick="modalQualityButton(14)" href="" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: '360 Reality Audio [MQ]'})%></a><br>
-               <a onclick="modalQualityButton(13)" href="" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: '360 Reality Audio [LQ]'})%></a><br>
+               <a onclick="modalQualityButton(9)" href="#" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: 'FLAC'})%></a><br>
+               <a onclick="modalQualityButton(3)" href="#" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: 'MP3 320kbps'})%></a><br>
+               <a onclick="modalQualityButton(1)" href="#" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: 'MP3 128kbps'})%></a><br>
+               <a onclick="modalQualityButton(15)" href="#" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: '360 Reality Audio [HQ]'})%></a><br>
+               <a onclick="modalQualityButton(14)" href="#" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: '360 Reality Audio [MQ]'})%></a><br>
+               <a onclick="modalQualityButton(13)" href="#" class="btn btn-flat waves-effect waves-light deezloader-primary white-text"><%= __('Download {{ type }}', {type: '360 Reality Audio [LQ]'})%></a><br>
        </div>
 </div>