diff --git a/public/css/modules/middle-section.css b/public/css/modules/middle-section.css index b4333c8..fca1dd1 100644 --- a/public/css/modules/middle-section.css +++ b/public/css/modules/middle-section.css @@ -48,20 +48,50 @@ width: 90%; } +/* The Modal (background) */ +.smallmodal { + display: none; /* Hidden by default */ + position: fixed; /* Stay in place */ + z-index: 1250; /* Sit on top */ + left: 0; + top: 0; + width: 100%; /* Full width */ + height: 100%; /* Full height */ + overflow: auto; /* Enable scroll if needed */ + background-color: rgb(0,0,0); /* Fallback color */ + background-color: rgba(0,0,0,0.4); /* Black w/ opacity */ + animation-duration: 0.3s; +} + +/* Modal Content */ +.smallmodal-content { + background-color: none; + margin: auto; + width: 30%; + align-items: center; + position: relative; + top: 50%; + transform: translateY(-50%); +} +.smallmodal-content button{ + width: 100%; + margin-bottom: 8px; +} + @media only screen and (min-width: 601px) { - #container { + #container, .smallmodal-content { width: 85%; } } @media only screen and (min-width: 993px) { - #container { + #container, .smallmodal-content { width: 70%; } } @media only screen and (max-width: 600px) { - #container { + #container, .smallmodal-content { width: 100%; } -} \ No newline at end of file +} diff --git a/public/index.html b/public/index.html index 6135706..ff5bd5d 100644 --- a/public/index.html +++ b/public/index.html @@ -53,7 +53,7 @@ <h1 v-on:click="changeSearchTab(section)">{{ names[section] }}</h1> <div class="cover_container"> <img v-bind:src="(results.TOP_RESULT[0].__TYPE__ == 'artist' ? 'https://e-cdns-images.dzcdn.net/images/artist/' + results.TOP_RESULT[0].ART_PICTURE : results.TOP_RESULT[0].__TYPE__ == 'album' ? 'https://e-cdns-images.dzcdn.net/images/cover/' + results.TOP_RESULT[0].ALB_PICTURE : results.TOP_RESULT[0].__TYPE__ == 'playlist' ? 'https://e-cdns-images.dzcdn.net/images/'+ results.TOP_RESULT[0].PICTURE_TYPE +'/' + results.TOP_RESULT[0].PLAYLIST_PICTURE :'https://e-cdns-images.dzcdn.net/images/cover/') + '/156x156-000000-80-0-0.jpg'" v-bind:class="(results.TOP_RESULT[0].__TYPE__ == 'artist' ? 'circle' : 'rounded') + ' coverart'"></img> - <div v-on:click="addToQueue('https://deezer.com/'+results.TOP_RESULT[0].__TYPE__+'/'+(results.TOP_RESULT[0].__TYPE__ == 'artist' ? results.TOP_RESULT[0].ART_ID : results.TOP_RESULT[0].__TYPE__ == 'album' ? results.TOP_RESULT[0].ALB_ID : results.TOP_RESULT[0].__TYPE__ == 'playlist' ? results.TOP_RESULT[0].PLAYLIST_ID : ''))" class="download_overlay"><i class="material-icons">get_app</i></div> + <div v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="'https://deezer.com/'+results.TOP_RESULT[0].__TYPE__+'/'+(results.TOP_RESULT[0].__TYPE__ == 'artist' ? results.TOP_RESULT[0].ART_ID : results.TOP_RESULT[0].__TYPE__ == 'album' ? results.TOP_RESULT[0].ALB_ID : results.TOP_RESULT[0].__TYPE__ == 'playlist' ? results.TOP_RESULT[0].PLAYLIST_ID : '')" class="download_overlay"><i class="material-icons">get_app</i></div> </div> <div class="info_box"> <p class="primary-text">{{ results.TOP_RESULT[0].__TYPE__ == 'artist' ? results.TOP_RESULT[0].ART_NAME : results.TOP_RESULT[0].__TYPE__ == 'album' ? results.TOP_RESULT[0].ALB_TITLE : results.TOP_RESULT[0].__TYPE__ == 'playlist' ? results.TOP_RESULT[0].TITLE : '' }}</p> @@ -69,7 +69,7 @@ <h1 v-on:click="changeSearchTab(section)">{{ names[section] }}</h1> <td class="breakline"><span v-for="artist in track.ARTISTS">{{artist.ART_NAME}} </span></td> <td class="breakline">{{track.ALB_TITLE}}</td> <td>{{convertDuration(track.DURATION)}}</td> - <td v-on:click="addToQueue('https://www.deezer.com/track/'+track.SNG_ID)" style="width: 56px; text-align: center;" class="clickable"><i class="material-icons">get_app</i></td> + <td v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="'https://www.deezer.com/track/'+track.SNG_ID" style="width: 56px; text-align: center;" class="clickable"><i class="material-icons">get_app</i></td> </tr> </table> </div> @@ -77,7 +77,7 @@ <h1 v-on:click="changeSearchTab(section)">{{ names[section] }}</h1> <div v-for="release in results[section].data.slice(0, 10)" class="release"> <div class="cover_container"> <img v-bind:class="(section == 'ARTIST' ? 'circle' : 'rounded') + ' coverart'" v-bind:src="(section == 'ARTIST' ? 'https://e-cdns-images.dzcdn.net/images/artist/' + release.ART_PICTURE : section == 'ALBUM' ? 'https://e-cdns-images.dzcdn.net/images/cover/' + release.ALB_PICTURE : section == 'PLAYLIST' ? 'https://e-cdns-images.dzcdn.net/images/'+ release.PICTURE_TYPE +'/' + release.PLAYLIST_PICTURE : 'https://e-cdns-images.dzcdn.net/images/cover/' ) + '/156x156-000000-80-0-0.jpg'"> - <div v-on:click="addToQueue('https://deezer.com/'+(section == 'ARTIST' ? 'artist/'+release.ART_ID : section == 'ALBUM' ? 'album/'+release.ALB_ID : section == 'PLAYLIST' ? 'playlist/'+release.PLAYLIST_ID : ''))" class="download_overlay"><i class="material-icons">get_app</i></div> + <div v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="'https://deezer.com/'+(section == 'ARTIST' ? 'artist/'+release.ART_ID : section == 'ALBUM' ? 'album/'+release.ALB_ID : section == 'PLAYLIST' ? 'playlist/'+release.PLAYLIST_ID : '')" class="download_overlay"><i class="material-icons">get_app</i></div> </div> <p class="primary-text">{{ section == 'ARTIST' ? release.ART_NAME : section == 'ALBUM' ? release.ALB_TITLE : section == 'PLAYLIST' ? release.TITLE : '' }}</p> <p class="secondary-text">{{ section == 'ARTIST' ? numberWithDots(release.NB_FAN) + ' fans' : section == 'ALBUM' ? release.ART_NAME+' - '+release.NUMBER_TRACK+' tracks' : section == 'PLAYLIST' ? release.NB_SONG+' tracks' : '' }}</p> @@ -109,7 +109,7 @@ <h1>No Tracks found</h1> <td class="breakline"><span v-for="artist in track.ARTISTS">{{artist.ART_NAME}} </span></td> <td class="breakline">{{track.ALB_TITLE}}</td> <td>{{convertDuration(track.DURATION)}}</td> - <td v-on:click="addToQueue('https://www.deezer.com/track/'+track.SNG_ID)" style="width: 56px; text-align: center;" class="clickable"><i class="material-icons">get_app</i></td> + <td v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="'https://www.deezer.com/track/'+track.SNG_ID" style="width: 56px; text-align: center;" class="clickable"><i class="material-icons">get_app</i></td> </tr> </table> </div> @@ -122,7 +122,7 @@ <h1>No Albums found</h1> <div v-for="release in results.data" class="release"> <div class="cover_container"> <img class="rounded coverart" v-bind:src="'https://e-cdns-images.dzcdn.net/images/cover/' + release.ALB_PICTURE + '/156x156-000000-80-0-0.jpg'"> - <div v-on:click="addToQueue('https://www.deezer.com/album/'+release.ALB_ID)" class="download_overlay"><i class="material-icons">get_app</i></div> + <div v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="'https://www.deezer.com/album/'+release.ALB_ID" class="download_overlay"><i class="material-icons">get_app</i></div> </div> <p class="primary-text">{{ release.ALB_TITLE }}</p> <p class="secondary-text">{{ 'by '+release.ART_NAME }}</p> @@ -138,7 +138,7 @@ <h1>No Artists found</h1> <div v-for="release in results.data" class="release"> <div class="cover_container"> <img class="circle coverart" v-bind:src="'https://e-cdns-images.dzcdn.net/images/artist/' + release.ART_PICTURE + '/156x156-000000-80-0-0.jpg'"> - <div v-on:click="addToQueue('https://www.deezer.com/artist/'+release.ART_ID)" class="download_overlay"><i class="material-icons">get_app</i></div> + <div v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="'https://www.deezer.com/artist/'+release.ART_ID" class="download_overlay"><i class="material-icons">get_app</i></div> </div> <p class="primary-text">{{ release.ART_NAME }}</p> <p class="secondary-text">{{ numberWithDots(release.NB_FAN) + ' fans' }}</p> @@ -154,7 +154,7 @@ <h1>No Playlists found</h1> <div v-for="release in results.data" class="release"> <div class="cover_container"> <img class="rounded coverart" v-bind:src="'https://e-cdns-images.dzcdn.net/images/'+ release.PICTURE_TYPE +'/' + release.PLAYLIST_PICTURE + '/156x156-000000-80-0-0.jpg'"> - <div v-on:click="addToQueue('https://www.deezer.com/playlist/'+release.PLAYLIST_ID)" class="download_overlay"><i class="material-icons">get_app</i></div> + <div v-on:contextmenu="openQualityModal(event)" v-on:click="addToQueue(event)" v-bind:data-link="'https://www.deezer.com/playlist/'+release.PLAYLIST_ID" class="download_overlay"><i class="material-icons">get_app</i></div> </div> <p class="primary-text">{{ release.TITLE }}</p> <p class="secondary-text">{{ release.NB_SONG+' tracks' }}</p> @@ -393,6 +393,17 @@ <h1>Settings</h1> </div> </main> + <div id="modal_quality" class="smallmodal"> + <!-- Modal content --> + <div class="smallmodal-content"> + <button onclick="modalQualityButton(9)">Download FLAC</button><br> + <button onclick="modalQualityButton(3)">Download MP3 320kbps</button><br> + <button onclick="modalQualityButton(1)">Download MP3 128kbps</button><br> + <button onclick="modalQualityButton(15)">Download 360 Reality Audio [HQ]</button><br> + <button onclick="modalQualityButton(14)">Download 360 Reality Audio [MQ]</button><br> + <button onclick="modalQualityButton(13)">Download 360 Reality Audio [LQ]</button><br> + </div> + </div> </body> <script type="text/javascript" src="/public/js/socket.io.js"></script> <script type="text/javascript" src="/public/js/jquery-3.3.1.min.js"></script> diff --git a/public/js/app/app.js b/public/js/app/app.js index 38966d7..448f013 100644 --- a/public/js/app/app.js +++ b/public/js/app/app.js @@ -166,7 +166,7 @@ socket.on("logged_out", function(){ var settingsTab = new Vue({ el: '#settings_tab', data: { - settings: {}, + settings: {tags: {}}, spotifyFeatures: {} } }) @@ -217,3 +217,27 @@ function changeTab(evt, section, tabName) { scrolledSearch(window[search_selected.split("_")[0]+"Search"]) } } + +// quality modal stuff +var modalQuality = document.getElementById('modal_quality'); +modalQuality.open = false + +function openQualityModal(link){ + $(modalQuality).data("url", link) + $(modalQuality).css('display', 'block') + $(modalQuality).addClass('animated fadeIn') +} + +function modalQualityButton(bitrate){ + var url=$(modalQuality).data("url") + if (url.indexOf(";") != -1){ + urls = url.split(";") + urls.forEach(url=>{ + sendAddToQueue(url, bitrate) + }) + }else{ + sendAddToQueue(url, bitrate) + } + $(modalQuality).addClass('animated fadeOut') + $(modalQuality).css('display', 'none') +} diff --git a/public/js/app/downloadList.js b/public/js/app/downloadList.js index cebe7b8..869e47e 100644 --- a/public/js/app/downloadList.js +++ b/public/js/app/downloadList.js @@ -10,14 +10,14 @@ socket.on("init_downloadQueue", function(data){ }) } if (data.currentItem){ - addToQueue(data['queueList'][data.currentItem]) + addToQueue(data['queueList'][data.currentItem], true) } data.queue.forEach(item=>{ addToQueue(data.queueList[item]) }) }) -function addToQueue(queueItem){ +function addToQueue(queueItem, current=false){ queueList[queueItem.uuid] = queueItem if ((queueItem.downloaded + queueItem.failed) == queueItem.size) queueComplete.push(queueItem.uuid) @@ -40,7 +40,7 @@ function addToQueue(queueItem){ <i onclick="downloadAction(event)" class="material-icons queue_icon" data-uuid="${queueItem.uuid}">remove</i> </div> </div>`) - if (queueItem.progress>0){ + if (queueItem.progress>0 || current){ $('#bar_' + queueItem.uuid).removeClass('indeterminate').addClass('determinate') } $('#bar_' +queueItem.uuid).css('width', queueItem.progress + '%') diff --git a/public/js/app/search.js b/public/js/app/search.js index 2c9fecf..c9c2544 100644 --- a/public/js/app/search.js +++ b/public/js/app/search.js @@ -71,7 +71,8 @@ var mainSearch = new Vue({ if (section != "TOP_RESULT") clickElement('search_'+section.toLowerCase()+'_tab') }, - addToQueue: function(url){sendAddToQueue(url)} + addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -88,7 +89,8 @@ var trackSearch = new Vue({ } }, methods: { - addToQueue: function(url){sendAddToQueue(url)} + addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -105,7 +107,8 @@ var albumSearch = new Vue({ } }, methods: { - addToQueue: function(url){sendAddToQueue(url)} + addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -122,7 +125,8 @@ var artistSearch = new Vue({ } }, methods: { - addToQueue: function(url){sendAddToQueue(url)} + addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } }) @@ -139,7 +143,8 @@ var playlistSearch = new Vue({ } }, methods: { - addToQueue: function(url){sendAddToQueue(url)} + addToQueue: function(e){sendAddToQueue(e.currentTarget.dataset.link)}, + openQualityModal: function(e){e.preventDefault(); openQualityModal(e.currentTarget.dataset.link)} } })