Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding a setting that allows to remember the config in local storage (or not) #24

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var clockConfig = {
host: 'ws://localhost:13900/',
node: 'default',
seconds: 150
seconds: 150,
rememberSettings: false
}
1 change: 1 addition & 0 deletions js/ClockControlsCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ angular.module('Clock',['ngStorage'])
'$scope','$timeout','$opener','$localStorage',
function($scope,$timeout,$opener,$localStorage) {

//load settings from storage, which has been populated by now by the main controller
$scope.config = $localStorage.config;

var actions = ['arm','start','stop','mode','pause'];
Expand Down
3 changes: 3 additions & 0 deletions js/ClockCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ angular.module('Clock',['ngStorage'])
$scope.$storage = $localStorage.$default({
config: urlConfig || clockConfig
});
if (clockConfig && !clockConfig.rememberSettings) {
$scope.$storage.config = clockConfig;
}
var handlers = {};
$scope.bgColor = 'black';
$scope.state = 'stopped';
Expand Down
10 changes: 10 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,16 @@ The port can be changed in localserver.js

**Note:** currently the control panel (when pressing 'c') does not send commands. I.e. the clock in combination with mhub only listens. Using the controls will only affect the local instance of the clock (no other browser windows or running clocks).

Configuration
-----

There is a configuration file that allows you to configure the clock. It has the following fields:

- `host`: the Mhub host (see 'Usage with Mhub')
- `node`: the Mhub node (see 'Usage with Mhub')
- `seconds`: the number of seconds to count down from
- `rememberSettings`: whether to remember adjusted settings. By default, this is set to `false`. This way, when you refresh the clock, it jumps back to the defaults. If you run this clock locally, you may set this to `true`, that way, any changes in the control window are remembered.

Clock Mhub protocol
-----

Expand Down