%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /data/www_bck/varak.cloud_bck/jamstash.varak.cloud/dist/scripts/
Upload File :
Create Path :
Current File : //data/www_bck/varak.cloud_bck/jamstash.varak.cloud/dist/scripts/scripts.min.ce58fd30.js

"use strict";function authenticationInterceptor(a,b,c,d){return{request:function(c){a.loggedIn=!1,""!=d.settings.Username&&""!=d.settings.Password&&""!=d.settings.Server&&(a.loggedIn=!0);var e="";return e=b.path(),d.settings.Debug&&console.log("Logged In: "+a.loggedIn),d.settings.Debug&&console.log("Current Path: "+e),!a.loggedIn&&"/settings"!=e&&e.search("archive")<0&&b.path("/settings"),c},responseError:function(d){return 401===d.status&&"/settings"!=b.path()&&(a.loggedIn=!1,b.path("/settings")),c.reject(d)}}}function loadingInterceptor(a){return{request:function(b){return a.isLoading=!0,b},response:function(b){return a.isLoading=!1,b},responseError:function(b){return a.isLoading=!1,b}}}function lockerConfig(a){a.defaults({driver:"local",namespace:!1,eventsEnabled:!1})}function persistenceService(a,b,c,d,e,f,g,h){function i(){var a=e.get(C);a&&c.load(a),b.settings.Debug&&console.log("Current Position Loaded from localStorage: ",a)}function j(a){e.put(C,a),b.settings.Debug&&console.log("Saving Current Position: ",a)}function k(){e.forget(C),b.settings.Debug&&console.log("Removing Current Position from localStorage")}function l(){var a=e.get(D);a&&(c.addSongs(a),c.queue.length>0&&d.updateMessage(c.queue.length+" Saved Song(s)",!0),b.settings.Debug&&console.log("Play Queue Loaded from localStorage: "+c.queue.length+" song(s)"))}function m(){e.put(D,c.queue),b.settings.Debug&&console.log("Saving Queue: "+c.queue.length+" songs")}function n(){e.forget(D),b.settings.Debug&&console.log("Removing Play Queue from localStorage")}function o(){var a=e.get(E);return void 0===a&&(e.put(E,1),a=1),a}function p(a){e.put(E,a)}function q(){e.forget(E)}function r(){return e.get(F)}function s(a){e.put(F,a)}function t(){e.forget(F)}function u(a){e.put(G,a)}function v(){var a=e.get(G);return void 0===a&&(a=[]),a}function w(){e.forget(G)}function x(){var a=J.getVersion();return f.getChangeLog(function(b){var c=b[0].version;h.checkVersionNewer(c,a)&&J.upgradeVersion(a,c)}),e.get(H)}function y(a){e.put(H,a)}function z(){e.forget(H)}function A(){return e.get(I)}function B(b,c){var f=e.get(H),i=a.filter(g.versions,function(a){var d=h.checkVersion(c,a.version),e=h.checkVersionNewer(a.version,b);return d&&e});a.forEach(i,function(a){a.changeset(f)}),J.saveSettings(f),e.put(I,c),d.updateMessage("Version "+b+" to "+c,!0)}const C="CurrentSong",D="CurrentQueue",E="Volume",F="MusicFolders",G="GenrePlaylists",H="Settings",I="JamstashVersion";var J=this;a.extend(J,{loadTrackPosition:i,saveTrackPosition:j,deleteTrackPosition:k,loadQueue:l,saveQueue:m,deleteQueue:n,getVolume:o,saveVolume:p,deleteVolume:q,getSelectedMusicFolder:r,saveSelectedMusicFolder:s,deleteSelectedMusicFolder:t,saveSelectedGenreNames:u,loadSelectedGenreNames:v,deleteSelectedGenreNames:w,getSettings:x,saveSettings:y,deleteSettings:z,getVersion:A,upgradeVersion:B})}function SelectedSongs(a){function b(b){return b.selected=!0,i.push(b),i=a.uniq(i),h}function c(b){return a.forEach(b,function(a){a.selected=!0}),i=a.union(i,b),h}function d(){return i}function e(b){var c=a(i).remove(function(a){return a===b}).first();return a.set(c,"selected",!1),h}function f(a){return a.selected?h.remove(a):h.add(a),h}function g(){return a.forEach(i,function(a){a.selected=!1}),i=[],h}var h=this;a.extend(h,{add:b,addSongs:c,get:d,remove:e,reset:g,toggle:f});var i=[]}function subsonicService(a,b,c,d,e){function f(e,f){var g={reason:"Error when contacting the Subsonic server."},h=b.defer(),i="/"===e.charAt(0)?e:"/"+e,j=d.BaseURL()+i,k=f||{};k.params=k.params||{},c.extend(k.params,{u:d.settings.Username,p:d.settings.Password,f:d.settings.Protocol,v:d.settings.ApiVersion,c:d.settings.ApplicationName}),k.timeout=d.settings.Timeout;var l;return"jsonp"===d.settings.Protocol?(k.params.callback="JSON_CALLBACK",l=a.jsonp(j,k)):l=a.get(j,k),l.success(function(a){var b=void 0!==a["subsonic-response"]?a["subsonic-response"]:{status:"failed"};"ok"===b.status?h.resolve(b):("failed"===b.status&&void 0!==b.error&&(g.subsonicError=b.error,g.version=b.version),h.reject(g))}).error(function(a,b){g.httpError=b,h.reject(g)}),h.promise}function g(){return C.subsonicRequest("ping.view")}function h(){var a={reason:"No music folder found on the Subsonic server."};return C.subsonicRequest("getMusicFolders.view",{cache:!0}).then(function(c){return void 0!==c.musicFolders&&void 0!==c.musicFolders.musicFolder?[].concat(c.musicFolders.musicFolder):b.reject(a)})}function i(a){var d,e={reason:"No artist found on the Subsonic server."};return isNaN(a)||(d={musicFolderId:a}),C.subsonicRequest("getIndexes.view",{cache:!0,params:d}).then(function(a){if(void 0===a.indexes||void 0===a.indexes.index&&void 0===a.indexes.shortcut)return b.reject(e);var d={};return d.shortcut=[].concat(a.indexes.shortcut),d.index=[].concat(a.indexes.index),c.map(d.index,function(a){var b=a;return b.artist=[].concat(a.artist),b}),d})}function j(a){var c=b.defer();return $.ajax({url:d.BaseURL()+"/getAlbum.view?"+d.BaseParams()+"&id="+a,method:"GET",dataType:d.settings.Protocol,timeout:d.settings.Timeout,success:function(a){if(void 0!==a["subsonic-response"].album){D.album=[],D.song=[];var b=[];a["subsonic-response"].album.song.length>0?b=a["subsonic-response"].album.song:b[0]=a["subsonic-response"].album.song,angular.forEach(b,function(a,b){D.song.push(e.mapSong(a))})}c.resolve(D)}}),c.promise}function k(a){var d={reason:"This directory is empty."};return C.subsonicRequest("getMusicDirectory.view",{params:{id:a}}).then(function(a){if(void 0!==a.directory.child){var f=[].concat(a.directory.child);if(f.length>0){var g=c.partition(f,function(a){return a.isDir});return{directories:e.mapAlbums(g[0]),songs:e.mapSongs(g[1])}}}return b.reject(d)})}function l(a){var d=b.defer();return C.getDirectory(a).then(function(a){var e=a.directories,f=a.songs;if(0===e.length)d.resolve(f);else{var g=[];angular.forEach(e,function(a){var b=C.recursiveGetDirectory(a.id).then(function(a){return f.concat(a)});g.push(b)});var h=b.all(g).then(function(a){return c.flatten(a)});d.resolve(h)}},function(){d.resolve([])}),d.promise}function m(a,c){var f=c>0?c:0,g={reason:"No matching albums found on the Subsonic server."},h={size:d.settings.AutoAlbumSize,type:a,offset:f};return C.subsonicRequest("getAlbumList.view",{params:h}).then(function(a){if(void 0!==a.albumList.album){var c=[].concat(a.albumList.album);if(c.length>0)return e.mapAlbums(c)}return b.reject(g)})}function n(a,d){if(c([0,1,2]).contains(d)){return C.subsonicRequest("search2.view",{params:{query:a}}).then(function(a){var f;if(c.isEmpty(a.searchResult2)?c.isEmpty(a.search2)||(f=a.search2):f=a.searchResult2,!c.isEmpty(f))switch(d){case 0:if(void 0!==f.song)return e.mapSongs([].concat(f.song));break;case 1:if(void 0!==f.album)return e.mapAlbums([].concat(f.album));break;case 2:if(void 0!==f.artist)return[].concat(f.artist)}return b.reject({reason:"No results."})})}return b.reject({reason:"Wrong search type."})}function o(a,c){var f={reason:"No songs found on the Subsonic server."},g={size:d.settings.AutoPlaylistSize};return void 0!==a&&""!==a&&"Random"!==a&&(g.genre=a),isNaN(c)||(g.musicFolderId=c),C.subsonicRequest("getRandomSongs.view",{params:g}).then(function(a){if(void 0!==a.randomSongs){var c=[].concat(a.randomSongs.song);if(c.length>0)return e.mapSongs(c)}return b.reject(f)})}function p(){return C.subsonicRequest("getStarred.view",{cache:!0}).then(function(a){return angular.equals(a.starred,{})?b.reject({reason:"Nothing is starred on the Subsonic server."}):a.starred})}function q(){return C.getStarred().then(function(a){if(void 0!==a.song){var f=[].concat(a.song);if(f.length>0){var g=[].concat(c.sample(f,d.settings.AutoPlaylistSize));return e.mapSongs(g)}}return b.reject({reason:"No starred songs found on the Subsonic server."})})}function r(){var a={reason:"No playlist found on the Subsonic server."};return C.subsonicRequest("getPlaylists.view").then(function(e){if(void 0!==e.playlists.playlist){var f=[].concat(e.playlists.playlist);if(f.length>0){var g=c.partition(f,function(a){return a.owner===d.settings.Username});return{playlists:g[0],playlistsPublic:g[1]}}}return b.reject(a)})}function s(a){var c={reason:"This playlist is empty."};return C.subsonicRequest("getPlaylist.view",{params:{id:a}}).then(function(a){if(void 0!==a.playlist.entry){var d=[].concat(a.playlist.entry);if(d.length>0)return e.mapSongs(d)}return b.reject(c)})}function t(a){return C.subsonicRequest("createPlaylist.view",{params:{name:a}})}function u(a){return C.subsonicRequest("deletePlaylist.view",{params:{id:a}})}function v(a,b){var d=c.pluck(b,"id");return C.subsonicRequest("updatePlaylist.view",{params:{playlistId:a,songIdToAdd:d}})}function w(a,b){var d=c.pluck(b,"id");return C.subsonicRequest("createPlaylist.view",{params:{playlistId:a,songId:d}})}function x(){var a={reason:"No genre found on the Subsonic server."};return C.subsonicRequest("getGenres.view").then(function(d){if(void 0!==d.genres&&void 0!==d.genres.genre){var e=[].concat(d.genres.genre);if(e.length>0){var f;return e[0].value?f=c.pluck(e,"value"):e[0].content&&(f=c.pluck(e,"content")),f}}return b.reject(a)})}function y(){var a={reason:"No podcast found on the Subsonic server."};return C.subsonicRequest("getPodcasts.view",{params:{includeEpisodes:!1}}).then(function(c){if(void 0!==c.podcasts&&void 0!==c.podcasts.channel){var d=[].concat(c.podcasts.channel);if(d.length>0)return d}return b.reject(a)})}function z(a){var d={reason:"This podcast was not found on the Subsonic server."};return C.subsonicRequest("getPodcasts.view",{params:{id:a,includeEpisodes:!0}}).then(function(f){var g=[];if(void 0!==f.podcasts.channel){var h=[].concat(f.podcasts.channel);if(h.length>0){var i=h[0];if(null!==i&&i.id===a){var j=[].concat(i.episode);return g=c.filter(j,function(a){return"completed"===a.status}),g.length>0?e.mapPodcasts(g):b.reject({reason:"No downloaded episode found for this podcast. Please check the podcast settings."})}}}return b.reject(d)})}function A(a){return C.subsonicRequest("scrobble.view",{params:{id:a.id,submisssion:!0}}).then(function(){return d.settings.Debug&&console.log("Successfully scrobbled song: "+a.id),!0})}function B(a){var b=a.starred?"unstar.view":"star.view";return C.subsonicRequest(b,{params:{id:a.id}}).then(function(){return!a.starred})}var C=this;c.extend(C,{addToPlaylist:v,deletePlaylist:u,getAlbumByTag:j,getAlbumListBy:m,getArtists:i,getGenres:x,getMusicFolders:h,getPlaylist:s,getPlaylists:r,getPodcast:z,getPodcasts:y,getRandomSongs:o,getRandomStarredSongs:q,getDirectory:k,getStarred:p,newPlaylist:t,ping:g,recursiveGetDirectory:l,savePlaylist:w,scrobble:A,search:n,subsonicRequest:f,toggleStar:B});var D={album:[],song:[],playlists:[],breadcrumb:[],playlistsPublic:[],playlistsGenre:d.SavedGenres,selectedAutoAlbum:null,selectedArtist:null,selectedAlbum:null,selectedPlaylist:null,selectedAutoPlaylist:null,selectedGenre:null,selectedPodcast:null}}function QueueController(a,b,c,d,e,f){function g(){c.emptyQueue(),$.fancybox.close()}function h(){b.every(c.queue,"selected")?d.reset():d.addSongs(c.queue)}function i(a){return angular.equals(a,c.getPlayingSong())}function j(){c.removeSongs(d.get())}function k(){c.shuffleQueue(),$("#SideBar").stop().scrollTo(".header",400)}function l(a){return e.toggleStar(a).then(function(b){a.starred=b,f.updateMessage("Favorite Updated!",!0)})}var m=this;b.extend(m,{player:c,emptyQueue:g,isPlayingSong:i,playSong:c.play,removeSelectedSongsFromQueue:j,removeSongFromQueue:c.removeSong,selectAll:h,shuffleQueue:k,toggleSelection:d.toggle,toggleStar:l}),a.$watch(function(){return c.getPlayingSong()},function(a){void 0!==a&&$("#SideBar").stop().scrollTo(".song.id"+a.id,400)})}angular.module("JamStash",["ngCookies","ngRoute","ngSanitize","ngLodash","ui.keypress","jamstash.subsonic.controller","jamstash.archive.controller","jamstash.player.controller","jamstash.queue.controller","jamstash.settings.controller","jamstash.persistence","jamstash.loading"]).config(["$routeProvider",function(a){a.when("/index",{redirectTo:"/library"}).when("/settings",{templateUrl:"settings/settings.html",controller:"SettingsController"}).when("/library",{templateUrl:"subsonic/subsonic.html",controller:"SubsonicController"}).when("/library/:artistId",{templateUrl:"subsonic/subsonic.html",controller:"SubsonicController",reloadOnSearch:!1}).when("/library/:artistId/:albumId",{templateUrl:"subsonic/subsonic.html",controller:"SubsonicController",reloadOnSearch:!1}).when("/podcasts",{templateUrl:"podcasts/podcasts.html",controller:"PodcastController"}).when("/archive",{templateUrl:"archive/archive.html",controller:"ArchiveController"}).when("/archive/:artist",{templateUrl:"archive/archive.html",controller:"ArchiveController"}).when("/archive/:artist/:album",{templateUrl:"archive/archive.html",controller:"ArchiveController"}).otherwise({redirectTo:"/index"})}]).config(["$httpProvider",function(a){a.interceptors.push(authenticationInterceptor),a.interceptors.push(loadingInterceptor)}]),authenticationInterceptor.$inject=["$rootScope","$location","$q","globals"],loadingInterceptor.$inject=["Loading"],angular.module("jamstash.settings.controller",["jamstash.settings.service","jamstash.persistence"]).controller("SettingsController",["$rootScope","$scope","$location","utils","globals","json","notifications","persistence","subsonic",function(a,b,c,d,e,f,g,h,i){a.hideQueue(),b.settings=e.settings,b.Timeouts=[{id:1e4,name:10},{id:2e4,name:20},{id:3e4,name:30},{id:4e4,name:40},{id:5e4,name:50},{id:6e4,name:60},{id:9e4,name:90},{id:12e4,name:120}],b.Protocols=["json","jsonp"],b.Themes=["Default","Dark"],b.SearchTypes=e.SearchTypes,b.Layouts=e.Layouts,b.$watch("settings.HideAZ",function(){e.settings.HideAZ?$("#AZIndex").hide():$("#AZIndex").show()}),b.reset=function(){h.deleteSettings(),b.loadSettings()},b.save=function(){""!==b.settings.Password&&"enc:"!=e.settings.Password.substring(0,4)&&(b.settings.Password="enc:"+d.HexEncode(b.settings.Password)),0!=b.settings.Server.indexOf("http://")&&0!=b.settings.Server.indexOf("https://")&&(b.settings.Server="http://"+b.settings.Server),b.settings.NotificationSong&&(g.requestPermissionIfRequired(),g.isSupported()||alert("HTML5 Notifications are not available for your current browser, Sorry :(")),b.settings.NotificationNowPlaying&&(g.requestPermissionIfRequired(),g.isSupported()||alert("HTML5 Notifications are not available for your current browser, Sorry :(")),b.settings.SaveTrackPosition?h.saveQueue():(h.deleteTrackPosition(),h.deleteQueue()),b.settings.Theme&&d.switchTheme(e.settings.Theme),b.settings.ShowQueue?a.showQueue():a.hideQueue(),h.saveSettings(b.settings),g.updateMessage("Settings Updated!",!0),b.loadSettings(),""!==e.settings.Server&&""!==e.settings.Username&&""!==e.settings.Password&&i.ping().then(function(b){e.settings.ApiVersion=b.version,c.path("/library").replace(),a.showIndex=!0},function(a){e.settings.ApiVersion=a.version;var b;b=void 0!==a.subsonicError?a.reason+" "+a.subsonicError.message:void 0!==a.httpError?a.reason+" HTTP error "+a.httpError:a.reason,g.updateMessage(b,!0)})},f.getChangeLog(function(a){b.changeLog=a.slice(0,10),e.ChangeLog=a}),b.changeLogShowMore=function(){f.getChangeLog(function(a){b.changeLog=a})},b.setupDemo=function(){d.confirmDelete("Do you want to connect to the Subsonic Demo server?")&&(e.settings.Username="android-guest",e.settings.Password="guest",e.settings.Server="http://demo.subsonic.org",c.path("/library").replace(),a.showIndex=!0)},void 0!==c.search().url&&""===b.settings.Server&&(e.settings.Debug&&console.log("Setting Provided: "+c.search().url),b.settings.Server=c.search().url),void 0!==c.search().u&&""===b.settings.Username&&(e.settings.Debug&&console.log("Setting Provided: "+c.search().u),b.settings.Username=c.search().u)}]),angular.module("jamstash.settings.service",[]).service("globals",function(){this.SearchTypes=[{id:0,name:"Song"},{id:1,name:"Album"},{id:2,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={Url:"http://jamstash.com/#/archive/",Username:"",Password:"",Server:"",Timeout:2e4,Protocol:"jsonp",ApplicationName:"Jamstash",ApiVersion:"1.6.0",AutoPlaylists:"",AutoPlaylistSize:25,AutoAlbumSize:15,HideAZ:!1,ScrollTitle:!0,NotificationSong:!0,NotificationNowPlaying:!1,SaveTrackPosition:!1,ForceFlash:!1,Theme:"Default",DefaultLibraryLayout:this.Layouts[0],DefaultSearchType:this.SearchTypes[0],DefaultAlbumSort:this.AlbumSorts[0],DefaultArchiveAlbumSort:"date desc",Jukebox:!1,AutoPlay:!1,LoopQueue:!1,Repeat:!1,Debug:!1,ShowQueue:!1},this.SavedCollections=[],this.Player1="#playdeck_1",this.archiveUrl="https://archive.org/",this.ChangeLog=null,this.Messages=[],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},this.BaseJSONParams=function(){return"u="+this.settings.Username+"&p="+this.settings.Password+"&f=json&v="+this.settings.ApiVersion+"&c="+this.settings.ApplicationName}}).factory("json",["$http",function(a){return{getCollections:function(b){a.get("archive/json_collections.json").success(b)},getChangeLog:function(b){a.get("common/json_changelog.json").success(b)}}}]),angular.module("jamstash.model",["jamstash.utils"]).service("model",["utils",function(a){this.Index=function(a,b){this.name=a,this.artist=b},this.Artist=function(a,b){this.id=a,this.name=b},this.Album=function(a,b,c,d,e,f,g,h,i,j,k,l){this.id=a,this.parentid=b,this.name=c,this.artist=d,this.artistId=e,this.coverartthumb=f,this.coverartfull=g,this.date=h,this.starred=i,this.description=j,this.url=k,this.type=l},this.Song=function(b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s){this.id=b,this.parentid=c,this.track=d,this.name=e,this.artist=f,this.artistId=g,this.album=h,this.albumId=i,this.coverartthumb=j,this.coverartfull=k,this.duration=l,this.time=""===l?"00:00":a.secondsToTime(l),this.rating=m,this.starred=n,this.suffix=o,this.specs=p,this.url=q,this.position=r,this.selected=!1,this.playing=!1,this.description=s,this.displayName=this.name+" - "+this.album+" - "+this.artist}}]).service("map",["$http","globals","utils","model",function(a,b,c,d){this.mapAlbum=function(a){var e,f,g,h,i,j=a;void 0!==j.coverArt&&(f=b.BaseURL()+"/getCoverArt.view?"+b.BaseParams()+"&size=160&id="+j.coverArt,g=b.BaseURL()+"/getCoverArt.view?"+b.BaseParams()+"&id="+j.coverArt),h=void 0!==j.starred,e=void 0!==j.title?j.title:j.name;var k;return k=j.isDir?"byfolder":"bytag",i=void 0!==j.artist?j.artist.toString():"",new d.Album(j.id,j.parent,e,i,j.artistId,f,g,c.formatDate(new Date(j.created),"yyyy-MM-dd h:mm a"),h,"","",k)},this.mapAlbums=function(a){var b=[],c=this.mapAlbum;return angular.forEach(a,function(a){b.push(c(a))}),b},this.mapSong=function(a){var c,e,f,g,h,i,j,k=a,l="",m="",n="";void 0!==k.coverArt?(m=b.BaseURL()+"/getCoverArt.view?"+b.BaseParams()+"&size=30&id="+k.coverArt,n=b.BaseURL()+"/getCoverArt.view?"+b.BaseParams()+"&id="+k.coverArt):(m="images/albumdefault_60.a457ae64.jpg",n="images/albumdefault_160.973dd405.jpg"),j=void 0===k.description?"":k.description,f=void 0===k.artist?"&nbsp;":k.artist.toString(),e=void 0===k.title?"&nbsp;":k.title.toString(),g=void 0===k.track?"&nbsp;":k.track.toString(),h=void 0!==k.starred,void 0!==k.bitRate&&(l+=k.bitRate+" Kbps"),void 0!==k.transcodedSuffix?l+=", transcoding:"+k.suffix+" > "+k.transcodedSuffix:l+=", "+k.suffix,"ogg"==(i=void 0!==k.transcodedSuffix?k.transcodedSuffix:k.suffix)&&(i="oga");var o=Math.floor(1e5*Math.random());return c=b.BaseURL()+"/stream.view?"+b.BaseParams()+"&id="+k.id+"&salt="+o,new d.Song(k.id,k.parent,g,e,f,k.artistId,k.album,k.albumId,m,n,k.duration,k.userRating,h,i,l,c,0,j)},this.mapSongs=function(a){var b=[],c=this.mapSong;return angular.forEach(a,function(a){b.push(c(a))}),b},this.mapPlaylist=function(a){return new d.Artist(a.id,a.name)},this.mapPodcast=function(a){var c,e,f,g,h,i,j,k,l=a,m="",n="",o="";void 0!==l.coverArt&&(n=b.BaseURL()+"/getCoverArt.view?"+b.BaseParams()+"&size=60&id="+l.coverArt,o=b.BaseURL()+"/getCoverArt.view?"+b.BaseParams()+"&id="+l.coverArt),j=void 0===l.album?"&nbsp;":l.album.toString(),i=void 0===l.artist?"&nbsp;":l.artist.toString(),k=void 0===l.title?"&nbsp;":l.title.toString(),h=void 0===l.description?"":l.description,e=void 0===l.track?"&nbsp;":l.track.toString(),f=void 0!==l.starred,void 0!==l.bitRate&&(m+=l.bitRate+" Kbps"),void 0!==l.transcodedSuffix?m+=", transcoding:"+l.suffix+" > "+l.transcodedSuffix:m+=", "+l.suffix,"ogg"==(g=void 0!==l.transcodedSuffix?l.transcodedSuffix:l.suffix)&&(g="oga");var p=Math.floor(1e5*Math.random());return c=b.BaseURL()+"/stream.view?"+b.BaseParams()+"&id="+l.streamId+"&salt="+p,new d.Song(l.streamId,l.parent,e,k,i,l.artistId,j,l.albumId,n,o,l.duration,l.userRating,f,g,m,c,0,h)},this.mapPodcasts=function(a){var b=[],c=this.mapPodcast;return angular.forEach(a,function(a){b.push(c(a))}),b}}]),angular.module("jamstash.utils",["jamstash.settings.service"]).service("utils",["$rootScope","globals",function(a,b){this.safeApply=function(b){var c=a.$root.$$phase;"$apply"===c||"$digest"===c?b&&"function"==typeof b&&b():this.$apply(b)},this.setValue=function(a,c){try{localStorage.setItem(a,JSON.stringify(c))}catch(d){b.settings.Debug&&console.log(d)}},this.getValue=function(a){try{var c=localStorage.getItem(a);return""!==c&&void 0!==c&&JSON.parse(c)}catch(d){b.settings.Debug&&console.log(d)}},this.sortDateFunction=function(a,b){return a.date<b.date?1:-1},this.sortArtistFunction=function(a,b){return a.artist.toLowerCase()<b.artist.toLowerCase()?-1:1},this.sortAlbumFunction=function(a,b){return a.name.toLowerCase()<b.name.toLowerCase()?-1:1},this.sortTrackFunction=function(a,b){return parseInt(a.track)>parseInt(b.track)?-1:1},this.confirmDelete=function(a){return!!window.confirm(a)},this.HexEncode=function(a){for(var b="0123456789abcdef",c=[],d=[],e=0;e<256;e++)c[e]=b.charAt(e>>4)+b.charAt(15&e);for(e=0;e<a.length;e++)d[e]=c[a.charCodeAt(e)];return d.join("")},this.switchTheme=function(a){switch(a.toLowerCase()){case"dark":$("link[data-name=theme]").attr("href","styles/Dark.25dc80d5.css");break;case"default":$("link[data-name=theme]").attr("href","")}},this.timeToSeconds=function(a){var b,c=a.split(":");switch(c.length){case 1:b=0;break;case 2:b=60*parseInt(c[0])+parseInt(c[1]);break;case 3:b=60*parseInt(c[0])*60+60*parseInt(c[1])+parseInt(c[2])}return b},this.secondsToTime=function(a){for(var b,c=new Array(3600,60,1),d="",e=0;e<c.length;e++)b=Math.floor(a/c[e]),b<1?b="00":b<10&&(b="0"+b),0===e&&"00"===b||(d+=b,e<2&&(d+=":")),a%=c[e];return d},this.formatDate=function(a,b){var c=angular.isDate(a)?a:new Date(a);return $.format.date(c,b)},this.logObjectProperties=function(a){$.each(a,function(a,b){var c=a;"object"==typeof b?$.each(b,function(a,b){console.log(c+" > "+a+" : "+b)}):console.log(a+" : "+b)})},this.findKeyForCode=function(a){var b={keymap:[{key:"a",code:65},{key:"b",code:66},{key:"c",code:67},{key:"d",code:68},{key:"e",code:69},{key:"f",code:70},{key:"g",code:71},{key:"h",code:72},{key:"i",code:73},{key:"j",code:74},{key:"k",code:75},{key:"l",code:76},{key:"m",code:77},{key:"n",code:78},{key:"o",code:79},{key:"p",code:80},{key:"q",code:81},{key:"r",code:82},{key:"s",code:83},{key:"t",code:84},{key:"u",code:85},{key:"v",code:86},{key:"w",code:87},{key:"x",code:88},{key:"y",code:89},{key:"z",code:90}]},c=0;return $.each(b.keymap,function(b,d){d.code===a&&(c=d.key)}),c},this.toHTML={on:function(a){for(var b=[],c=0;c<a.length;)b[c]=a.charCodeAt(c++);return"&#"+b.join(";&#")+";"},un:function(a){return a.replace(/&#(x)?([^;]{1,5});?/g,function(a,b,c){return String.fromCharCode(parseInt(c,b?16:10))})}},this.parseVersionString=function(a){if("string"!=typeof a)return!1;var b=a.split(".");return{major:parseInt(b[0])||0,minor:parseInt(b[1])||0,patch:parseInt(b[2])||0}},this.checkVersion=function(a,b){return void 0===b||(angular.isObject(a)||(a=this.parseVersionString(a)),angular.isObject(b)||(b=this.parseVersionString(b)),void 0!==b.major&&void 0!==a.major&&a.major>b.major||(void 0!==b.minor&&void 0!==a.minor&&a.minor>b.minor||void 0!==b.patch&&void 0!==a.patch&&a.patch>=b.patch))},this.checkVersionNewer=function(a,b){return void 0===b||(angular.isObject(a)||(a=this.parseVersionString(a)),angular.isObject(b)||(b=this.parseVersionString(b)),void 0!==b.major&&void 0!==a.major&&a.major>b.major||(void 0!==b.minor&&void 0!==a.minor&&a.minor>b.minor||void 0!==b.patch&&void 0!==a.patch&&a.patch>b.patch))}}]),angular.module("jamstash.page",["jamstash.settings.service","jamstash.utils"]).factory("Page",["$interval","globals","utils",function(a,b,c){var d,e="Jamstash";return{title:function(){return e},setTitle:function(a){return e=a,this},setTitleSong:function(a){return e=void 0!==a.artist&&void 0!==a.name?c.toHTML.un(a.artist)+" - "+c.toHTML.un(a.name):"Jamstash",b.settings.ScrollTitle&&this.scrollTitle(),this},scrollTitle:function(){var b={left:function(a){a.push(a.shift())},right:function(a){a.unshift(a.pop())}},c={text:e,dir:"left",speed:1200},f=c.text.split("");if(f)return f.push(" "),void 0!==d&&a.cancel(d),d=a(function(){var a=b[c.dir];a&&(a(f),e=f.join(""))},c.speed),this}}}]),angular.module("jamstash.loading",[]).value("Loading",{isLoading:!1}),angular.module("jamstash.notifications",["jamstash.player.service","jamstash.utils"]).service("notifications",["$rootScope","$window","$interval","globals","player","utils",function(a,b,c,d,e,f){this.updateMessage=function(b,c){if(""!==b){var e=a.Messages.push(b)-1;$("#messages").fadeIn(),c&&setTimeout(function(){$("#msg_"+e).fadeOut(function(){$(this).remove()})},d.settings.Timeout)}},this.requestPermissionIfRequired=function(){this.isSupported()&&!this.hasPermission()&&window.Notify.requestPermission()},this.hasPermission=function(){return!b.Notify.needsPermission()},this.isSupported=function(){return window.Notify.isSupported()},this.showNotification=function(b){if(this.hasPermission()){var g=new Notify(f.toHTML.un(b.name),{body:f.toHTML.un(b.artist+" - "+b.album),icon:b.coverartthumb,notifyClick:function(){e.nextTrack(),this.close(),a.$apply()}});c(function(){g.close()},d.settings.Timeout),g.show()}else console.log("showNotification: No Permission")}}]),angular.module("jamstash.persistence",["ngLodash","angular-locker","jamstash.settings.service","jamstash.player.service","jamstash.notifications","jamstash.utils"]).config(["lockerProvider",lockerConfig]).service("persistence",persistenceService).value("jamstashVersionChangesets",{versions:[{version:"4.4.5",changeset:function(a){a.DefaultSearchType=0}}]}),lockerConfig.$inject=["lockerProvider"],persistenceService.$inject=["lodash","globals","player","notifications","locker","json","jamstashVersionChangesets","utils"],angular.module("JamStash").controller("AppController",["$scope","$rootScope","$document","$window","$location","$cookieStore","$http","lodash","utils","globals","model","notifications","player","persistence","Page","subsonic","Loading",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q){function r(a){return a&&"INPUT"===a.target.tagName}b.settings=j.settings,b.song=[],b.playingSong=null,b.Messages=[],b.unity=null,a.Page=o,b.loggedIn=function(){return""!==j.settings.Server&&""!==j.settings.Username&&""!==j.settings.Password},b.totalDisplayed=50,b.loadMore=function(){a.totalDisplayed+=50},b.go=function(a){e.path(a)},a.loading=q,$.ajaxSetup({beforeSend:function(){$("#loading").removeClass("ng-hide")},complete:function(){$("#loading").addClass("ng-hide")}}),a.loadSettings=function(){f.get("Settings")&&(n.saveSettings(f.get("Settings")),f.remove("Settings"));var a=n.getSettings();if(void 0!==a){var b=h.omit(a,"Url");h.each(b,function(a,b){j.settings[b]=a})}i.getValue("SavedCollections")&&(j.SavedCollections=i.getValue("SavedCollections").split(",")),i.getValue("DefaultCollection")&&(j.DefaultCollection=i.getValue("DefaultCollection")),j.settings.Debug&&console.log("Loaded Settings: "+JSON.stringify(j.settings,null,2))},a.toggleSetting=function(a){var b=a;j.settings[b]?j.settings[b]=!1:j.settings[b]=!0,l.updateMessage(a+" : "+j.settings[b],!0)};var s=!1;$("div.submenu").mouseenter(function(){s=!0}),$("div.submenu").mouseleave(function(){s=!1,$("div.submenu").hide()}),a.toggleSubmenu=function(a,b,c,d){var e=$(a);if("none"!==e.css("display"))e.fadeOut();else{var f=$(b),g=f.offset();f.width(),f.height();switch(c){case"right":e.css({left:g.left+d+"px",top:g.top+"px"}).fadeIn(400);break;case"left":e.css({left:g.left-d+"px",top:g.top+"px"}).fadeIn(400)}setTimeout(function(){!1===s&&$("div.submenu").stop().fadeOut()},1e4)}},a.$watchCollection(function(){return m.queue},function(b){void 0!==b&&b.length>0&&j.settings.ShowQueue&&a.showQueue()}),b.showQueue=function(){$("#SideBar").css("display","block"),$("#right-component").removeClass("lgcolumn_expanded")},b.hideQueue=function(){$("#SideBar").css("display","none"),$("#right-component").addClass("lgcolumn_expanded")},a.toggleQueue=function(){"none"===$("#SideBar").css("display")?b.showQueue():b.hideQueue()},b.showArtists=function(){$("#left-component").css("display",""),$("#right-component").removeClass("lgcolumn_expandedleft")},b.hideArtists=function(){$("#left-component").css("display","none"),$("#right-component").addClass("lgcolumn_expandedleft")},a.toggleArtists=function(){"none"==$("#left-component").css("display")?b.showArtists():b.hideArtists()},a.fancyboxOpenImage=function(a){$.fancybox.open({helpers:{overlay:{css:{background:"rgba(0, 0, 0, 0.15)"}}},hideOnContentClick:!0,type:"image",openEffect:"none",closeEffect:"none",href:a})},$(document).on("click",".message",function(){$(this).remove()}),window.onbeforeunload=function(){if(!j.settings.Debug&&m.queue.length>0)return"You're about to end your session, are you sure?"},b.showIndex=!1,$(document).on("click","message",function(){return $(this).fadeOut(function(){$(this).remove()}),!1}),c.keydown(function(b){a.scrollToIndex(b)}),a.scrollToIndex=function(a){a.target.id;if("INPUT"!=a.target.tagName.toUpperCase()){var b=a.charCode?a.charCode:a.keyCode;if(j.settings.Debug&&console.log("Keycode Triggered: "+b),49==b?$("#action_Queue").click():50==b?$("#action_Library").click():51==b?$("#action_Archive").click():52==b&&$("#action_Settings").click(),b>=65&&b<=90&&$("#tabLibrary").is(":visible")){var c=i.findKeyForCode(b);"x"!=c&&"y"!=c&&"z"!=c||(c="x-z");var d="#"+c.toUpperCase();$(d).length>0&&$("#left-component").stop().scrollTo(d,400)}else 36==b&&$("#tabLibrary").is(":visible")&&$("#left-component").stop().scrollTo("#MusicFolders",400)}return!0},a.scrollToIndexName=function(a){var b="#"+a;$(b).length>0&&$("#left-component").stop().scrollTo(b,400)},a.scrollToTop=function(){$("#left-component").stop().scrollTo("#MusicFolders",400)},b.removeSong=function(a,b){var c=b.indexOf(a);b.splice(c,1)},a.isActive=function(a){return a===e.path()},b.getSplitPosition=function(a,b){window.alert(b.getBoundingClientRect().left)},a.download=function(a){$.ajax({url:j.BaseURL()+"/getUser.view?"+j.BaseParams()+"&username="+j.settings.Username,method:"GET",dataType:j.settings.Protocol,timeout:j.settings.Timeout,success:function(b){void 0!==b["subsonic-response"].error?l.updateMessage("Error: "+b["subsonic-response"].error.message,!0):!0===b["subsonic-response"].user.downloadRole?d.location.href=j.BaseURL()+"/download.view?"+j.BaseParams()+"&id="+a:l.updateMessage("You do not have permission to Download",!0)}})},a.togglePause=function(b){r(b)||(j.settings.Jukebox?a.sendToJukebox("stop"):m.togglePause())},a.turnVolumeUp=function(a){if(!r(a)){var b=m.turnVolumeUp();n.saveVolume(b)}},a.turnVolumeDown=function(a){if(!r(a)){var b=m.turnVolumeDown();n.saveVolume(b)}},a.nextTrack=function(a){r(a)||m.nextTrack()},a.previousTrack=function(a){r(a)||m.previousTrack()},b.addToJukebox=function(a){j.settings.Debug&&console.log("LOAD JUKEBOX"),$.ajax({
url:j.BaseURL()+"/jukeboxControl.view?"+j.BaseParams()+"&action=set&id="+a,method:"GET",dataType:j.settings.Protocol,timeout:j.settings.Timeout,success:function(a){$.get(j.BaseURL()+"/jukeboxControl.view?"+j.BaseParams()+"&action=start")}})},b.sendToJukebox=function(a){j.settings.Debug&&console.log("SEND JUKEBOX "+a),$.ajax({url:j.BaseURL()+"/jukeboxControl.view?"+j.BaseParams()+"&action="+a,method:"GET",dataType:j.settings.Protocol,timeout:j.settings.Timeout,success:function(a){}})},a.toggleStar=function(a){p.toggleStar(a).then(function(b){a.starred=b,l.updateMessage("Favorite Updated!",!0)})},a.toTrusted=function(a){return $sce.trustAsHtml(a)},a.loadSettings(),i.switchTheme(j.settings.Theme),j.settings.ShowQueue||b.hideQueue(),a.loggedIn()&&(j.settings.SaveTrackPosition&&(n.loadQueue(),n.loadTrackPosition()),m.setVolume(n.getVolume()))}]),angular.module("jamstash.selectedsongs",["ngLodash"]).service("SelectedSongs",SelectedSongs),SelectedSongs.$inject=["lodash"],angular.module("jamstash.subsonic.controller",["ngLodash","jamstash.subsonic.service","jamstash.player.service","jamstash.persistence","jamstash.breadcrumbs.directive","jamstash.breadcrumbs.service","jamstash.selectedsongs"]).controller("SubsonicController",["$scope","$rootScope","$routeParams","$window","lodash","utils","globals","map","subsonic","notifications","player","persistence","breadcrumbs","SelectedSongs",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){function o(){n.addSongs(a.song)}function p(){0!==n.get().length&&(k.addSongs(n.get()),j.updateMessage(n.get().length+" Song(s) Added to Queue",!0),n.reset())}function q(){k.emptyQueue().addSongs(a.song).playFirstSong()}function r(b){var c=a.song.slice(b,a.song.length);k.emptyQueue().addSongs(c).playFirstSong()}function s(a){k.addSong(a)}function t(a){k.emptyQueue().addSong(a).playFirstSong()}e.extend(a,{AlbumSort:g.AlbumSorts,autoAlbums:{random:{name:"Random",offset:0},newest:{name:"Recently Added",offset:0},starred:{name:"Starred",offset:0},highest:{name:"Top Rated",offset:0},frequent:{name:"Most Played",offset:0},recent:{name:"Recently Played",offset:0}},itemType:"ss",playlistMenu:[],selectedSongs:n.get(),SelectedAlbumSort:g.settings.DefaultAlbumSort,Server:g.settings.Server,settings:g.settings,addSelectedSongsToQueue:p,addSongToQueue:s,playAll:q,playFrom:r,playSong:t,selectAll:o,selectNone:n.reset,toggleSelection:n.toggle}),b.showIndex=!1,a.toggleIndex=function(){b.showIndex=!0,a.showPlaylist=!1,a.showPodcast=!1,a.saveDefaultSection("index")},a.showPlaylist=!1,a.togglePlaylist=function(){b.showIndex=!1,a.showPlaylist=!0,a.showPodcast=!1,a.saveDefaultSection("playlist")},a.showPodcast=!1,a.togglePodcast=function(){b.showIndex=!1,a.showPlaylist=!1,a.showPodcast=!0,a.saveDefaultSection("podcast")},a.saveDefaultSection=function(a){f.setValue("DefaultSection",a,!1)},a.openDefaultSection=function(){switch(f.getValue("DefaultSection")){case"index":b.showIndex=!0;break;case"playlist":a.showPlaylist=!0;break;case"podcast":a.showPodcast=!0}};var u=function(b){if(void 0!==b)switch(b){case"createdate desc":a.album.sort(f.sortDateFunction);break;case"artist":a.album.sort(f.sortArtistFunction);break;case"album":a.album.sort(f.sortAlbumFunction)}},v=function(b){if(void 0!==b)switch(b){case"createdate desc":a.song.sort(f.sortDateFunction);break;case"artist":a.song.sort(f.sortArtistFunction);break;case"album":a.song.sort(f.sortAlbumFunction);break;case"track":a.song.sort(f.sortTrackFunction)}};a.$watch("SelectedAlbumSort.id",function(b,c){if(b!==c)if(a.song.length>0)v(b);else if(a.album.length>0){u(b);var d=$.map(g.AlbumSorts,function(a,c){if(a.id===b)return c});g.settings.DefaultAlbumSort=g.AlbumSorts[d]}}),a.$watch("SelectedMusicFolder",function(b,c){if(b!==c){var d;b?(d=b.id,l.saveSelectedMusicFolder(b)):l.deleteSelectedMusicFolder(),a.getArtists(d)}}),a.rescanLibrary=function(a,b){$.ajax({url:g.BaseURL()+"/getUser.view?"+g.BaseParams()+"&username="+g.settings.Username,method:"GET",dataType:g.settings.Protocol,timeout:g.settings.Timeout,success:function(a){!0===a["subsonic-response"].user.adminRole?$.get(g.settings.Server+"/musicFolderSettings.view?scanNow&"+g.BaseParams()):alert("You are not logged in as an admin user!")}})},a.removeSong=function(c){b.removeSong(c,a.song)},a.songsRemoveSelected=function(){a.song=e.difference(a.song,n.get())},a.getArtists=function(b){var c=a.SelectedMusicFolder;isNaN(b)&&c&&(b=c.id);var d=i.getArtists(b);a.handleErrors(d).then(function(b){a.index=b.index,a.shortcut=b.shortcut},function(b){a.index=[],a.shortcut=[],!0===b.serviceError&&j.updateMessage(b.reason,!0)})},a.refreshArtists=function(){a.SelectedMusicFolder=void 0,a.getArtists(),a.getPlaylists()},a.handleErrors=function(a){return a.then(null,function(a){var b;void 0!==a.subsonicError?b=a.reason+" "+a.subsonicError.message:void 0!==a.httpError?b=a.reason+" HTTP error "+a.httpError:a.serviceError=!0,void 0===a.subsonicError&&void 0===a.httpError||j.updateMessage(b,!0)}),a},a.requestSongs=function(b,c){return a.handleErrors(b).then(function(b){"play"===c?(k.emptyQueue().addSongs(b).playFirstSong(),j.updateMessage(b.length+" Song(s) Added to Queue",!0)):"add"===c?(k.addSongs(b),j.updateMessage(b.length+" Song(s) Added to Queue",!0)):"display"===c&&(a.album=[],a.song=b)},function(a){!0===a.serviceError&&j.updateMessage(a.reason,!0)}),b},a.getDirectory=function(b,c,d,e){var f;"play"===b||"add"===b?(f=i.recursiveGetDirectory(c),a.requestSongs(f,b)):"display"===b&&(f=i.getDirectory(c),a.handleErrors(f).then(function(b){a.album=b.directories,a.song=b.songs,"root"===e?m.reset().push({id:c,name:d}):"forward"===e&&m.push({id:c,name:d}),a.selectedAutoAlbum=null,a.selectedArtist=null,a.selectedAlbum=c,a.selectedAutoPlaylist=null,a.selectedPlaylist=null,a.selectedPodcast=null,"default"!==a.SelectedAlbumSort.id&&u(a.SelectedAlbumSort.id)},function(a){j.updateMessage(a.reason,!0)}))},a.getAlbumListBy=function(b,c){var d=b?a.autoAlbums[b].offset:0;"next"===c?d+=Number(g.settings.AutoAlbumSize):"prev"===c?(d-=Number(g.settings.AutoAlbumSize))<0&&(d=0):d=0,a.autoAlbums[b].offset=d;var e=i.getAlbumListBy(b,d);a.handleErrors(e).then(function(b){a.album=b,"default"!==a.SelectedAlbumSort.id&&u(a.SelectedAlbumSort.id)},function(b){a.album=[],j.updateMessage(b.reason,!0)}),a.song=[],m.reset(),a.selectedAutoAlbum=b,a.selectedArtist=null,a.selectedAlbum=null,a.selectedAutoPlaylist=null,a.selectedPlaylist=null,a.selectedPodcast=null},a.getRandomStarredSongs=function(b){var c=i.getRandomStarredSongs();a.requestSongs(c,b),a.album=[],m.reset(),a.selectedAutoAlbum=null,a.selectedArtist=null,a.selectedAlbum=null,a.selectedAutoPlaylist="starred",a.selectedPlaylist=null,a.selectedPodcast=null},a.getRandomSongs=function(b,c,d){var e=i.getRandomSongs(c,d);a.requestSongs(e,b),isNaN(d)?a.selectedAutoPlaylist=void 0!==c&&""!==c&&"Random"!==c?c:"random":a.selectedAutoPlaylist=d,a.album=[],m.reset(),a.selectedAutoAlbum=null,a.selectedArtist=null,a.selectedAlbum=null,a.selectedPlaylist=null,a.selectedPodcast=null},a.getArtistByTag=function(b){a.selectedAutoAlbum=null,a.selectedArtist=b;var c=g.BaseURL()+"/getArtist.view?"+g.BaseParams()+"&id="+b;$.ajax({url:c,method:"GET",dataType:g.settings.Protocol,timeout:g.settings.Timeout,success:function(b){var c=[];void 0!==b["subsonic-response"].artist?(b["subsonic-response"].artist.album.length>0?c=b["subsonic-response"].artist.album:c[0]=b["subsonic-response"].artist.album,i.content.album=[],i.song=[],angular.forEach(c,function(a){i.content.album.push(h.mapAlbum(a))}),a.$apply()):j.updateMessage("No Albums Returned :(",!0)}})},a.getAlbumByTag=function(b){i.getAlbumByTag(b).then(function(b){a.album=b.album,a.song=b.song,a.BreadCrumbs=b.breadcrumb,a.selectedAutoAlbum=b.selectedAutoAlbum,a.selectedArtist=b.selectedArtist,a.selectedPlaylist=b.selectedPlaylist})},a.search=function(b,c){if(b&&b.length>0){var d=i.search(b,c);a.handleErrors(d).then(function(b){0===c?(a.song=b,a.album=[]):1===c?(a.song=[],a.album=b):2===c&&(a.song=[],a.album=[],a.shortcut=b),m.reset()},function(a){!0===a.serviceError&&j.updateMessage(a.reason,!0)})}},a.toggleAZ=function(){a.toggleSubmenu("#submenu_AZIndex","#AZIndex","right",44)},a.getPlaylists=function(){var b=i.getPlaylists();a.handleErrors(b).then(function(b){a.playlists=b.playlists,a.playlistsPublic=b.playlistsPublic},function(){a.playlists=[],a.playlistsPublic=[]})},a.getPlaylist=function(b,c){var d=i.getPlaylist(c);a.requestSongs(d,b).then(function(a){"display"===b&&j.updateMessage(a.length+" Song(s) in Playlist",!0)}),a.song=[],a.album=[],m.reset(),a.selectedAutoAlbum=null,a.selectedArtist=null,a.selectedAlbum=null,a.selectedAutoPlaylist=null,a.selectedPlaylist=c,a.selectedPodcast=null},a.newPlaylist=function(){var b=d.prompt("Choose a name for your new playlist.","");if(null!==b&&""!==b&&"null"!==b){var c=i.newPlaylist(b);a.handleErrors(c).then(function(){a.getPlaylists()})}},a.deletePlaylist=function(){if(!a.selectedPlaylist)return void j.updateMessage("Please select a playlist to delete.");if(d.confirm("Are you sure you want to delete the selected playlist?")){var b=i.deletePlaylist(a.selectedPlaylist);a.handleErrors(b).then(function(){a.getPlaylists()})}},a.addToPlaylist=function(b){if(0===n.get().length)return void j.updateMessage("Please select a song to add to that playlist.");var c=i.addToPlaylist(b,n.get());a.handleErrors(c).then(function(){n.reset(),j.updateMessage("Playlist Updated!",!0)})},a.savePlaylist=function(){if(!a.selectedPlaylist)return void j.updateMessage("Please select a playlist to save.");var b=i.savePlaylist(a.selectedPlaylist,a.song);a.handleErrors(b).then(function(){a.getPlaylist("display",a.selectedPlaylist),j.updateMessage("Playlist Updated!",!0)})},a.loadPlaylistsForMenu=function(){var b=i.getPlaylists();a.handleErrors(b).then(function(b){a.playlistMenu=b.playlists.concat(b.playlistsPublic),a.toggleSubmenu("#submenu_AddToPlaylist","#action_AddToPlaylist","left",124)},function(a){j.updateMessage(a.reason,!0)})},a.getGenres=function(){var b=i.getGenres();a.handleErrors(b).then(function(b){a.Genres=b},function(){a.Genres=[]})},a.$watch("selectedGenre",function(b,c){b&&b!==c&&(a.genrePlaylists=e(a.genrePlaylists).push(b).uniq().value(),l.saveSelectedGenreNames(a.genrePlaylists))}),a.loadGenrePlaylists=function(){a.genrePlaylists=l.loadSelectedGenreNames()},a.deleteGenrePlaylist=function(b){e.remove(a.genrePlaylists,function(a){return a===b}),l.deleteSelectedGenreNames(),l.saveSelectedGenreNames(a.genrePlaylists)},a.getPodcasts=function(){var b=i.getPodcasts();a.handleErrors(b).then(function(b){a.podcasts=b},function(){a.podcasts=[]})},a.getPodcast=function(b,c){var d=i.getPodcast(c);a.requestSongs(d,b),a.song=[],a.album=[],m.reset(),a.selectedAutoAlbum=null,a.selectedArtist=null,a.selectedAlbum=null,a.selectedAutoPlaylist=null,a.selectedPlaylist=null,a.selectedPodcast=c},a.getMusicFolders=function(){var b=i.getMusicFolders();a.handleErrors(b).then(function(b){var c=b;a.MusicFolders=c;var d=l.getSelectedMusicFolder();d&&-1!==e.findIndex(c,{id:d.id})&&(a.SelectedMusicFolder=d)})},a.dragStart=function(a,b){b.item.data("start",b.item.index())},a.dragEnd=function(b,c){var d=c.item.data("start"),e=c.item.index();a.song.splice(e,0,a.song.splice(d,1)[0])},a.searching={query:"",typeId:g.settings.DefaultSearchType,types:g.SearchTypes},a.genrePlaylists=[],a.MusicFolders=[],a.getMusicFolders(),a.getArtists(),a.getPlaylists(),a.getGenres(),a.loadGenrePlaylists(),a.getPodcasts(),a.openDefaultSection(),c.artistId&&c.albumId?a.getAlbumByTag(c.albumId):c.artistId&&a.getAlbums(c.artistId)}]),angular.module("jamstash.subsonic.service",["ngLodash","jamstash.settings.service","jamstash.model"]).service("subsonic",subsonicService),subsonicService.$inject=["$http","$q","lodash","globals","map"],angular.module("jamstash.breadcrumbs.service",["ngLodash"]).factory("breadcrumbs",["lodash",function(a){function b(a,b){return a.id===b.id&&a.name===b.name}var c=[],d={get:function(){return c},push:function(a){var b={id:a.id,name:a.name};return c.push(b),d},popUntil:function(e){return a.find(c,function(a){return b(a,e)})?(c=a.dropRightWhile(c,function(a){return!b(a,e)}),d):d},reset:function(){return c=[],d}};return d}]),angular.module("jamstash.breadcrumbs.directive",["ngLodash","jamstash.breadcrumbs.service"]).directive("jamstashBreadcrumbs",["lodash","breadcrumbs","subsonic","notifications",function(a,b,c,d){function e(a,e){var f=this;e.extend(f,{getBreadcrumbs:b.get,displaySongs:function(e){var f=c.getDirectory(e.id);a.handleErrors(f).then(function(c){a.album=c.directories,a.song=c.songs,b.popUntil(e),a.selectedAutoAlbum=null,a.selectedArtist=null,a.selectedAlbum=e.id,a.selectedAutoPlaylist=null,a.selectedPlaylist=null,a.selectedPodcast=null,"default"!==a.SelectedAlbumSort.id&&a.sortSubsonicAlbums(a.SelectedAlbumSort.id)},function(a){d.updateMessage(a.reason,!0)})}})}var f={controller:e,controllerAs:"vm",restrict:"E",templateUrl:"subsonic/breadcrumbs-directive/breadcrumbs-directive.html",replace:!0};return e.$inject=["$scope","lodash"],f}]),angular.module("jamstash.archive.controller",["jamstash.archive.service","jamstash.selectedsongs"]).controller("ArchiveController",["$scope","$rootScope","$location","$routeParams","$http","$timeout","utils","globals","model","notifications","player","archive","json","SelectedSongs",function(a,b,c,d,e,f,g,h,i,j,k,l,m,n){a.settings=h.settings,a.itemType="archive",b.song=[],a.Protocol="jsonp",a.artist=[],a.album=[],a.selectedArtist=null,a.selectedAlbum=null,a.selectedSongs=[],a.SavedCollections=h.SavedCollections,a.AllArtists=[],a.loadedCollection=!1,a.writeSavedCollection=function(){g.setValue("SavedCollections",a.SavedCollections.join(),!1),h.SavedCollections=a.SavedCollections},a.addSavedCollection=function(b){if(-1==a.SavedCollections.indexOf(b)){a.SavedCollections.push(b),a.writeSavedCollection();var c=a.AllArtists.indexOf(b);a.AllArtists.splice(c,1)}},a.deleteSavedCollection=function(b){a.SavedCollections.splice(b,1),a.writeSavedCollection()},a.setupDemoCollections=function(){var b=["YonderMountainStringBand","GreenskyBluegrass"];angular.forEach(b,function(b,c){-1==a.SavedCollections.indexOf(b)&&a.SavedCollections.push(b)})},a.selectedArchiveAlbumSort=h.settings.DefaultArchiveAlbumSort,a.ArchiveAlbumSort=["addeddate desc","addeddate asc","avg_rating desc","avg_rating asc","createdate desc","createdate asc","date desc","date asc","downloads desc","downloads asc","num_reviews desc","num_reviews asc","publicdate desc","publicdate asc","stars desc","stars asc"],a.$watch("selectedArchiveAlbumSort",function(b,c){g.getValue("AlbumSort")!=b&&(void 0!==b?(g.setValue("AlbumSort",b,!0),h.settings.DefaultArchiveAlbumSort=b):g.setValue("AlbumSort",null,!0),a.getAlbums(a.selectedArtist))}),a.getYears=function(a){var b=(new Date).getFullYear(),c=[];for(a=a||1950;a<=b;)c.push(a++);return c},a.Years=a.getYears(),a.filter={Year:"",Source:"",Description:""},a.filterSave=function(){a.selectedArtist&&a.getAlbums(a.selectedArtist,a.filter)},a.getArtists=function(b){var c=$("#Artists").val(),d=$("#Collections option:selected").text();(b||c.length>=3)&&l.getArtists(c,d).then(function(b){a.AllArtists=b.artist,a.loadedCollection=!0})},a.getAlbums=function(b){l.getAlbums(b,a.filter).then(function(b){a.song=b.song,a.album=b.album,a.selectedArtist=b.selectedArtist,a.BreadCrumbs=b.breadcrumb})},a.getSongs=function(b,c){l.getSongs(b,c).then(function(b){a.album=b.album,a.song=b.song,a.selectedAlbum=b.selectedAlbum,a.BreadCrumbs=b.breadcrumb,f(function(){$.fancybox.update()})})},a.scrollToTop=function(){$("#Artists").stop().scrollTo("#auto",400)},a.selectAll=function(){n.addSongs(a.song)},a.addSelectedSongsToQueue=function(){0!==n.get().length&&(k.addSongs(n.get()),j.updateMessage(n.get().length+" Song(s) Added to Queue",!0),n.reset())},a.toggleSelection=function(a){n.toggle(a)},a.selectNone=function(){n.reset()},a.playAll=function(){k.emptyQueue().addSongs(a.song).playFirstSong()},a.playFrom=function(b){var c=a.song.slice(b,a.song.length);k.emptyQueue().addSongs(c).playFirstSong()},a.addSongToQueue=function(a){k.addSong(a)},a.playSong=function(a){k.emptyQueue().addSong(a).playFirstSong()},a.removeSong=function(c){b.removeSong(c,a.song)},a.toggleStar=function(a){},a.getAlbums(),d.artist&&(d.album?a.getSongs(d.album):a.getAlbums(d.artist),a.addSavedCollection(d.artist))}]),angular.module("jamstash.archive.service",["jamstash.settings.service","jamstash.model","jamstash.notifications","jamstash.player.service"]).factory("archive",["$rootScope","$http","$q","$sce","globals","model","utils","map","notifications","player",function(a,b,c,d,e,f,g,h,i,j){var k={artist:[],album:[],song:[],breadcrumb:[],selectedArtist:null,selectedAlbum:null,selectedGenre:null,selectedArchiveAlbumSort:"date desc"},l={mapAlbum:function(a){var b,c,h,i,j,k,l,m,n,o,p,q=a,r=e.archiveUrl+"details/"+q.identifier;b="images/albumdefault_50.7c4beb44.jpg",c="images/albumdefault_160.jpg",h=5==parseInt(q.avg_rating),i=void 0===q.title?"&nbsp;":q.title.toString(),n=void 0===q.identifier?"&nbsp;":q.identifier.toString(),j=void 0===q.collection[0]?"&nbsp;":q.collection[0].toString(),o=void 0===q.source?"&nbsp;":q.source.toString(),p=void 0===q.date?"&nbsp;":q.date.toString(),k=void 0===q.publisher?"&nbsp;":q.publisher.toString(),l=void 0===q.avg_rating?"&nbsp;":q.avg_rating.toString(),m=void 0===q.downloads?"&nbsp;":q.downloads.toString();var s="<b>Source</b>: "+o+"<br />";return s+="<b>Date</b>: "+p+"<br />",s+="<b>Transferer</b>: "+k+"<br />",s+="<b>Rating</b>: "+l+"<br />",s+="<b>Downloads</b>: "+m+"<br />",new f.Album(n,null,i,j,"",b,c,g.formatDate(new Date(q.publicdate),"yyyy-MM-dd h:mm a"),h,d.trustAsHtml(s),r)},mapSong:function(a,b,c,d,e,h){var i,j,k,l="";if("VBR MP3"==b.format)return i="http://"+c+d+a,l=void 0===b.bitrate||void 0===b.format?"&nbsp;":b.bitrate+"kbps, "+b.format.toLowerCase(),void 0===b.track?"&nbsp;":b.track,k=void 0===b.title?"&nbsp;":b.title,j=void 0===b.length?"&nbsp;":g.timeToSeconds(b.length),new f.Song(b.md5,e,b.track,k,b.creator,"",b.album,"",h,h,j,"","","mp3",l,i,0,"")},getArtists:function(a){var b=c.defer();e.settings.Debug&&console.log("LOAD ARCHIVE.ORG COLLECTIONS");var d=e.archiveUrl+"advancedsearch.php?q=";return d+=""!==a?"mediatype:(collection) AND identifier:("+a+")":"collection:(collection)",d+="&fl[]=identifier&sort[]=&sort[]=&sort[]=&rows=50&page=1&output=json",$.ajax({url:d,method:"GET",dataType:e.settings.Protocol,timeout:e.settings.Timeout,success:function(a){if(a.response.docs.length>0){var c=a.response.docs;k.artist=[],angular.forEach(c,function(a,b){k.artist.push(a.identifier)})}else i.updateMessage("Sorry :(",!0);b.resolve(k)}}),b.promise},getAlbums:function(a,b){var d=c.defer();if(a){var f=e.archiveUrl+"advancedsearch.php?q=";""!==a?(k.selectedArtist=a,f+="collection:("+a+") AND format:(MP3)"):k.selectedArtist?(a=k.selectedArtist,f+="collection:("+k.selectedArtist+") AND format:(MP3)"):f+="collection:("+a+")",k.breadcrumb=[],k.breadcrumb.push({type:"artist",id:a,name:a}),b.Source&&(f+=" AND source:("+b.Source+")"),b.Year&&parseInt(b.Year)&&(f+=" AND year:("+b.Year+")"),b.Description&&(f+=" AND description:("+b.Description+")"),k.selectedArtist&&(f+="&sort[]="+e.settings.DefaultArchiveAlbumSort),f+="&fl[]=avg_rating,collection,date,description,downloads,headerImage,identifier,publisher,publicdate,source,subject,title,year",f+="&rows=50&page=1&output=json",$.ajax({url:f,method:"GET",dataType:e.settings.Protocol,timeout:e.settings.Timeout,success:function(a){var b=[];a.response.docs.length>0?(b=a.response.docs,k.album=[],k.song=[],angular.forEach(b,function(a,b){k.album.push(l.mapAlbum(a))}),i.updateMessage(k.album.length+" Items Returned",!0)):i.updateMessage("Sorry :(",!0),d.resolve(k)},error:function(){i.updateMessage("Archive.org service down :(")}})}else d.resolve(k);return d.promise},getSongs:function(a,b){var d=c.defer();if(a){k.selectedAlbum=a,k.breadcrumb.length>0&&k.breadcrumb.splice(1,k.breadcrumb.length-1),k.breadcrumb.push({type:"album",id:a,name:a});var f=e.archiveUrl+"details/"+a+"?output=json";$.ajax({url:f,method:"GET",dataType:e.settings.Protocol,timeout:e.settings.Timeout,success:function(a){var c="",e=a.server,f=a.dir,g=a.metadata.identifier[0];void 0!==a.misc.image&&(c=a.misc.image);var h=a.files;if("add"==b)angular.forEach(h,function(a,b){var d=l.mapSong(b,a,e,f,g,c);d&&j.queue.push(d)}),i.updateMessage(Object.keys(h).length+" Song(s) Added to Queue",!0);else if("play"==b){j.queue=[],angular.forEach(h,function(a,b){var d=l.mapSong(b,a,e,f,g,c);d&&j.queue.push(d)});var m=j.queue[0];j.play(m),i.updateMessage(Object.keys(h).length+" Song(s) Added to Queue",!0)}else k.album=[],k.song=[],angular.forEach(h,function(a,b){var d=l.mapSong(b,a,e,f,g,c);d&&k.song.push(d)});d.resolve(k)}})}else d.resolve(k);return d.promise}};return l}]),angular.module("jamstash.player.controller",["jamstash.player.service","jamstash.player.directive","jamstash.repeat.directive"]).controller("PlayerController",["$scope","player","globals",function(a,b,c){a.getPlayingSong=b.getPlayingSong,a.settings=c.settings,a.playerSettings=b.settings,a.play=function(){c.settings.Jukebox?a.sendToJukebox("start"):b.togglePause()},a.pause=function(){c.settings.Jukebox?a.sendToJukebox("stop"):b.togglePause()},a.previousTrack=b.previousTrack,a.nextTrack=b.nextTrack}]),angular.module("jamstash.player.directive",["jamstash.player.service","jamstash.settings.service","jamstash.subsonic.service","jamstash.notifications","jamstash.persistence","jamstash.page"]).directive("jplayer",["$interval","player","globals","subsonic","notifications","persistence","Page",function(a,b,c,d,e,f,g){return{restrict:"EA",template:"<div></div>",link:function(h,i){$(".PlayTrack").on("click",function(a){a.preventDefault(),$(this).hide(),$(".PauseTrack").show()}),$(".PauseTrack").on("click",function(a){a.preventDefault(),$(this).hide(),$(".PlayTrack").show()});var j,k=i.children("div"),l="html,flash";c.settings.ForceFlash&&(l="flash,html");var m=function(){$.jPlayer.timeFormat.showHour=!0,k.jPlayer({swfPath:"bower_components/jplayer/dist/jplayer/jquery.jplayer.swf",wmode:"window",solution:l,supplied:"mp3, oga, m4a",preload:"auto",errorAlerts:!1,warningAlerts:!1,cssSelectorAncestor:"#player",cssSelector:{play:".PlayTrack",pause:".PauseTrack",seekBar:"#audiocontainer .scrubber",playBar:"#audiocontainer .progress",mute:"#action_Mute",unmute:"#action_UnMute",volumeMax:"#action_VolumeMax",currentTime:"#played",duration:"#duration"},setmedia:function(){h.scrobbled=!1},play:function(){h.revealControls()},ended:function(){b.isLastSongPlaying()&&c.settings.AutoPlay?d.getRandomSongs().then(function(a){b.addSongs(a).songEnded(),e.updateMessage("Auto Play Activated...",!0)}):b.songEnded(),h.$apply()},timeupdate:function(a){var b=a.jPlayer.status.currentPercentAbsolute,e=!a.jPlayer.status.paused;!h.scrobbled&&b>30&&e&&(c.settings.Debug&&console.log("LAST.FM SCROBBLE - Percent Played: "+b),d.scrobble(h.currentSong),h.scrobbled=!0)},error:function(a){var b=a.jPlayer.status.currentTime;b&&k.jPlayer("play",b),c.settings.Debug&&(console.log("jPlayer error: ",a.jPlayer.error),console.log("Stream interrupted, retrying from position: ",b))}})};h.$watch(function(){return b.getPlayingSong()},function(a){if(void 0!==a){h.currentSong=a,g.setTitleSong(a),$.fancybox.isOpen&&h.fancyboxOpenImage(a.coverartfull);var d={};"oga"===a.suffix?d={oga:a.url}:"m4a"===a.suffix?d={m4a:a.url}:"mp3"===a.suffix&&(d={mp3:a.url}),k.jPlayer("setMedia",d),c.settings.Jukebox&&(k.jPlayer("mute",!0),h.addToJukebox(a.id)),!0===b.loadSong||c.settings.Jukebox?(b.loadSong=!1,h.revealControls(),k.jPlayer("pause",a.position)):(k.jPlayer("play"),c.settings.NotificationSong&&e.showNotification(a))}}),h.$watch(function(){return b.restartSong},function(a){!0===a&&(k.jPlayer("play",0),h.scrobbled=!1,b.restartSong=!1)}),h.$watch(function(){return b.pauseSong},function(a){!0===a?k.jPlayer("pause"):k.jPlayer("play")}),h.$watch(function(){return b.getVolume()},function(a){k.jPlayer("volume",a),c.settings.Debug&&console.log("Volume: "+Math.round(100*a)+"%")}),h.$watch(function(){return c.settings.SaveTrackPosition},function(a){!0===a&&h.startSavePosition()}),h.revealControls=function(){$("#playermiddle").css("visibility","visible"),$("#songdetails").css("visibility","visible")},h.startSavePosition=function(){c.settings.SaveTrackPosition&&(0!==j&&a.cancel(j),j=a(function(){var a=k.data("jPlayer");c.settings.SaveTrackPosition&&void 0!==h.currentSong&&void 0!==a&&a.status.currentTime>0&&!1===a.status.paused&&($("#action_SaveProgress").fadeTo("slow",0).delay(500).fadeTo("slow",1).delay(500).fadeTo("slow",0).delay(500).fadeTo("slow",1),h.currentSong.position=a.status.currentTime,f.saveTrackPosition(h.currentSong),f.saveQueue())},3e4))},j=0,h.currentSong={},h.scrobbled=!1,m(),h.startSavePosition(),$("#audiocontainer .scrubber").mouseover(function(){$(".audiojs .scrubber").stop().animate({height:"8px"})}),$("#audiocontainer .scrubber").mouseout(function(){$(".audiojs .scrubber").stop().animate({height:"4px"})})}}}]),angular.module("jamstash.player.service",["ngLodash"]).factory("player",["lodash",function(a){var b=1,c={_playingIndex:-1,_playingSong:void 0,queue:[],pauseSong:!1,restartSong:!1,loadSong:!1,settings:{repeat:"none",repeatValues:["queue","song","none"]},play:function(a){var b=c.indexOfSong(a);c._playingIndex=void 0!==b?b:-1,c._playingSong===a?c.restart():c._playingSong=a},togglePause:function(){c.pauseSong?c.pauseSong=!1:c.pauseSong=!0},playFirstSong:function(){c._playingIndex=0,c.play(c.queue[0])},load:function(a){c.loadSong=!0,c.play(a)},restart:function(){c.restartSong=!0},songEnded:function(){"song"===c.settings.repeat?c.restart():!0===c.isLastSongPlaying()?"queue"===c.settings.repeat&&c.playFirstSong():c.nextTrack()},nextTrack:function(){var a=c.indexOfSong(c._playingSong);if(c._playingIndex=void 0!==a?a:-1,c._playingIndex+1<c.queue.length){var b=c.queue[c._playingIndex+1];c._playingIndex++,c.play(b)}},previousTrack:function(){var a=c.indexOfSong(c._playingSong);if(c._playingIndex=void 0!==a?a:-1,c._playingIndex-1>0){var b=c.queue[c._playingIndex-1];c._playingIndex--,c.play(b)}else c.queue.length>0&&c.playFirstSong()},emptyQueue:function(){return c.queue=[],c},shuffleQueue:function(){var b=a.without(c.queue,c._playingSong);return b=a.shuffle(b),void 0!==c._playingSong&&(b.unshift(c._playingSong),c._playingIndex=0),c.queue=b,c},addSong:function(a){return c.queue.push(a),c},addSongs:function(a){return c.queue=c.queue.concat(a),c},removeSong:function(a){var b=c.queue.indexOf(a);return c.queue.splice(b,1),c},removeSongs:function(b){return c.queue=a.difference(c.queue,b),c},reorderQueue:function(a,b){if(a<0||a>=c.queue.length||b<0||b>=c.queue.length)return c;var d=c.queue[a];return c.queue.splice(a,1),c.queue.splice(b,0,d),c},getPlayingSong:function(){return c._playingSong},isLastSongPlaying:function(){return c._playingIndex+1===c.queue.length},indexOfSong:function(a){for(var b=c.queue.length-1;b>=0;b--)if(angular.equals(a,c.queue[b]))return b},turnVolumeUp:function(){var a=b;return(a+.1>1||a<0)&&(a=.9),a+=.1,b=Math.round(100*a)/100,a},turnVolumeDown:function(){var a=b;return(a>1||a-.1<0)&&(a=.1),a-=.1,b=Math.round(100*a)/100,a},getVolume:function(){return b},setVolume:function(a){return a>1?a=1:a<0&&(a=0),b=Math.round(100*a)/100,c}};return c}]),angular.module("jamstash.repeat.directive",["jamstash.notifications"]).directive("jamstashRepeat",["notifications",function(a){return{restrict:"E",templateUrl:"player/repeat-directive/repeat-directive.html",replace:!0,scope:{selectedValue:"=",values:"="},link:function(b){b.$watch("selectedValue",function(a){b.selectedIndex=b.values.indexOf(a)}),b.cycleRepeat=function(){b.selectedIndex=(b.selectedIndex+1)%b.values.length,b.selectedValue=b.values[b.selectedIndex],a.updateMessage("Repeat "+b.selectedValue,!0)}}}}]),angular.module("jamstash.queue.controller",["ngLodash","jamstash.player.service","jamstash.subsonic.service","jamstash.selectedsongs","jamstash.notifications","ui.sortable"]).controller("QueueController",QueueController),QueueController.$inject=["$scope","lodash","player","SelectedSongs","subsonic","notifications"],angular.module("JamStash").filter("capitalize",function(){return function(a,b){return a.substring(0,1).toUpperCase()+a.substring(1)}}).filter("musicfolder",function(){return function(a,b){return a.slice(1,a.length)}}).filter("capitalize",function(){return function(a,b){return a.substring(0,1).toUpperCase()+a.substring(1)}}),angular.module("JamStash").directive("sortable",function(){return{link:function(a,b,c){b.sortable({start:a.dragStart,update:a.dragEnd}),b.disableSelection()}}}).directive("fancybox",["$compile",function(a){return{restrict:"A",replace:!1,link:function(b,c,d){b.fancyboxOpen=function(){var d=angular.element(c.html()),e=a(d);$.fancybox.open(d),e(b)}}}}]).directive("songpreview",["$compile","subsonic",function(a,b){return{restrict:"E",templateUrl:"common/songs.html",replace:!1,scope:{song:"@"},link:function(a,c,d){b.getSongTemplate(function(b){a.song=b,$.fancybox.open(c)})}}}]).directive("stopEvent",function(){return{restrict:"A",link:function(a,b,c){b.bind(c.stopEvent,function(a){a.stopPropagation()})}}}).directive("ngEnter",function(){return{scope:{onEnter:"&"},link:function(a,b){console.log(a),b.bind("keydown keypress",function(b){13===b.which&&(a.onEnter(),a.$apply())})}}}).directive("ngDownload",["$compile",function(a){return{restrict:"E",scope:{data:"="},link:function(b,c,d){function e(){return URL.createObjectURL(new Blob([JSON.stringify(b.data)],{type:"application/json"}))}c.append(a('<a class="button" download="backup.json"href="'+e()+'">Download</a>')(b)),b.$watch(b.data,function(){c.children()[0].href=e()})}}}]).directive("stopEvent",function(){return{restrict:"A",link:function(a,b,c){b.bind(c.stopEvent,function(a){a.stopPropagation()})}}}).directive("ngEnter",function(){return function(a,b,c){b.bind("keydown keypress",function(b){13===b.which&&(a.$apply(function(){a.$eval(c.ngEnter)}),b.preventDefault())})}}).directive("ngMsgs",function(){return{restrict:"E",transclude:!1,scope:{msgs:"="},template:'<span id="msg_{{$index}}" class="message">{{ item }}</span>',link:function(a,b,c){a.$watch(a.Messages,function(){var c=$compile(template(a));b.append(c),$(b).parent().fadeIn()})}}});

Zerion Mini Shell 1.0