Skip to content

Commit b19326c

Browse files
committed
Merge pull request #30 from jaedb/release/2.4.3
Release/2.4.3
2 parents e5c774a + 5124829 commit b19326c

24 files changed

Lines changed: 399 additions & 265 deletions

app/app.js

Lines changed: 15 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ angular.module('spotmop', [
1717
'spotmop.common.contextmenu',
1818
'spotmop.common.tracklist',
1919

20+
'spotmop.services.notify',
2021
'spotmop.services.settings',
2122
'spotmop.services.player',
2223
'spotmop.services.spotify',
@@ -27,7 +28,6 @@ angular.module('spotmop', [
2728
'spotmop.player',
2829
'spotmop.queue',
2930
'spotmop.library',
30-
'spotmop.playlists',
3131
'spotmop.search',
3232
'spotmop.settings',
3333

@@ -60,7 +60,7 @@ angular.module('spotmop', [
6060
/**
6161
* Global controller
6262
**/
63-
.controller('ApplicationController', function ApplicationController( $scope, $rootScope, $state, $localStorage, $timeout, $location, SpotifyService, MopidyService, EchonestService, PlayerService, SettingsService ){
63+
.controller('ApplicationController', function ApplicationController( $scope, $rootScope, $state, $localStorage, $timeout, $location, SpotifyService, MopidyService, EchonestService, PlayerService, SettingsService, NotifyService ){
6464

6565
$scope.isTouchDevice = function(){
6666
if( SettingsService.getSetting('emulateTouchDevice',false) )
@@ -130,8 +130,8 @@ angular.module('spotmop', [
130130
SettingsService.getVersion()
131131
.success( function(response){
132132
if( !currentVersion || currentVersion != response.versionCode ){
133-
SettingsService.setSetting('version',response.versionCode)
134-
$scope.$broadcast('spotmop:notifyUser', {id: 'updated', message: 'Spotmop has been updated - please clear your browser cache', autoremove: 5000});
133+
SettingsService.setSetting('version',response.versionCode);
134+
NotifyService.notify( 'Spotmop has been updated - please clear your browser cache' );
135135
}
136136
});
137137

@@ -241,44 +241,6 @@ angular.module('spotmop', [
241241
if( SettingsService.getSetting('echonestenabled',false) )
242242
EchonestService.addToTasteProfile( 'play', tlTrack.tl_track.track.uri );
243243
});
244-
245-
246-
/**
247-
* User notifications
248-
* Displays a user-friendly notification. Can be error, loader or tip
249-
**/
250-
$scope.$on('spotmop:notifyUser', function( event, data ){
251-
252-
// handle undefined errors
253-
if( typeof(data.type) === 'undefined' )
254-
data.type = '';
255-
256-
// if we're a keyboard shortcut notification, this requires icon injection
257-
if( data.type == 'keyboard-shortcut' ){
258-
data.message = '<i class="fa fa-'+data.icon+'"></i>';
259-
}
260-
261-
// default to autoremove
262-
if( typeof(data.autoremove) === 'undefined' )
263-
data.autoremove = true;
264-
265-
// remove any existing notifications of this type (using notification id)
266-
$(document).find('#notifications .notification-item[data-id="'+data.id+'"]').remove();;
267-
268-
var container = $(document).find('#notifications');
269-
var notification = '<div class="notification-item '+data.type+'" data-id="'+data.id+'">'+data.message+'</div>';
270-
container.append( notification );
271-
notification = $(document).find('#notifications .notification-item[data-id="'+data.id+'"]');
272-
273-
if( data.autoremove ){
274-
$timeout(
275-
function(){
276-
notification.fadeOut(200, function(){ notification.remove() } );
277-
},
278-
2500
279-
);
280-
}
281-
});
282244

283245

284246

@@ -318,7 +280,7 @@ angular.module('spotmop', [
318280
$scope.spotifyUser = response;
319281

320282
if( typeof(response.error) !== 'undefined' ){
321-
$scope.$broadcast('spotmop:notifyUser', {type: 'error', message: response.error.message});
283+
NotifyService.error( response.error.message );
322284
}else{
323285
$rootScope.spotifyOnline = true;
324286

@@ -408,12 +370,12 @@ angular.module('spotmop', [
408370
* When we click anywhere
409371
* This allows us to kill context menus, unselect tracks, etc
410372
**/
411-
$(document).on('mouseup', 'body', function( evt ){
373+
$(document).on('mouseup', 'body', function( event ){
412374

413375
// if we've clicked OUTSIDE of a tracklist, let's kill the context menu
414376
// clicking INSIDE the tracklist is handled by the track/tltrack directives
415-
if( $(evt.target).closest('.tracklist').length <= 0 ){
416-
$rootScope.$broadcast('spotmop:hideContextMenu');
377+
if( $(event.target).closest('.tracklist').length <= 0 ){
378+
$rootScope.$broadcast('spotmop:contextMenu:hide');
417379
}
418380
});
419381

@@ -504,21 +466,16 @@ angular.module('spotmop', [
504466

505467
// dropping on queue
506468
if( isMenuItem && target.attr('data-type') === 'queue' ){
507-
508-
$rootScope.requestsLoading++;
509469

510470
if( uris.length > 10 ){
511-
$scope.$broadcast('spotmop:notifyUser', {type: 'loading', id: 'adding-to-queue', message: 'Adding '+uris.length+' track(s) to queue... this could take some time'});
471+
NotifyService.notify( 'Adding '+uris.length+' track(s) to queue... this could take some time' );
512472
}
513473

514-
MopidyService.addToTrackList( uris ).then( function(response){
515-
$rootScope.requestsLoading--;
516-
$scope.$broadcast('spotmop:notifyUserRemoval', {id: 'adding-to-queue'});
517-
});
474+
MopidyService.addToTrackList( uris );
518475

519476
// dropping on library
520477
}else if( isMenuItem && target.attr('data-type') === 'library' ){
521-
478+
522479
// convert all our URIs to IDs
523480
var trackids = new Array();
524481
$.each( uris, function(key,value){
@@ -548,6 +505,10 @@ angular.module('spotmop', [
548505
// sorting queue tracklist
549506
if( track.closest('.tracklist').hasClass('queue-items') ){
550507

508+
// destination position needs to account for length of selection offset, if we're dragging DOWN the list
509+
if( to_position >= end )
510+
to_position = to_position - uris.length;
511+
551512
// note: mopidy want's the first track AFTER our range, so we need to +1
552513
MopidyService.moveTlTracks( start, end + 1, to_position );
553514

app/browse/artist/controller.js

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ angular.module('spotmop.browse.artist', [])
4141
/**
4242
* Main controller
4343
**/
44-
.controller('ArtistController', function ( $scope, $rootScope, $timeout, $interval, $stateParams, $sce, SpotifyService, SettingsService, EchonestService ){
44+
.controller('ArtistController', function ( $scope, $rootScope, $timeout, $interval, $stateParams, $sce, SpotifyService, SettingsService, EchonestService, NotifyService ){
4545

4646
$scope.artist = {};
4747
$scope.tracklist = {type: 'track'};
@@ -60,7 +60,7 @@ angular.module('spotmop.browse.artist', [])
6060
});
6161
}
6262
$scope.playArtistRadio = function(){
63-
$scope.$emit('spotmop:notifyUser', {id: 'notimplemented', message: 'This functionality has not yet been implemented', autoremove: 2000});
63+
NotifyService.error( 'This functionality has not yet been implemented' );
6464
/*
6565
EchonestService.startArtistRadio( $scope.artist.name )
6666
.then( function( response ){
@@ -86,33 +86,6 @@ angular.module('spotmop.browse.artist', [])
8686
.then( function( response ){
8787
$scope.relatedArtists = response.artists;
8888
});
89-
90-
91-
// setup initial variables
92-
var scrollTop = 0;
93-
94-
$interval(
95-
function(){
96-
window.requestAnimationFrame(function( event ){
97-
98-
// if we've scrolled
99-
if( scrollTop != $('.scrolling-panel').scrollTop() ){
100-
scrollTop = $('.scrolling-panel').scrollTop();
101-
102-
var bannerHeight = $(document).find('.artist-intro').outerHeight();
103-
104-
// and if we're within the bounds of our document
105-
// this helps prevent us animating when the objects in question are off-screen
106-
if( scrollTop < bannerHeight ){
107-
var percent = Math.round( scrollTop / bannerHeight * 100 );
108-
var position = Math.round( (bannerHeight / 2) * (percent/100) ) - 100;
109-
$(document).find('.intro preloadedimage').css('background-position', '50% '+position+'px');
110-
}
111-
}
112-
});
113-
},
114-
10
115-
);
11689
})
11790

11891

app/browse/artist/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<div class="intro artist-intro">
55

66
<div class="image-container" ng-repeat="image in artist.images | limitTo:1">
7-
<preloadedimage class="image blur" url="{{ image.url }}" useproxy="true" detectbackground="true" opacity="0.7"></preloadedimage>
7+
<backgroundparallax class="image" image="{{ image }}" useproxy="true" detectbackground="true" opacity="0.5"></backgroundparallax>
88
</div>
99

1010
<div class="inner" text-over-image>

app/browse/new/controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ angular.module('spotmop.browse.new', [])
2929
.then(function( response ) {
3030
$scope.albums = response.albums;
3131
});
32-
33-
32+
33+
3434
/**
3535
* Load more of the category's playlists
3636
* Triggered by scrolling to the bottom

app/browse/new/template.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<div class="page new-releases-page scrolling-panel">
22
<div class="inner">
3+
4+
<h1>New releases</h1>
35

46
<div class="album-items square-panels">
57

app/browse/playlist/controller.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ angular.module('spotmop.browse.playlist', [])
1717
/**
1818
* Main controller
1919
**/
20-
.controller('PlaylistController', function PlaylistController( $scope, $rootScope, $filter, $state, $stateParams, $sce, SpotifyService, MopidyService, SettingsService, DialogService ){
20+
.controller('PlaylistController', function PlaylistController( $scope, $rootScope, $filter, $state, $stateParams, $sce, SpotifyService, MopidyService, SettingsService, DialogService, NotifyService ){
2121

2222
// setup base variables
2323
$scope.playlist = {images: []};
@@ -28,23 +28,23 @@ angular.module('spotmop.browse.playlist', [])
2828
SpotifyService.followPlaylist( $stateParams.uri )
2929
.then( function(response){
3030
$scope.following = true;
31-
$rootScope.$broadcast('spotmop:notifyUser', {id: 'following-playlist', message: 'Following playlist', autoremove: true});
31+
NotifyService.notify( 'Following playlist' );
3232
$scope.updatePlaylists();
3333
});
3434
}
3535
$scope.unfollowPlaylist = function(){
3636
SpotifyService.unfollowPlaylist( $stateParams.uri )
3737
.then( function(response){
3838
$scope.following = false;
39-
$rootScope.$broadcast('spotmop:notifyUser', {id: 'removing-playlist', message: 'Playlist removed', autoremove: true});
39+
NotifyService.notify( 'Playlist removed' );
4040
$scope.updatePlaylists();
4141
});
4242
}
4343
$scope.recoverPlaylist = function(){
4444
SpotifyService.followPlaylist( $stateParams.uri )
4545
.then( function(response){
4646
$scope.following = true;
47-
$rootScope.$broadcast('spotmop:notifyUser', {id: 'recovering-playlist', message: 'Playlist recovered', autoremove: true});
47+
NotifyService.notify( 'Playlist recovered' );
4848
$scope.updatePlaylists();
4949
});
5050
}
@@ -158,7 +158,7 @@ angular.module('spotmop.browse.playlist', [])
158158

159159
// make sure the current spotify user owns this playlist
160160
if( $scope.playlist.owner.id !== SettingsService.getSetting('spotifyuserid') ){
161-
$rootScope.$broadcast('spotmop:notifyUser', {type: 'bad', id: 'deleting-from-playlist', message: 'Cannot delete from a playlist you don\'t own', autoremove: true});
161+
NotifyService.error( 'Cannot delete from a playlist you don\'t own' );
162162

163163
// we own it, proceed sir
164164
}else{

0 commit comments

Comments
 (0)