When changing song, if fancybox is open, opens the new song's cover art in it
- Fixes a bug with the Page service. There was an error when changing songs. - Removes fancyboxOpenImage from utils, it's directly in the main controller so we can call it from the directive. It didn't need to be in a service anymore since we have a player directive.
This commit is contained in:
parent
c478f0116f
commit
3324113af8
5 changed files with 28 additions and 18 deletions
|
@ -148,7 +148,20 @@ angular.module('JamStash')
|
|||
};
|
||||
|
||||
$scope.fancyboxOpenImage = function (url) {
|
||||
utils.fancyboxOpenImage(url);
|
||||
$.fancybox.open({
|
||||
helpers : {
|
||||
overlay : {
|
||||
css : {
|
||||
'background' : 'rgba(0, 0, 0, 0.15)'
|
||||
}
|
||||
}
|
||||
},
|
||||
hideOnContentClick: true,
|
||||
type: 'image',
|
||||
openEffect: 'none',
|
||||
closeEffect: 'none',
|
||||
href: url
|
||||
});
|
||||
};
|
||||
|
||||
$('#audiocontainer .scrubber').mouseover(function (e) {
|
||||
|
|
|
@ -49,7 +49,7 @@ angular.module('jamstash.page', ['jamstash.settings', 'jamstash.utils'])
|
|||
}
|
||||
t.push(" ");
|
||||
if (timer !== undefined) {
|
||||
timer.cancel();
|
||||
$interval.cancel(timer);
|
||||
}
|
||||
timer = $interval(function () {
|
||||
var f = shift[opts.dir];
|
||||
|
|
|
@ -8,22 +8,6 @@ angular.module('jamstash.utils', ['jamstash.settings'])
|
|||
.service('utils', ['$rootScope', 'globals', function ($rootScope, globals) {
|
||||
'use strict';
|
||||
|
||||
this.fancyboxOpenImage = function (url) {
|
||||
$.fancybox.open({
|
||||
helpers : {
|
||||
overlay : {
|
||||
css : {
|
||||
'background' : 'rgba(0, 0, 0, 0.15)'
|
||||
}
|
||||
}
|
||||
},
|
||||
hideOnContentClick: true,
|
||||
type: 'image',
|
||||
openEffect: 'none',
|
||||
closeEffect: 'none',
|
||||
href: url
|
||||
});
|
||||
};
|
||||
this.safeApply = function (fn) {
|
||||
var phase = $rootScope.$root.$$phase;
|
||||
if (phase === '$apply' || phase === '$digest') {
|
||||
|
|
|
@ -92,6 +92,9 @@ angular.module('jamstash.player.directive', ['jamstash.player.service', 'jamstas
|
|||
if(newSong !== undefined) {
|
||||
scope.currentSong = newSong;
|
||||
Page.setTitleSong(newSong);
|
||||
if($.fancybox.isOpen) {
|
||||
scope.fancyboxOpenImage(newSong.coverartfull);
|
||||
}
|
||||
$player.jPlayer('setMedia', {'mp3': newSong.url});
|
||||
if(playerService.loadSong === true) {
|
||||
// Do not play, only load
|
||||
|
|
|
@ -45,6 +45,7 @@ describe("jplayer directive", function() {
|
|||
deferred = $q.defer();
|
||||
});
|
||||
spyOn(Page, "setTitleSong");
|
||||
$.fancybox.isOpen = false;
|
||||
$player = element.children('div');
|
||||
});
|
||||
|
||||
|
@ -94,6 +95,15 @@ describe("jplayer directive", function() {
|
|||
expect(notifications.showNotification).toHaveBeenCalledWith(playingSong);
|
||||
});
|
||||
});
|
||||
|
||||
it("if fancybox is open, it sets it up with the new song's cover art", function() {
|
||||
$.fancybox.isOpen = true;
|
||||
scope.fancyboxOpenImage = jasmine.createSpy("fancyboxOpenImage");
|
||||
|
||||
scope.$apply();
|
||||
|
||||
expect(scope.fancyboxOpenImage).toHaveBeenCalledWith(playingSong.coverartfull);
|
||||
});
|
||||
});
|
||||
|
||||
it("When the player service's restartSong flag is true, it restarts the current song, resets the restart flag to false and resets the scrobbled flag to false", function() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue