Modifies all the controllers to access the Jamstash module through angular instead of a global var.
This commit is contained in:
parent
0729a3a117
commit
85dac2d244
10 changed files with 44 additions and 19 deletions
13
index.html
13
index.html
|
@ -31,17 +31,22 @@
|
||||||
<script src="js/plugins/UnityShim.js" type="text/javascript"></script>
|
<script src="js/plugins/UnityShim.js" type="text/javascript"></script>
|
||||||
<script src="bower_components/jplayer/jquery.jplayer/jquery.jplayer.js" type="text/javascript"></script>
|
<script src="bower_components/jplayer/jquery.jplayer/jquery.jplayer.js" type="text/javascript"></script>
|
||||||
<script src="bower_components/notify.js/notify.js" type="text/javascript"></script>
|
<script src="bower_components/notify.js/notify.js" type="text/javascript"></script>
|
||||||
|
<!-- our scripts -->
|
||||||
<script src="js/app.js" type="text/javascript"></script>
|
<script src="js/app.js" type="text/javascript"></script>
|
||||||
<script src="js/services/globals-service.js" type="text/javascript"></script>
|
<script src="js/services/globals-service.js" type="text/javascript"></script>
|
||||||
<script src="js/services/model-service.js" type="text/javascript"></script>
|
<script src="js/services/model-service.js" type="text/javascript"></script>
|
||||||
<script src="js/service.js" type="text/javascript"></script>
|
<script src="js/services/utils-service.js" type="text/javascript"></script>
|
||||||
<script src="js/utils.js" type="text/javascript"></script>
|
<script src="js/services/notification-service.js" type="text/javascript"></script>
|
||||||
|
<script src="js/services/subsonic-service.js" type="text/javascript"></script>
|
||||||
|
<script src="js/services/archive-service.js" type="text/javascript"></script>
|
||||||
|
<script src="js/services/player-service.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/main.js" type="text/javascript"></script>
|
<script src="js/controllers/main.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/settings.js" type="text/javascript"></script>
|
<script src="js/controllers/settings.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/subsonicCtrl.js" type="text/javascript"></script>
|
<script src="js/controllers/subsonic.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/archive.js" type="text/javascript"></script>
|
<script src="js/controllers/archive.js" type="text/javascript"></script>
|
||||||
<script src="js/controllers/queue.js"></script>
|
<script src="js/controllers/queue.js"></script>
|
||||||
<script src="js/player.js" type="text/javascript"></script>
|
<script src="js/filters/filters.js"></script>
|
||||||
|
<script src="js/directives/directives.js"></script>
|
||||||
</head>
|
</head>
|
||||||
<body ng-controller="AppCtrl">
|
<body ng-controller="AppCtrl">
|
||||||
<div id="container">
|
<div id="container">
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
JamStash.controller('ArchiveCtrl',
|
'use strict';
|
||||||
|
|
||||||
|
var jamstash = angular.module('JamStash');
|
||||||
|
|
||||||
|
jamstash.controller('ArchiveCtrl',
|
||||||
function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, $timeout, utils, globals, model, notifications, player, archive, json) {
|
function ArchiveCtrl($scope, $rootScope, $location, $routeParams, $http, $timeout, utils, globals, model, notifications, player, archive, json) {
|
||||||
$scope.settings = globals.settings;
|
$scope.settings = globals.settings;
|
||||||
$scope.itemType = 'archive';
|
$scope.itemType = 'archive';
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
JamStash.controller('AppCtrl',
|
'use strict';
|
||||||
|
|
||||||
|
var jamstash = angular.module('JamStash');
|
||||||
|
|
||||||
|
jamstash.controller('AppCtrl',
|
||||||
function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore, utils, globals, model, notifications, player) {
|
function AppCtrl($scope, $rootScope, $document, $window, $location, $cookieStore, utils, globals, model, notifications, player) {
|
||||||
$rootScope.settings = globals.settings;
|
$rootScope.settings = globals.settings;
|
||||||
$rootScope.song = [];
|
$rootScope.song = [];
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
JamStash.controller('PodcastCtrl',
|
'use strict';
|
||||||
|
|
||||||
|
var jamstash = angular.module('JamStash');
|
||||||
|
|
||||||
|
jamstash.controller('PodcastCtrl',
|
||||||
function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notifications) {
|
function PodcastCtrl($scope, $rootScope, $location, utils, globals, model, notifications) {
|
||||||
$rootScope.song = [];
|
$rootScope.song = [];
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
JamStash.controller('QueueCtrl',
|
'use strict';
|
||||||
|
|
||||||
|
var jamstash = angular.module('JamStash');
|
||||||
|
|
||||||
|
jamstash.controller('QueueCtrl',
|
||||||
function QueueCtrl($scope, $rootScope, $routeParams, $location, utils, globals, json, notifications) {
|
function QueueCtrl($scope, $rootScope, $routeParams, $location, utils, globals, json, notifications) {
|
||||||
$scope.settings = globals.settings;
|
$scope.settings = globals.settings;
|
||||||
$scope.song = $rootScope.queue;
|
$scope.song = $rootScope.queue;
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
JamStash.controller('SettingsCtrl',
|
'use strict';
|
||||||
|
|
||||||
|
var jamstash = angular.module('JamStash');
|
||||||
|
|
||||||
|
jamstash.controller('SettingsCtrl',
|
||||||
function SettingsCtrl($rootScope, $scope, $routeParams, $location, utils, globals, json, notifications, player) {
|
function SettingsCtrl($rootScope, $scope, $routeParams, $location, utils, globals, json, notifications, player) {
|
||||||
$scope.settings = globals.settings; /* See service.js */
|
$scope.settings = globals.settings; /* See service.js */
|
||||||
$scope.Timeouts = [
|
$scope.Timeouts = [
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var Jamstash = angular.module('JamStash');
|
var jamstash = angular.module('JamStash');
|
||||||
|
|
||||||
Jamstash.controller('SubsonicCtrl',
|
jamstash.controller('SubsonicCtrl',
|
||||||
function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $http, utils, globals, model, map, subsonic, notifications) {
|
function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $http, utils, globals, model, map, subsonic, notifications) {
|
||||||
|
|
||||||
$scope.settings = globals.settings;
|
$scope.settings = globals.settings;
|
|
@ -33,7 +33,7 @@ jamstash.service('player', function ($rootScope, $window, utils, globals, model,
|
||||||
$rootScope.restartSong();
|
$rootScope.restartSong();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
getNextSong = function (previous) {
|
this.getNextSong = function (previous) {
|
||||||
var song;
|
var song;
|
||||||
if (globals.settings.Debug) { console.log('Getting Next Song > ' + 'Queue length: ' + $rootScope.queue.length); }
|
if (globals.settings.Debug) { console.log('Getting Next Song > ' + 'Queue length: ' + $rootScope.queue.length); }
|
||||||
if ($rootScope.queue.length > 0) {
|
if ($rootScope.queue.length > 0) {
|
||||||
|
@ -361,7 +361,7 @@ jamstash.service('player', function ($rootScope, $window, utils, globals, model,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
playVideo = function (id, bitrate) {
|
this.playVideo = function (id, bitrate) {
|
||||||
var w, h;
|
var w, h;
|
||||||
bitrate = parseInt(bitrate);
|
bitrate = parseInt(bitrate);
|
||||||
if (bitrate <= 600) {
|
if (bitrate <= 600) {
|
||||||
|
@ -392,7 +392,7 @@ jamstash.service('player', function ($rootScope, $window, utils, globals, model,
|
||||||
supplied: "m4v"
|
supplied: "m4v"
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
scrobbleSong = function (submission) {
|
this.scrobbleSong = function (submission) {
|
||||||
if ($rootScope.loggedIn && submission) {
|
if ($rootScope.loggedIn && submission) {
|
||||||
var id = $rootScope.playingSong.id;
|
var id = $rootScope.playingSong.id;
|
||||||
if (globals.settings.Debug) { console.log('Scrobble Song: ' + id); }
|
if (globals.settings.Debug) { console.log('Scrobble Song: ' + id); }
|
||||||
|
@ -407,7 +407,7 @@ jamstash.service('player', function ($rootScope, $window, utils, globals, model,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
rateSong = function (songid, rating) {
|
this.rateSong = function (songid, rating) {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: baseURL + '/setRating.view?' + baseParams + '&id=' + songid + "&rating=" + rating,
|
url: baseURL + '/setRating.view?' + baseParams + '&id=' + songid + "&rating=" + rating,
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
describe("SubsonicCtrl", function() {
|
|
||||||
|
|
||||||
|
|
||||||
});
|
|
4
test/controllers/subsonic_test.js
Normal file
4
test/controllers/subsonic_test.js
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
describe("Subsonic controller", function() {
|
||||||
|
|
||||||
|
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue