From 37a515c5971146f7edbf6fc754d9dd8b2fa2a099 Mon Sep 17 00:00:00 2001 From: Rello Date: Tue, 11 Sep 2018 23:09:00 +0200 Subject: [PATCH] [NC14] Album not scrolled into viewarea #337 a version check is being introduced --- CHANGELOG.md | 4 +- js/app-min.js | 30 +++++++------- js/app.js | 107 ++++++++++++++++++++++++++------------------------ 3 files changed, 72 insertions(+), 69 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ff016ac2..bb427397 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,9 @@ All notable changes to the Audio Player project will be documented in this file. - Postgres issue in categories [#330](https://github.com/rello/audioplayer/pull/330) @[jpumc](https://github.com/jpumc) ### Added -- Audioplayer widget for Dashboard App (beta) [#328](https://github.com/rello/audioplayer/issues/328) - SONOS player integration [#331](https://github.com/rello/audioplayer/issues/331) - +- Audioplayer widget for Dashboard App (beta) [#328](https://github.com/rello/audioplayer/issues/328) +- Play button on album cover [#319](https://github.com/rello/audioplayer/issues/319) ## 2.3.2 - 2018-08-19 ### Fixed diff --git a/js/app-min.js b/js/app-min.js index 3a48806c..4df959a6 100644 --- a/js/app-min.js +++ b/js/app-min.js @@ -3,41 +3,41 @@ var Audios=function(){this.AudioPlayer=null;this.PlaylistContainer=$('#playlist- myAudios.get_uservalue('category',function(){if(searchresult!=='')$this.category_selectors=locHashTemp;if($this.category_selectors[0]&&$this.category_selectors[0]!=='Albums'){window.location.href='#';$("#category_selector").val($this.category_selectors[0]);myAudios.loadCategory();}else{$this.loadCategoryAlbums();}});this.initKeyListener();$('.toolTip').tooltip();};Audios.prototype.initKeyListener=function(){$(document).keyup(function(evt){if(this.AudioPlayer!==null&&$('#activePlaylist li').length>0){if(evt.target){var nodeName=evt.target.nodeName.toUpperCase();if(nodeName==="INPUT"||nodeName==="TEXTAREA"||nodeName==="SELECT"){return;}} var currentVolume;var newVolume;if(evt.keyCode===32){if($('.sm2-bar-ui').hasClass('playing')){this.AudioPlayer.actions.stop();}else{this.AudioPlayer.actions.play();}}else if(evt.keyCode===39){this.AudioPlayer.actions.next();}else if(evt.keyCode===37){this.AudioPlayer.actions.prev();}else if(evt.keyCode===38){currentVolume=this.AudioPlayer.actions.getVolume();if(currentVolume>0&¤tVolume<=100){newVolume=currentVolume+10;if(newVolume>=100){newVolume=100;} this.AudioPlayer.actions.setVolume(newVolume);}}else if(evt.keyCode===40){currentVolume=this.AudioPlayer.actions.getVolume();if(currentVolume>0&¤tVolume<=100){newVolume=currentVolume-10;if(newVolume<=0){newVolume=10;} - this.AudioPlayer.actions.setVolume(newVolume);}}}}.bind(this));};Audios.prototype.loadCategoryAlbums=function(){var $this=this;$this.PlaylistContainer.show();$this.EmptyContainer.hide();$('#loading').show();$('.toolTip').tooltip('hide');$('#alben').addClass('active');$('#individual-playlist').remove();$('#individual-playlist-info').hide();$('#individual-playlist-header').hide();$(".coverrow").remove();$(".songcontainer").remove();$('#myCategory li').removeClass('active');$('#newPlaylist').addClass('ap_hidden');$.ajax({type:'GET',url:OC.generateUrl('apps/audioplayer/getcategory'),data:{category:'Album'},success:function(jsondata){$('#loading').hide();if(jsondata.status==='success'){$('.sm2-bar-ui').show();$this.buildCoverRow(jsondata.data);}else{$this.showInitScreen();}}});};Audios.prototype.buildCoverRow=function(aAlbums){$this=this;var divAlbum=[];var getcoverUrl=OC.generateUrl('apps/audioplayer/getcover/');var divRow=$('
').addClass('coverrow');$.each(aAlbums,function(i,album){var addCss;var addDescr;if(album.cid===''){addCss='background-color: #D3D3D3;color: #333333;';addDescr=album.name.substring(0,1);}else{addDescr='';addCss='background-image:url('+getcoverUrl+album.cid+');-webkit-background-size:cover;-moz-background-size:cover;background-size:cover;';} - divAlbum=$('
').addClass('album').css('margin-left','15px').attr({'data-album':album.id,'data-name':album.name}).click($this.loadIndividualAlbums.bind($this));var divPlayHref=$('');var divPlayImage=$('').attr({'src':'img/play.png','style':'position: absolute;display: block;height: 30px;width: 30px;top: 115px;left: 5px;','id':'albumPlay'}).click($this.loadIndividualAlbums.bind($this));divPlayHref.append(divPlayImage);var divAlbumCover=$('
').addClass('albumcover').attr({'style':addCss}).text(addDescr);var divAlbumDescr=$('
').addClass('albumdescr').html(''+album.name+''+album.art+'');divAlbum.append(divAlbumCover);divAlbum.append(divAlbumDescr);divAlbum.append(divPlayImage);divRow.append(divAlbum);});$this.PlaylistContainer.append(divRow);};Audios.prototype.loadIndividualAlbums=function(evt){evt.stopPropagation();evt.preventDefault();var directPlay;if(typeof $(evt.target).attr('id')==='undefined'){directPlay=false;}else{directPlay=true;} - var eventTarget=$(evt.target).parent();var AlbumId=eventTarget.attr('data-album');var activeAlbum=$('.album[data-album="'+AlbumId+'"]');var activeAlbumContainer='.songcontainer';var iSlideUp=200;if(activeAlbum.hasClass('is-active')){$(activeAlbumContainer).slideUp(iSlideUp,function(){$('.album').removeClass('is-active').find('.artist').show();});}else{$('.album').removeClass('is-active').find('.artist').show();$this.PlaylistContainer.data('playlist','Albums-'+AlbumId);activeAlbum.addClass('is-active');activeAlbum.find('.artist').hide();$this.buildSongContainer(eventTarget,directPlay);}};Audios.prototype.buildSongContainer=function(eventTarget,directPlay){var AlbumId=eventTarget.attr('data-album');var AlbumName=eventTarget.attr('data-name');var activeAlbum=$('.album[data-album="'+AlbumId+'"]');var iArrowLeft=72;$(".songcontainer").remove();var divSongContainer=$('
').addClass('songcontainer');var divArrow=$('').addClass('open-arrow').css('left',activeAlbum.position().left+iArrowLeft);var divSongContainerInner=$('
').addClass('songcontainer-inner');var listAlbumWrapper=$('