Compensating for dynamic player height

This commit is contained in:
Josef Citrine 2016-07-17 13:17:09 +01:00
parent 3901313ed5
commit b527f9c600
2 changed files with 9 additions and 3 deletions

View file

@ -52,8 +52,7 @@ module.exports = angular.module('ponyfm').controller "application", [
$rootScope.$on 'player-starting-track', () -> $rootScope.$on 'player-starting-track', () ->
$scope.isPlaying = true $scope.isPlaying = true
windowHeight = $(window).height() window.isPlaying = true
$('.site-body').height windowHeight - ($('.top-bar').height() + $('.now-playing').height())
$rootScope.$on 'player-stopping', () -> $rootScope.$on 'player-stopping', () ->
$scope.isPlaying = false $scope.isPlaying = false

View file

@ -14,12 +14,17 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
window.isPlaying = false
window.handleResize = () -> window.handleResize = () ->
windowHeight = $(window).height() windowHeight = $(window).height()
windowWidth = $(window).width() windowWidth = $(window).width()
isMobile = windowWidth <= 480 isMobile = windowWidth <= 480
$siteBody = $ '.site-body' $siteBody = $ '.site-body'
if window.isPlaying
$siteBody.height windowHeight - ($('.top-bar').height() + $('.now-playing').height())
else
$siteBody.height windowHeight - $('.top-bar').height() $siteBody.height windowHeight - $('.top-bar').height()
$('.dropdown-menu').each () -> $('.dropdown-menu').each () ->
@ -32,6 +37,8 @@ window.handleResize = () ->
if !isMobile if !isMobile
$this = $ this $this = $ this
newHeight = windowHeight - $this.offset().top newHeight = windowHeight - $this.offset().top
if window.isPlaying
newHeight = newHeight - $('.now-playing').height()
if newHeight > 0 if newHeight > 0
$this.height newHeight $this.height newHeight