Skip to content

Commit

Permalink
Merge pull request #203 from Soundnode/develop
Browse files Browse the repository at this point in the history
Latest features and improvements from develop
  • Loading branch information
weblancaster committed Jan 20, 2015
2 parents b954c0e + 04b2c0a commit de4617c
Show file tree
Hide file tree
Showing 24 changed files with 573 additions and 39 deletions.
2 changes: 1 addition & 1 deletion app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ <h4 id="playerUser" class="player_user"></h4>

<!-- vendors -->
<script src="public/js/vendor/jquery.min.js"></script>
<script src="public/js/vendor/angular.js"></script>
<script src="public/js/vendor/angular.min.1.3.8.js"></script>
<script src="public/js/vendor/angular-ui-router.min.js"></script>
<script src="public/js/vendor/hotkeys.min.js"></script>
<script src="public/js/vendor/ng-infinite-scroll.min.js"></script>
Expand Down
6 changes: 3 additions & 3 deletions app/public/js/app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'
'use strict';

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

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

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

});

angular.module('infinite-scroll').value('THROTTLE_MILLISECONDS', 1500);
angular.module('infinite-scroll').value('THROTTLE_MILLISECONDS', 1500);
10 changes: 5 additions & 5 deletions app/public/js/common/SCapiService.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,11 @@ app.service('SCapiService', function($http, $window, $q, $log, $state, $statePar
return response.data;
} else {
//invalid response
return $g.reject(response.data);
return $q.reject(response.data);
}
}, function(response) {
//something went wrong
return $g.reject(response.data);
return $q.reject(response.data);
});
};

Expand All @@ -223,7 +223,7 @@ app.service('SCapiService', function($http, $window, $q, $log, $state, $statePar
return response.data;
} else {
//invalid response
return $g.reject(response.data);
return $q.reject(response.data);
}
}, function(response) {
//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.
Expand All @@ -243,7 +243,7 @@ app.service('SCapiService', function($http, $window, $q, $log, $state, $statePar
return response.data;
} else {
//invalid response
return $g.reject(response.data);
return $q.reject(response.data);
}
}, function(response) {
//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.
Expand All @@ -269,7 +269,7 @@ app.service('SCapiService', function($http, $window, $q, $log, $state, $statePar
return response.data;
} else {
//invalid response
return $g.reject(response.data);
return $q.reject(response.data);
}
}, function(response) {
//something went wrong which is good
Expand Down
11 changes: 5 additions & 6 deletions app/public/js/common/appCtrl.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'
'use strict';

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

// Settings sub nav (dropdown)
$scope.isSettingsVisible = false;
Expand All @@ -11,7 +11,7 @@ app.controller('AppCtrl', function ($rootScope, $scope, $window, $log, ngDialog,
} else {
$scope.isSettingsVisible = true;
}
}
};

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

// Format song duration on tracks
// for human reading
$scope.formatSongDuration = function(duration) {
$scope.formatSongDuration = function (duration) {
var minutes = Math.floor(duration / 60000)
, seconds = ((duration % 60000) / 1000).toFixed(0);

return minutes + ":" + (seconds < 10 ? '0' : '') + seconds;
};

/*
* Navigation back and forward
*/

$scope.goBack = function() {
$window.history.back();
};
Expand Down
8 changes: 6 additions & 2 deletions app/public/js/common/favoriteSongDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@ app.directive('favoriteSong', function($rootScope, $log, SCapiService, $timeout,
that.classList.remove('clicked');
}, 1000);

if ( attrs.favoriteAction ) {
$log.log('favorite action', typeof attrs.favoriteAction);

if ( attrs.favoriteAction === 'true' ) {
$log.log('inside true')

SCapiService.deleteFavorite(userId, songId)
.then(function(status) {
if ( typeof status == "object" ) {
Expand All @@ -35,7 +39,7 @@ app.directive('favoriteSong', function($rootScope, $log, SCapiService, $timeout,
notify: true
});
});
} else {
} else if ( attrs.favoriteAction == 'false' ) {
SCapiService.saveFavorite(userId, songId)
.then(function(status) {
if ( typeof status == "object" ) {
Expand Down
7 changes: 6 additions & 1 deletion app/public/js/common/playerService.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ app.factory('playerService', function($rootScope, $log) {
* @method volume
*/
player.volume = function(value) {
player.elPlayer.volume = value;
if (typeof value === "undefined") {
return player.elPlayer.volume;
}
if (value >= 0 && value <= 1) {
player.elPlayer.volume = parseFloat(value).toFixed(1);
}
};

/**
Expand Down
2 changes: 1 addition & 1 deletion app/public/js/common/tracksDirective.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ app.directive('tracks', function () {
return {
restrict: 'AE',
scope: { data: '=' },
templateUrl: "views/partials/tracks.html"
templateUrl: "views/common/tracks.html"
}
});
31 changes: 27 additions & 4 deletions app/public/js/player/playerCtrl.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
'use strict'

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

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

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

hotkeys.add({
combo: 'command+right',
combo: ['command+right', 'ctrl+right'],
description: 'Next song',
callback: function() {
if ( $rootScope.isSongPlaying ) {
Expand All @@ -153,7 +156,7 @@ app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkey
});

hotkeys.add({
combo: 'command+left',
combo: ['command+left', 'ctrl+left'],
description: 'Prev song',
callback: function() {
if ( $rootScope.isSongPlaying ) {
Expand All @@ -162,5 +165,25 @@ app.controller('PlayerCtrl', function ($scope, $rootScope, playerService, hotkey
}
});

hotkeys.add({
combo: ['command+up', 'ctrl+up'],
description: 'Volume Up',
callback: function(e) {
e.preventDefault();
playerService.volume(playerService.volume() + 0.1);
$scope.volume = playerService.volume();
}
});

hotkeys.add({
combo: ['command+down', 'ctrl+down'],
description: 'Volume Down',
callback: function(e) {
e.preventDefault();
playerService.volume(playerService.volume() - 0.1);
$scope.volume = playerService.volume();
}
});


});
2 changes: 1 addition & 1 deletion app/public/js/stream/streamCtrl.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
'use strict'
'use strict';

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

0 comments on commit de4617c

Please sign in to comment.