diff --git a/js/app/controllers/playercontroller.js b/js/app/controllers/playercontroller.js index 1ffaf20ed..7992b7bc3 100644 --- a/js/app/controllers/playercontroller.js +++ b/js/app/controllers/playercontroller.js @@ -36,8 +36,8 @@ angular.module('Music').controller('PlayerController', $scope.repeat = false; $scope.shuffle = false; + // TODO don't use jQuery $scope.$playPosition = $('.play-position'); - $scope.$loadPosition = $('.load-position'); $scope.$bufferBar = $('.buffer-bar'); $scope.$playBar = $('.play-bar'); @@ -93,13 +93,12 @@ angular.module('Music').controller('PlayerController', $scope.player.play(); $scope.setPlay(true); - $scope.player.on("buffer", function (percent) { - $scope.setBufferPercent(parseInt(percent)); - if (percent == 100) { - $scope.setBuffering(false); - } + $scope.setBuffering(false); + + $scope.player.on('buffer', function (percent) { + $scope.setBufferPercentage(parseInt(percent)); }); - $scope.player.on("progress", function (currentTime) { + $scope.player.on('progress', function (currentTime) { $scope.setTime(currentTime/1000, $scope.player.duration/1000); }); $scope.player.on('end', function() { @@ -166,8 +165,7 @@ angular.module('Music').controller('PlayerController', $scope.$playBar.css('width', (position / duration * 100) + '%'); }; - $scope.setBufferPercent = function(percent) { - $scope.$loadPosition.text(gettext("Loading...") + percent + '%'); + $scope.setBufferPercentage = function(percent) { $scope.$bufferBar.css('width', percent + '%'); }; @@ -182,11 +180,7 @@ angular.module('Music').controller('PlayerController', $scope.setPlay(true); } else { $scope.player.togglePlayback(); - if($scope.playing) { - $scope.playing=false; - } else { - $scope.playing=true; - } + $scope.playing = !$scope.playing; } }; diff --git a/js/public/app.js b/js/public/app.js index e49f4baf3..66f84424d 100644 --- a/js/public/app.js +++ b/js/public/app.js @@ -1,3 +1,4 @@ + // fix SVGs in IE because the scaling is a real PITA // https://github.com/owncloud/music/issues/126 if($('html').hasClass('ie')) { @@ -298,8 +299,8 @@ angular.module('Music').controller('PlayerController', $scope.repeat = false; $scope.shuffle = false; + // TODO don't use jQuery $scope.$playPosition = $('.play-position'); - $scope.$loadPosition = $('.load-position'); $scope.$bufferBar = $('.buffer-bar'); $scope.$playBar = $('.play-bar'); @@ -355,13 +356,12 @@ angular.module('Music').controller('PlayerController', $scope.player.play(); $scope.setPlay(true); - $scope.player.on("buffer", function (percent) { - $scope.setBufferPercent(parseInt(percent)); - if (percent == 100) { - $scope.setBuffering(false); - } + $scope.setBuffering(false); + + $scope.player.on('buffer', function (percent) { + $scope.setBufferPercentage(parseInt(percent)); }); - $scope.player.on("progress", function (currentTime) { + $scope.player.on('progress', function (currentTime) { $scope.setTime(currentTime/1000, $scope.player.duration/1000); }); $scope.player.on('end', function() { @@ -428,8 +428,7 @@ angular.module('Music').controller('PlayerController', $scope.$playBar.css('width', (position / duration * 100) + '%'); }; - $scope.setBufferPercent = function(percent) { - $scope.$loadPosition.text(gettext("Loading...") + percent + '%'); + $scope.setBufferPercentage = function(percent) { $scope.$bufferBar.css('width', percent + '%'); }; @@ -444,11 +443,7 @@ angular.module('Music').controller('PlayerController', $scope.setPlay(true); } else { $scope.player.togglePlayback(); - if($scope.playing) { - $scope.playing=false; - } else { - $scope.playing=true; - } + $scope.playing = !$scope.playing; } }; @@ -818,4 +813,4 @@ angular.module('Music').run(['gettextCatalog', function (gettextCatalog) { gettextCatalog.setStrings('zh_HK', {"Music":"音樂","Next":"下一首","Pause":"暫停","Play":"播放","Previous":"上一首"}); gettextCatalog.setStrings('zh_TW', {"Albums":"專輯","Artists":"歌手","Description":"描述","Description (e.g. App name)":"描述 (例: App 名稱)","Generate API password":"產生 API 密碼","Invalid path":"無效的路徑","Loading ...":"載入中…","Music":"音樂","Next":"下一個","Pause":"暫停","Play":"播放","Previous":"上一個","Repeat":"重覆","Revoke API password":"撤銷 API 密碼","Shuffle":"隨機播放","Some not playable tracks were skipped.":"部份無法播放的曲目已跳過。","Tracks":"曲目","Unknown album":"未知的專輯","Unknown artist":"未知的歌手"}); /* jshint +W100 */ -}]); \ No newline at end of file +}]); diff --git a/templates/main.php b/templates/main.php index d03ae6232..6a93fc989 100644 --- a/templates/main.php +++ b/templates/main.php @@ -71,7 +71,7 @@
  - Loading... + Loading...