diff --git a/app/common/main-controller.js b/app/common/main-controller.js index c927a4f..97cad7f 100644 --- a/app/common/main-controller.js +++ b/app/common/main-controller.js @@ -1,6 +1,6 @@ angular.module('JamStash') -.controller('AppCtrl', ['$scope', '$rootScope', '$document', '$window', '$location', '$cookieStore', 'utils', 'globals', 'model', 'notifications', 'player', - function($scope, $rootScope, $document, $window, $location, $cookieStore, utils, globals, model, notifications, player) { +.controller('AppCtrl', ['$scope', '$rootScope', '$document', '$window', '$location', '$cookieStore', '$http', 'utils', 'globals', 'model', 'notifications', 'player', + function($scope, $rootScope, $document, $window, $location, $cookieStore, $http, utils, globals, model, notifications, player) { 'use strict'; $rootScope.settings = globals.settings; @@ -162,7 +162,7 @@ } } }; - + $rootScope.showIndex = false; $scope.dragStart = function (e, ui) { ui.item.data('start', ui.item.index()); }; @@ -173,6 +173,10 @@ $rootScope.queue.splice(start, 1)[0]); $scope.$apply(); }; + $(document).on( 'click', 'message', function() { + $(this).fadeOut(function () { $(this).remove(); }); + return false; + }) $document.keydown(function (e) { $scope.scrollToIndex(e); }); @@ -328,6 +332,14 @@ }); }; $scope.ping = function () { + return $http({ + method: 'GET', + timeout: globals.settings.Timeout, + url: globals.BaseURL() + '/ping.view?' + globals.BaseParams(), + }).error(function (data) { + notifications.updateMessage('Unable to connect to Subsonic server'); + }); + /* $.ajax({ url: globals.BaseURL() + '/ping.view?' + globals.BaseParams(), method: 'GET', @@ -346,6 +358,7 @@ notifications.updateMessage('Unable to connect to Subsonic server'); } }); + */ }; $scope.queueRemoveSelected = function (data, event) { angular.forEach($scope.selectedSongs, function (item, key) { diff --git a/app/common/notification-service.js b/app/common/notification-service.js index c895cc6..45a53fe 100644 --- a/app/common/notification-service.js +++ b/app/common/notification-service.js @@ -11,17 +11,12 @@ angular.module('jamstash.notifications', []) var msgIndex = 1; this.updateMessage = function (msg, autohide) { if (msg !== '') { - $rootScope.Messages.push(msg); + var id = $rootScope.Messages.push(msg) - 1; $('#messages').fadeIn(); if (autohide) { setTimeout(function () { - $(el).fadeOut(function () { $(this).remove(); }); + $('#msg_' + id).fadeOut(function () { $(this).remove(); }); }, globals.settings.Timeout); - } else { - $(el).click(function () { - $(el).fadeOut(function () { $(this).remove(); }); - return false; - }); } } }; diff --git a/app/settings/settings.js b/app/settings/settings.js index 4da0765..727ed87 100644 --- a/app/settings/settings.js +++ b/app/settings/settings.js @@ -62,7 +62,17 @@ notifications.updateMessage('Settings Updated!', true); $scope.loadSettings(); if (globals.settings.Server !== '' && globals.settings.Username !== '' && globals.settings.Password !== '') { - $scope.ping(); + $scope.ping().then(function(data) { + if (data["subsonic-response"].status == 'ok') { + globals.settings.ApiVersion = data["subsonic-response"].version; + $location.path('/library').replace(); + $rootScope.showIndex = true; + } else { + if (typeof data["subsonic-response"].error != 'undefined') { + notifications.updateMessage(data["subsonic-response"].error.message); + } + } + }); } }; json.getChangeLog(function (data) { @@ -92,8 +102,8 @@ globals.settings.Username = Username; globals.settings.Password = Password; globals.settings.Server = Server; - //$scope.save(); - $location.url('/library'); + $location.path('/library').replace(); + $rootScope.showIndex = true; } }; diff --git a/app/styles/Mobile.css b/app/styles/Mobile.css index 8dc8de7..9ce2f00 100644 --- a/app/styles/Mobile.css +++ b/app/styles/Mobile.css @@ -1,8 +1,4 @@ -/*@media only screen and (max-device-width: 680px) {*/ -@media only screen and (max-width: 500px) { - -} -@media only screen and (max-width: 600px) { +@media only screen and (max-width: 400px) { .smcolumn { width: 75%; background: rgba(255, 255, 255, 0.8); @@ -50,7 +46,7 @@ } ul.songlist .albumgrid { padding: 0px 0px 22px 0px; - width: 150px; + width: 162px; height: 160px; } ul.songlist .albumgrid .itemactions { @@ -70,7 +66,7 @@ margin-right: 5px; } ul.songlist .albumgrid .albuminfo { - width: 150px; + width: 142px; } ul.songlist .album a:hover { background-position: center center; diff --git a/app/styles/Style.css b/app/styles/Style.css index be52087..851b759 100644 --- a/app/styles/Style.css +++ b/app/styles/Style.css @@ -238,8 +238,9 @@ span.apiversion background: #fff; } .smcolumn .leftactions { - margin: 5px 5px 0 0; - float: right; + margin: 46px 2px 0 0; + position: fixed; + left: 264px; } .lgcolumn { @@ -1080,14 +1081,14 @@ ul.songlist li:hover .actions { height: 30px; - margin: 6px 5px 0 184px; + margin: 6px 5px 0 185px; padding: 0 0 0 5px; } .subactions { - height: 29px; + height: 30px; /* width: 660px; */ - margin: 5px 105px 0 0; + margin: 6px 125px 0 5px; padding: 0 0 0 5px; float: right; } @@ -1097,7 +1098,7 @@ ul.songlist li:hover top: 0px; right: 65px; height: 29px; - margin: 5px 0 0 0; + margin: 6px 0 0 0; } #search { @@ -1243,7 +1244,7 @@ ul.songlist li:hover #player { border-top: 1px solid #cbcbcb; - border-bottom: 1px solid #cbcbcb; + border-bottom: none; margin: 4px 0 0 0; /*height: 75px;*/ position: absolute; diff --git a/app/subsonic/subsonic-service.js b/app/subsonic/subsonic-service.js index 319df83..2dda7cf 100644 --- a/app/subsonic/subsonic-service.js +++ b/app/subsonic/subsonic-service.js @@ -30,7 +30,6 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util var genres = []; var podcasts = []; var offset = 0; - var showIndex = false; var showPlaylist = false; var showPodcast = false; @@ -71,7 +70,7 @@ angular.module('jamstash.subsonic.service', ['jamstash.settings', 'jamstash.util }; return { - showIndex: showIndex, + showIndex: $rootScope.showIndex, showPlaylist: showPlaylist, getSongTemplate: function (callback) { var id = '16608'; diff --git a/app/subsonic/subsonic.js b/app/subsonic/subsonic.js index 4e14633..83f0271 100644 --- a/app/subsonic/subsonic.js +++ b/app/subsonic/subsonic.js @@ -24,17 +24,17 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service']) ]; $scope.SelectedAlbumSort = globals.settings.DefaultAlbumSort; $scope.AlbumSort = globals.AlbumSorts; - $scope.showIndex = subsonic.showIndex; + $rootScope.showIndex = subsonic.showIndex; $scope.$watch("showIndex", function (newValue, oldValue) { if (newValue !== oldValue) { - subsonic.showIndex = $scope.showIndex; + subsonic.showIndex = $rootScope.showIndex; } }); $scope.toggleIndex = function () { - if ($scope.showIndex) { - $scope.showIndex = false; + if ($rootScope.showIndex) { + $rootScope.showIndex = false; } else { - $scope.showIndex = true; + $rootScope.showIndex = true; $scope.showPlaylist = false; $scope.showPodcast = false; } @@ -51,7 +51,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service']) $scope.showPlaylist = false; } else { $scope.showPlaylist = true; - $scope.showIndex = false; + $rootScope.showIndex = false; $scope.showPodcast = false; } $scope.saveDefaultSection('playlist'); @@ -68,7 +68,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service']) } else { $scope.showPodcast = true; $scope.showPlaylist = false; - $scope.showIndex = false; + $rootScope.showIndex = false; } $scope.saveDefaultSection('podcast'); }; @@ -79,7 +79,7 @@ angular.module('jamstash.subsonic.ctrl', ['jamstash.subsonic.service']) var section = utils.getValue('DefaultSection'); switch (section) { case 'index': - $scope.showIndex = true; + $rootScope.showIndex = true; break; case 'playlist': $scope.showPlaylist = true;