Renamed library.js to subsonicCtrl.js (the name of the actual controller).
Cleanup: remove commented code, unused variables, apply jshint.
This commit is contained in:
parent
d6de65da74
commit
ebfd9e8e1f
2 changed files with 14 additions and 38 deletions
|
@ -14,7 +14,7 @@
|
||||||
<link href="bower_components/fancybox/source/jquery.fancybox.css" rel="stylesheet" type="text/css" />
|
<link href="bower_components/fancybox/source/jquery.fancybox.css" rel="stylesheet" type="text/css" />
|
||||||
<!--<link href="js/plugins/jquery-split-pane.css" rel="stylesheet" />-->
|
<!--<link href="js/plugins/jquery-split-pane.css" rel="stylesheet" />-->
|
||||||
<script src="bower_components/jquery/jquery.min.js" type="text/javascript"></script>
|
<script src="bower_components/jquery/jquery.min.js" type="text/javascript"></script>
|
||||||
<script src="bower_components/angular/angular.min.js" type="text/javascript"></script>
|
<script src="bower_components/angular/angular.js" type="text/javascript"></script>
|
||||||
<script src="bower_components/angular-route/angular-route.min.js" type="text/javascript"></script>
|
<script src="bower_components/angular-route/angular-route.min.js" type="text/javascript"></script>
|
||||||
<script src="bower_components/angular-sanitize/angular-sanitize.min.js" type="text/javascript"></script>
|
<script src="bower_components/angular-sanitize/angular-sanitize.min.js" type="text/javascript"></script>
|
||||||
<script src="bower_components/angular-cookies/angular-cookies.min.js" type="text/javascript"></script>
|
<script src="bower_components/angular-cookies/angular-cookies.min.js" type="text/javascript"></script>
|
||||||
|
@ -36,7 +36,7 @@
|
||||||
<script src="js/utils.js" type="text/javascript"></script>
|
<script src="js/utils.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/library.js" type="text/javascript"></script>
|
<script src="js/controllers/subsonicCtrl.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/player.js" type="text/javascript"></script>
|
||||||
|
|
|
@ -1,10 +1,7 @@
|
||||||
JamStash.controller('SubsonicCtrl',
|
JamStash.controller('SubsonicCtrl',
|
||||||
function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $http, utils, globals, model, map, subsonic, notifications, player) {
|
function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $http, utils, globals, model, map, subsonic, notifications) {
|
||||||
//$("#SubsonicAlbums").layout($scope.layoutThreeCol);
|
'use strict';
|
||||||
|
|
||||||
//subsonic.song = [];
|
|
||||||
//$scope.artistId = $routeParams.artistId;
|
|
||||||
//$scope.albumId = $routeParams.albumId;
|
|
||||||
$scope.settings = globals.settings;
|
$scope.settings = globals.settings;
|
||||||
$scope.itemType = 'ss';
|
$scope.itemType = 'ss';
|
||||||
$scope.Server = globals.settings.Server;
|
$scope.Server = globals.settings.Server;
|
||||||
|
@ -69,8 +66,8 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
};
|
};
|
||||||
$scope.saveDefaultSection = function (val) {
|
$scope.saveDefaultSection = function (val) {
|
||||||
utils.setValue('DefaultSection', val, false);
|
utils.setValue('DefaultSection', val, false);
|
||||||
}
|
};
|
||||||
$scope.openDefaultSection = function (val) {
|
$scope.openDefaultSection = function () {
|
||||||
var section = utils.getValue('DefaultSection');
|
var section = utils.getValue('DefaultSection');
|
||||||
switch (section) {
|
switch (section) {
|
||||||
case 'index':
|
case 'index':
|
||||||
|
@ -85,15 +82,15 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
$scope.$watch("SelectedAlbumSort.id", function (newValue, oldValue) {
|
$scope.$watch("SelectedAlbumSort.id", function (newValue, oldValue) {
|
||||||
if (newValue !== oldValue) {
|
if (newValue !== oldValue) {
|
||||||
if (subsonic.song.length > 0) {
|
if (subsonic.song.length > 0) {
|
||||||
subsonic.sortSubsonicSongs(newValue);
|
subsonic.sortSubsonicSongs(newValue);
|
||||||
} else if (subsonic.content.album.length > 0) {
|
} else if (subsonic.content.album.length > 0) {
|
||||||
subsonic.sortSubsonicAlbums(newValue);
|
subsonic.sortSubsonicAlbums(newValue);
|
||||||
indexes = $.map(globals.AlbumSorts, function (obj, index) {
|
var indexes = $.map(globals.AlbumSorts, function (obj, index) {
|
||||||
if (obj.id == newValue) {
|
if (obj.id === newValue) {
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -158,7 +155,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
$scope.shortcut = data.shortcuts;
|
$scope.shortcut = data.shortcuts;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.refreshArtists = function (id) {
|
$scope.refreshArtists = function () {
|
||||||
utils.setValue('MusicFolders', null, true);
|
utils.setValue('MusicFolders', null, true);
|
||||||
$scope.getArtists(0, true);
|
$scope.getArtists(0, true);
|
||||||
$scope.getPlaylists(true);
|
$scope.getPlaylists(true);
|
||||||
|
@ -191,20 +188,6 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.getArtistByTag = function (id) { // Gets Artist by ID3 tag
|
$scope.getArtistByTag = function (id) { // Gets Artist by ID3 tag
|
||||||
/*
|
|
||||||
var map = {
|
|
||||||
create: function (options) {
|
|
||||||
var album = options.data;
|
|
||||||
var coverart, starred;
|
|
||||||
if (typeof album.coverArt != 'undefined') {
|
|
||||||
coverart = self.settings.BaseURL() + '/getCoverArt.view?' + self.settings.BaseParams() + '&size=50&id=' + album.coverArt;
|
|
||||||
}
|
|
||||||
if (typeof album.starred !== 'undefined') { starred = true; } else { starred = false; }
|
|
||||||
return new model.Album(album.id, album.parent, album.name, album.artist, coverart, album.created, starred, '', '');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
$scope.selectedAutoAlbum = null;
|
$scope.selectedAutoAlbum = null;
|
||||||
$scope.selectedArtist = id;
|
$scope.selectedArtist = id;
|
||||||
var url = globals.BaseURL() + '/getArtist.view?' + globals.BaseParams() + '&id=' + id;
|
var url = globals.BaseURL() + '/getArtist.view?' + globals.BaseParams() + '&id=' + id;
|
||||||
|
@ -215,7 +198,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
timeout: globals.settings.Timeout,
|
timeout: globals.settings.Timeout,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var items = [];
|
var items = [];
|
||||||
if (typeof data["subsonic-response"].artist != 'undefined') {
|
if (typeof data["subsonic-response"].artist !== 'undefined') {
|
||||||
if (data["subsonic-response"].artist.album.length > 0) {
|
if (data["subsonic-response"].artist.album.length > 0) {
|
||||||
items = data["subsonic-response"].artist.album;
|
items = data["subsonic-response"].artist.album;
|
||||||
} else {
|
} else {
|
||||||
|
@ -224,7 +207,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
subsonic.content.album = [];
|
subsonic.content.album = [];
|
||||||
subsonic.song = [];
|
subsonic.song = [];
|
||||||
|
|
||||||
angular.forEach(items, function (item, key) {
|
angular.forEach(items, function (item) {
|
||||||
subsonic.content.album.push(map.mapAlbum(item));
|
subsonic.content.album.push(map.mapAlbum(item));
|
||||||
});
|
});
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
@ -253,7 +236,7 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
$scope.song = data.song;
|
$scope.song = data.song;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.toggleAZ = function (event) {
|
$scope.toggleAZ = function () {
|
||||||
$scope.toggleSubmenu('#submenu_AZIndex', '#AZIndex', 'right', 44);
|
$scope.toggleSubmenu('#submenu_AZIndex', '#AZIndex', 'right', 44);
|
||||||
};
|
};
|
||||||
$scope.getPlaylists = function (refresh) {
|
$scope.getPlaylists = function (refresh) {
|
||||||
|
@ -332,19 +315,13 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
notifications.updateMessage('No Playlists :(', true);
|
notifications.updateMessage('No Playlists :(', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
$("<a href=\"#\" childid=\"new\">+ New</a><br />").appendTo("#" + menu);
|
|
||||||
$.each(playlists, function (i, playlist) {
|
|
||||||
$('<a href=\"#\" id=\"' + playlist.id + '\">' + playlist.name + '</a><br />').appendTo("#" + menu);
|
|
||||||
});
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$scope.addToPlaylist = function (id) {
|
$scope.addToPlaylist = function (id) {
|
||||||
var songs = [];
|
var songs = [];
|
||||||
if ($scope.selectedSongs.length !== 0) {
|
if ($scope.selectedSongs.length !== 0) {
|
||||||
angular.forEach($scope.selectedSongs, function (item, key) {
|
angular.forEach($scope.selectedSongs, function (item) {
|
||||||
songs.push(item.id);
|
songs.push(item.id);
|
||||||
});
|
});
|
||||||
var runningVersion = utils.parseVersionString(globals.settings.ApiVersion);
|
var runningVersion = utils.parseVersionString(globals.settings.ApiVersion);
|
||||||
|
@ -383,7 +360,6 @@ function SubsonicCtrl($scope, $rootScope, $location, $window, $routeParams, $htt
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Launch on Startup */
|
/* Launch on Startup */
|
||||||
$scope.getArtists();
|
$scope.getArtists();
|
||||||
$scope.getAlbums();
|
$scope.getAlbums();
|
Loading…
Add table
Add a link
Reference in a new issue