Skip to content

Commit de4617c

Browse files
committed
Merge pull request #203 from Soundnode/develop
Latest features and improvements from develop
2 parents b954c0e + 04b2c0a commit de4617c

File tree

24 files changed

+573
-39
lines changed

24 files changed

+573
-39
lines changed

app/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ <h4 id="playerUser" class="player_user"></h4>
182182

183183
<!-- vendors -->
184184
<script src="public/js/vendor/jquery.min.js"></script>
185-
<script src="public/js/vendor/angular.js"></script>
185+
<script src="public/js/vendor/angular.min.1.3.8.js"></script>
186186
<script src="public/js/vendor/angular-ui-router.min.js"></script>
187187
<script src="public/js/vendor/hotkeys.min.js"></script>
188188
<script src="public/js/vendor/ng-infinite-scroll.min.js"></script>

app/public/js/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict'
1+
'use strict';
22

33
var app = angular.module('App', ['ui.router', 'ngSanitize', 'cfp.hotkeys', 'infinite-scroll', 'ngDialog']);
44

@@ -55,7 +55,7 @@ app.run(function($rootScope, $log, SCapiService, hotkeys) {
5555

5656
// shortcut to open devtools
5757
hotkeys.add({
58-
combo: 'command+/',
58+
combo: ['command+/', 'ctrl+/'],
5959
description: 'Open devtools',
6060
callback: function() {
6161
appGUI.openDevTools();
@@ -64,4 +64,4 @@ app.run(function($rootScope, $log, SCapiService, hotkeys) {
6464

6565
});
6666

67-
angular.module('infinite-scroll').value('THROTTLE_MILLISECONDS', 1500);
67+
angular.module('infinite-scroll').value('THROTTLE_MILLISECONDS', 1500);

app/public/js/common/SCapiService.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -206,11 +206,11 @@ app.service('SCapiService', function($http, $window, $q, $log, $state, $statePar
206206
return response.data;
207207
} else {
208208
//invalid response
209-
return $g.reject(response.data);
209+
return $q.reject(response.data);
210210
}
211211
}, function(response) {
212212
//something went wrong
213-
return $g.reject(response.data);
213+
return $q.reject(response.data);
214214
});
215215
};
216216

@@ -223,7 +223,7 @@ app.service('SCapiService', function($http, $window, $q, $log, $state, $statePar
223223
return response.data;
224224
} else {
225225
//invalid response
226-
return $g.reject(response.data);
226+
return $q.reject(response.data);
227227
}
228228
}, function(response) {
229229
//something went wrong, need to create a new error because returning the response object doesn't work. Get an unreferenced error when handling the reject.
@@ -243,7 +243,7 @@ app.service('SCapiService', function($http, $window, $q, $log, $state, $statePar
243243
return response.data;
244244
} else {
245245
//invalid response
246-
return $g.reject(response.data);
246+
return $q.reject(response.data);
247247
}
248248
}, function(response) {
249249
//something went wrong, need to create a new error because returning the response object doesn't work. Get an unreferenced error when handling the reject.
@@ -269,7 +269,7 @@ app.service('SCapiService', function($http, $window, $q, $log, $state, $statePar
269269
return response.data;
270270
} else {
271271
//invalid response
272-
return $g.reject(response.data);
272+
return $q.reject(response.data);
273273
}
274274
}, function(response) {
275275
//something went wrong which is good

app/public/js/common/appCtrl.js

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
'use strict'
1+
'use strict';
22

3-
app.controller('AppCtrl', function ($rootScope, $scope, $window, $log, ngDialog, hotkeys) {
3+
app.controller('AppCtrl', function ($rootScope, $scope, $window, $log, ngDialog) {
44

55
// Settings sub nav (dropdown)
66
$scope.isSettingsVisible = false;
@@ -11,7 +11,7 @@ app.controller('AppCtrl', function ($rootScope, $scope, $window, $log, ngDialog,
1111
} else {
1212
$scope.isSettingsVisible = true;
1313
}
14-
}
14+
};
1515

1616
// check if track has Art work
1717
// otherwise replace to Soundnode App logo
@@ -28,17 +28,16 @@ app.controller('AppCtrl', function ($rootScope, $scope, $window, $log, ngDialog,
2828

2929
// Format song duration on tracks
3030
// for human reading
31-
$scope.formatSongDuration = function(duration) {
31+
$scope.formatSongDuration = function (duration) {
3232
var minutes = Math.floor(duration / 60000)
3333
, seconds = ((duration % 60000) / 1000).toFixed(0);
34-
34+
3535
return minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
3636
};
3737

3838
/*
3939
* Navigation back and forward
4040
*/
41-
4241
$scope.goBack = function() {
4342
$window.history.back();
4443
};

app/public/js/common/favoriteSongDirective.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@ app.directive('favoriteSong', function($rootScope, $log, SCapiService, $timeout,
1919
that.classList.remove('clicked');
2020
}, 1000);
2121

22-
if ( attrs.favoriteAction ) {
22+
$log.log('favorite action', typeof attrs.favoriteAction);
23+
24+
if ( attrs.favoriteAction === 'true' ) {
25+
$log.log('inside true')
26+
2327
SCapiService.deleteFavorite(userId, songId)
2428
.then(function(status) {
2529
if ( typeof status == "object" ) {
@@ -35,7 +39,7 @@ app.directive('favoriteSong', function($rootScope, $log, SCapiService, $timeout,
3539
notify: true
3640
});
3741
});
38-
} else {
42+
} else if ( attrs.favoriteAction == 'false' ) {
3943
SCapiService.saveFavorite(userId, songId)
4044
.then(function(status) {
4145
if ( typeof status == "object" ) {

app/public/js/common/playerService.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,12 @@ app.factory('playerService', function($rootScope, $log) {
5151
* @method volume
5252
*/
5353
player.volume = function(value) {
54-
player.elPlayer.volume = value;
54+
if (typeof value === "undefined") {
55+
return player.elPlayer.volume;
56+
}
57+
if (value >= 0 && value <= 1) {
58+
player.elPlayer.volume = parseFloat(value).toFixed(1);
59+
}
5560
};
5661

5762
/**

app/public/js/common/tracksDirective.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ app.directive('tracks', function () {
44
return {
55
restrict: 'AE',
66
scope: { data: '=' },
7-
templateUrl: "views/partials/tracks.html"
7+
templateUrl: "views/common/tracks.html"
88
}
99
});

app/public/js/player/playerCtrl.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
'use strict'
22

3-
app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkeys, $log) {
3+
app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkeys, $log, $timeout) {
44
$scope.imgPath = 'public/img/temp-playing.png';
5+
$timeout(function() {
6+
$scope.volume = 0.5;
7+
});
58

69
/**
710
* Show/Hide volume range
@@ -131,7 +134,7 @@ app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkey
131134
});
132135

133136
hotkeys.add({
134-
combo: 'command+return',
137+
combo: ['command+return', 'ctrl+return'],
135138
description: 'Play/Pause song',
136139
callback: function() {
137140
if ( $rootScope.isSongPlaying ) {
@@ -143,7 +146,7 @@ app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkey
143146
});
144147

145148
hotkeys.add({
146-
combo: 'command+right',
149+
combo: ['command+right', 'ctrl+right'],
147150
description: 'Next song',
148151
callback: function() {
149152
if ( $rootScope.isSongPlaying ) {
@@ -153,7 +156,7 @@ app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkey
153156
});
154157

155158
hotkeys.add({
156-
combo: 'command+left',
159+
combo: ['command+left', 'ctrl+left'],
157160
description: 'Prev song',
158161
callback: function() {
159162
if ( $rootScope.isSongPlaying ) {
@@ -162,5 +165,25 @@ app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkey
162165
}
163166
});
164167

168+
hotkeys.add({
169+
combo: ['command+up', 'ctrl+up'],
170+
description: 'Volume Up',
171+
callback: function(e) {
172+
e.preventDefault();
173+
playerService.volume(playerService.volume() + 0.1);
174+
$scope.volume = playerService.volume();
175+
}
176+
});
177+
178+
hotkeys.add({
179+
combo: ['command+down', 'ctrl+down'],
180+
description: 'Volume Down',
181+
callback: function(e) {
182+
e.preventDefault();
183+
playerService.volume(playerService.volume() - 0.1);
184+
$scope.volume = playerService.volume();
185+
}
186+
});
187+
165188

166189
});

app/public/js/stream/streamCtrl.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
'use strict'
1+
'use strict';
22

33
app.controller('StreamCtrl', function ($scope, SCapiService, $rootScope) {
44
var endpoint = 'me/activities'

0 commit comments

Comments
 (0)