Commit graph

39 commits

Author SHA1 Message Date
Hyzual
a97e5159bc Uses angular-locker to store settings in localStorage
- settings.js now has its own module : 'jamstash.settings.controller'. This makes it easier to test it and identify what dependencies it has.
- Renames 'jamstash.settings' module into 'jamstash.settings.service'
- Adds an angular constant to hold the current Jamstash version in app.js.
- Adds a way to upgrade incrementally what was in localStorage : in 4.4.5, DefaultSearchType will no longer be an object but an int, so we must init it with an int value, otherwise a blank option will be displayed. We detect what version we are using and what version was stored using persistence-service.js and run the upgrade accordingly.

- Refactors almost completely persistence-service_test.js
- Unit-tests some of settings.js's methods.
2015-03-24 18:36:54 +01:00
Hyzual
faf004b5b0 4.4.4 Prevents global shortcuts on inputs
- Adds a control on the origin of keyboard shortcuts
This prevents pausing the song when typing "space" in the search input.

- Moves volume management to player-service. Adds getters and setters.
The setter also checks the volume so it stays between 0 and 1.
2015-02-15 15:14:17 +01:00
Hyzual
06329bef70 Fixes persistence's mock, adds back the original keycode detection 2015-02-08 22:50:14 +01:00
Hyzual
5a7a06d1a2 Adds the left and right keys to get previous / next song
Removes the previous code in main-controller.js
2015-02-08 22:46:48 +01:00
Hyzual
a85865371c Adds back setting the volume up / down using the keyboard
- Adds a volume field to the player service. It is set directly, no need for get/set...
- Adds a watcher in player-directive to set jPlayer's volume accordingly
- Adds turnVolumeUp and turnVolumeDown methods to the main scope. For the moment they are fine there, we'll maybe move them to the player service if they are called by anything else.
- Adds get/save/delete for the volume in the persistence service.
2015-02-08 22:46:47 +01:00
Hyzual
8529e331a2 Adds angular-ui/ui-utils/ui-keypress dependency
It provides a directive to bind keypress / keyup / keydown events to the DOM.
- Adds back toggling play / pause by pressing space.
- Renames player-service's pause() to togglePause(), which is its actual behavior
- Adds unit tests to togglePause() in player-service
2015-02-08 22:46:47 +01:00
Trevor Squillario
0f67a2312a Fix spacebar pause keybinding 2015-01-20 20:52:04 -05:00
Hyzual
8b3a12f052 Moves drag & drop support from main-controller.js to queue.js
Adds a indexOfSong method to player-service. It is used in play, nextTrack and previousTrack so the player can adapt to changes to the queue order. Previously it wasn't taken into account and when we changed the order of the queue (through drag & drop or shuffle), the next song wasn't what we expected it to be.
2015-01-17 19:15:10 +01:00
Hyzual
09fb66f2fe Adds back support of oga and m4a
- Fixes the various remaining calls to $rootScope.queue. They now use the player service.
- main-controller.js watches the player's queue and shows the queue on change (if the global setting is true)
- Fixes the animation of the scrubber width. It is now done in the player directive.
2015-01-17 19:15:09 +01:00
Hyzual
3324113af8 When changing song, if fancybox is open, opens the new song's cover art in it
- Fixes a bug with the Page service. There was an error when changing songs.
- Removes fancyboxOpenImage from utils, it's directly in the main controller so we can call it from the directive. It didn't need to be in a service anymore since we have a player directive.
2015-01-17 19:15:09 +01:00
Hyzual
c478f0116f Replaced utils setTitle and scrollTitle by a dedicated service
- Adds a Page service that will control the page's title from anywhere.
- Adds a setTitleSong method. It takes a song as parameter, that way
  player-directive isn't responsible for correctly formatting the title. It also scrolls the title if the global setting is true
