Jamstash/js/services/globals-service.js
Hyzual 1a830d6cef Splits all the services into different jamstash.* modules.
That way dependencies are actually visible and can be managed
e.g. Jamstash doesn't depend upon underscore directly anymore, it's just the subsonic service that needs it.
2014-11-09 16:05:11 +01:00

83 lines
No EOL
2.5 KiB
JavaScript

/**
* jamstash.globals Module
*
* Houses Jamstash's global settings and a few utility functions.
*/
angular.module('jamstash.globals', [])
.service('globals', function () {
'use strict';
this.SearchTypes = [
{ id: "song", name: "Song" },
{ id: "album", name: "Album" },
{ id: "artist", name: "Artist" }
];
this.Layouts = [
{ id: "grid", name: "Grid" },
{ id: "list", name: "List" }
];
this.AlbumSorts = [
{ id: "default", name: "Default Sort" },
{ id: "artist", name: "Artist" },
{ id: "album", name: "Album" },
{ id: "track", name: "Track" },
{ id: "createdate desc", name: "Date Added" }
];
this.settings = {
// Subsonic
/* Demo Server
Username: "android-guest"),
Password: "guest"),
Server: "http://subsonic.org/demo"),
*/
Url: "http://Jamstash.com/beta/#/archive/",
Username: "",
Password: "",
Server: "",
Timeout: 20000,
Protocol: "jsonp",
ApplicationName: "Jamstash",
ApiVersion: "1.6.0",
AutoPlaylists: "",
AutoPlaylistSize: 25,
AutoAlbumSize: 15,
// General
HideAZ: false,
ScrollTitle: true,
NotificationSong: true,
NotificationNowPlaying: false,
SaveTrackPosition: false,
ForceFlash: false,
Theme: "Default",
DefaultLibraryLayout: this.Layouts[0],
DefaultSearchType: this.SearchTypes[0],
DefaultAlbumSort: this.AlbumSorts[0],
DefaultArchiveAlbumSort: "date desc",
Jukebox: false,
AutoPlay: false,
LoopQueue: false,
Repeat: false,
Debug: false
};
this.SavedCollections = [];
this.SavedGenres = [];
this.Player1 = '#playdeck_1';
this.archiveUrl = 'https://archive.org/';
this.BaseURL = function () { return this.settings.Server + '/rest'; };
this.BaseParams = function () { return 'u=' + this.settings.Username + '&p=' + this.settings.Password + '&f=' + this.settings.Protocol + '&v=' + this.settings.ApiVersion + '&c=' + this.settings.ApplicationName; };
})
.factory('json', function ($http) { // Deferred loading
'use strict';
return {
getCollections: function (callback) {
$http.get('js/json_collections.js').success(callback);
},
getChangeLog: function (callback) {
$http.get('js/json_changelog.js').success(callback);
}
};
});