- Removes the title-related methods from utils-service
2015-01-17 19:15:09 +01:00
Hyzual
42830bbdbf Extracts everything related to localStorage in common/persistence-service.js
That way, whenever we want to use something else (like a JSON file, or a DB) we will only have to change persistence-service.js
- Migrated the unit tests there too.
- Added replay in case of jPlayer error.
2015-01-17 19:15:07 +01:00
Hyzual
3c809d1903 Adds back displaying the currently playing song as such in the queue
We no longer alter the song, the queue gets this from the player.
That way we can't have two songs marked as 'playing' at the same time.
2015-01-17 19:15:07 +01:00
Hyzual
c787c468b9 Further refactoring of the queue controller and view
- Removes queue-related functions from the main controller. They are now handled by queue.js, which delegates them to player-service.js
- Fixes problem in scrobbling. A song is no longer scrobbled every time it is paused. A song will not be scrobbled upon loading, only while it is playing.
- Moves the entire html for the sidebar queue to queue.html. It replaces a template that was no longer used.
- Most queue-related functions in player return player itself to make them chainable just like in jQuery, e.g. : player.shuffleQueue().playFirstSong();
2015-01-17 19:14:25 +01:00
Hyzual
83869b7808 Adds angular-locker dependency.
- It makes it easier to use localStorage and sessionStorage "the angular way". It also does all the error handling so we don't need to.
- Adds back the automatic saving of the current track's position and playing queue in localStorage. It's fully unit tested.
- Adds back the notifications. Every time we change songs (if the setting is true), it displays a notification. Clicking on it goes to the next song, just like before.
- Bumps up the versions to the actual value on the various json files.
2015-01-17 19:13:43 +01:00
Hyzual
834e67946c Adds back scrobbling and loading a track and the queue from localStorage.
- Splits loadTrackPosition into two functions : one for the track (which isn't finished), one for the queue.
- Adds main-controller.js' first unit tests for both these functions.
- Adds scrobbling functionnality. It is now a part of the Subsonic service, since we it's Subsonic that ultimately does the scroblling.
- Adds unit tests for both the service and the directive. The test for updatetime was crazy hard to do because I had to find a way to trigger my own fake event and it wasn't permitted by jplayer.
- Adds the load function to the player, it is used only when loading a song from localStorage.
- Removes ng-click from play/pause in the player template. jPlayer adds its own handlers on them, no need to do it twice.
2015-01-17 19:13:42 +01:00
Hyzual
7074e9abc8 Adds more methods to control the queue in the player service.
- Adds : empty queue, shuffle queue, add one song to queue, remove one song from queue, restart the current song
- Removes the "playEnded" method : we now use correctly scope.$apply() in the directive after calling nextTrack(). The next song is correctly called after the end of the current one.
- Starts replacing the old rootScope functions with calls to the player service.
2015-01-17 19:13:42 +01:00
Hyzual
19661f463b Fixes the communication between the player directive and the player service
- Adds a "playEnded()" function specifically for jplayer to call when the currently playing song ends. It uses $rootScope.$apply() to notify the directive that the song has changed.
- Shows the player controls' css.
- Marks the tests relating the "playing" status of the song as pending.
- Further uses the Player service in the subsonic view
2015-01-17 19:13:41 +01:00
Hyzual
88b1e6a6e6 Rewrites the entire player component.
Not finished ! This is still work in progress and fairly broken in this commit.
The jquery jplayer is now wrapped in an angular directive.
The queue is no longer being managed in rootScope but is a part of the player service. It can be accessed like before and emptied / filled.
The player controller also uses the player service now.
2015-01-17 19:13:40 +01:00
Hyzual
e51961c167 Starts rewriting the player service.
The API is simplified: we can play a song, restart the currently playing song, load a song (that'll be used only by local storage), play the next track or the previous track.

As a result, I changed all the calls to playSong(false, song) which are now just play(song)
2015-01-17 19:13:40 +01:00
Hyzual
226a768987 Renamed all controlles from 'Ctrl' to 'Controller' to better follow angular best practices. 2015-01-17 19:13:40 +01:00
Hyzual
e5846e30f9 Removes the player functions from the rootScope.
However, saving track's position is broken.
Some are still there because of problems I don't know how to solve, e.g. circular dependency between notifications and player.
Uses the queue controller for the sidebar queue.
Moves loadTrackPosition to the main controller.
2015-01-17 19:12:56 +01:00
Trevor Squillario
1b526970b3 4.3.3 ApiVersion workaround, stopped working with jsonp 2015-01-05 19:24:59 -05:00
brb
a91e220608 Don't show queue on change if ShowQueue is off 2014-12-29 21:24:47 +01:00
Trevor Squillario
dea8b9ffd9 5.3 release 2014-12-20 17:18:56 -05:00
Trevor Squillario
f8ef2ba227 notifications fix 2014-12-08 20:48:12 -05:00
Trevor Squillario
fa551f270d more mobile ui tweaks 2014-12-07 18:43:31 -05:00
Trevor Squillario
e3fc948a77 lots of nothing 2014-12-06 20:26:19 -05:00
Trevor Squillario
a0e8775b12 responsive layout design changes 2014-11-23 16:13:38 -05:00
Trevor Squillario
acf49e112e started mobile improvements 2014-11-22 20:28:12 -05:00
Trevor Squillario
1259075797 Merge remote-tracking branch 'brb-at/sidebar' into release-4.2.4
Conflicts:
	app/common/main-controller.js
2014-11-21 19:21:26 -05:00
Trevor Squillario
b2199429f5 4.2.3 cover art preview refactoring 2014-11-21 18:30:50 -05:00
brb
576f9778cb Remove the fade, reduce queue margin by the 1x of the border style 2014-11-21 23:39:22 +01:00
brb
46110287b3 Fixed bug of content not expanding on page load 2014-11-21 23:38:33 +01:00
brb
05ec31b624 Enable SideBar toggle and add setting to hide it per default 2014-11-21 23:38:06 +01:00
Hyzual
1fecae2f09 Removes jquery.layout files, apparently they aren't use anywhere. 2014-11-15 13:48:02 +01:00
Hyzual
b49830adbe Separates the Archive controller and service into their own modules.
Moves $scope.getMusicFolders to the Subsonic controller since its only used by it. It also made the tests crash :p

Adds variable declarations where they were missing. It causes an error with "use strict".
2014-11-09 18:39:03 +01:00
Hyzual
1fb70ea5ec Adds the first working grunt build aimed for deployment on production.
TL;DR : everything but CSS is minified and packed in a neat dist/ directory.

This build :
- Merges all vendor dependencies (jquery, angular, etc) into one minified file.
- Merges the non-bower vendor dependencies (UnityShim, jquery-split-pane, etc). into one minified file.
- Merges all our javascript into one minified file.
- Copies all the needed CSS (couldn't minify and rename it because of dependencies in the JS).
- Renames all the images, the minified javascripts (but not the CSS) in order to avoid browser caching.
- Minifies all our html files.

Adds usemin commentaries (the ones with build) to index.html. Don't remove them or the build will break.

Renames the json files to .json so the build can find them and copy them.

Corrects all the angular-injectable functions to use the long form (with the array) in order to be minified. The build should also do that now with ng-Annotate but since I did it when debugging problems with the build, might as well keep it.

Note: the grunt test target is broken. Haven't figured out why yet.

Conflicts:
	app/app.js
	app/common/directives.js
	app/index.html
	app/settings/settings.js
2014-11-09 18:39:02 +01:00
Hyzual
a1d48bbd30 Reorganizes the entire app to follow Google's best practice recommendations for Angular App Structure.
see: https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub

The files are now grouped by view / component.
Tests are located beside tested js files. The Grunt build will be responsible for only distributing actual files without the tests.
Each partial is at the same level as the js files related to it.
Ideally css files should be at the same level, maybe I'll refactor this later.

Moves all non-bower plugins to app/vendor.
Moves all images to app/images and styles to app/styles.
Merges the test and non-test jshintrc files.

Adds all the Jamstash contributors to the package.json file while I was refactoring.

Conflicts:
	app/app.js
	app/images/vgrabber.gif
	app/images/vgrabber2-active.gif
	app/images/vgrabber2-normal.gif
	app/index.html
2014-11-09 16:10:34 +01:00
Renamed from js/controllers/main.js (Browse further)