Skip to content
Merged
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
7 changes: 4 additions & 3 deletions javascript/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@ EXTRA_DIST += \
javascript/new-src/src/controllers/setting_universe.js \
javascript/new-src/src/controllers/header.js \
javascript/new-src/src/controllers/overview.js \
javascript/new-src/src/constants.js \
javascript/new-src/src/img/ola-favicon.png \
javascript/new-src/src/directives/autofocus.js \

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You'll need to change start_from to form here too.

Can we fix the sorting please, by folder then file; so move factories and filters up (and above img).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I pushed the moment you commented. Wait for another commit ;)

javascript/new-src/src/factories/ola.js \
javascript/new-src/src/filters/start_from.js \
javascript/new-src/src/img/ola-favicon.png \
javascript/new-src/src/constants.js \
javascript/new-src/src/app.js \
javascript/new-src/src/filters/start_form.js \
javascript/ola/base_frame.js \
javascript/ola/common/dmx_constants.js \
javascript/ola/common/dmx_monitor.js \
Expand Down
3 changes: 2 additions & 1 deletion javascript/new-src/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ var targets = {
'src/controllers/header.js',
'src/controllers/overview.js',
'src/constants.js',
'src/directives/autofocus.js',
'src/factories/ola.js',
'src/filters/start_form.js'
'src/filters/start_from.js'
],
css: [
'css/style.css'
Expand Down
50 changes: 50 additions & 0 deletions javascript/new-src/src/controllers/keypad_universe.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,57 @@ ola.controller('keypadUniverseCtrl',
} else if (check.regexGroups(fields)) {
$scope.field = fields[0];
}
$scope.focusInput = true;
};

$scope.keypress = function($event) {
var key = $event.key;

// don't handle keyboard shortcuts and function keys
if ($event.altKey || $event.ctrlKey || $event.metaKey ||
($event.which === 0 && key !== 'Enter' && key !== 'Backspace')) {
// $event.which is 0 for non-printable keys (like the F1 - F12 keys)
return;
}

$event.preventDefault();

switch (key) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
$scope.input(key);
break;
case '@':
case 'a':
$scope.input(' @ ');
break;
case '>':
case 't':
$scope.input(' THRU ');
break;
case 'f':
$scope.input('FULL');
break;
case 'Backspace':
$scope.input('backspace');
break;
case 'Enter':
$scope.submit();
break;
}
};

$scope.submit = function() {
$scope.focusInput = true;

var dmx = [];
var input = $scope.field;
var result = regexkeypad.exec(input);
Expand Down Expand Up @@ -114,5 +162,7 @@ ola.controller('keypadUniverseCtrl',
return false;
}
};

$scope.focusInput = true;
}
]);
41 changes: 41 additions & 0 deletions javascript/new-src/src/directives/autofocus.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Allows an element to obtain focus whenever a variable is set to true.
* Copyright (C) 2016 Florian Edelmann
*/
/*jshint browser: true, jquery: true*/
/* global ola */
ola.directive('autofocus', ['$timeout', '$parse',
function($timeout, $parse) {
'use strict';
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
var model = $parse($attrs.autofocus);
$scope.$watch(model, function(value) {
if (value === true) {
$timeout(function() {
$element[0].focus();
});
}
});
$element.bind('blur', function() {
$scope.$apply(model.assign($scope, false));
});
}
};
}
]);
80 changes: 80 additions & 0 deletions olad/www/new/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,9 +310,63 @@ ola.controller('keypadUniverseCtrl',
} else if (check.regexGroups(fields)) {
$scope.field = fields[0];
}
$scope.focusInput = true;
};

$scope.keypress = function($event) {
var key = $event.key;

// don't handle keyboard shortcuts and function keys
if ($event.altKey || $event.ctrlKey || $event.metaKey ||
($event.which == 0 && key != 'Enter' && key != 'Backspace')) {
// $event.which is 0 for non-printable keys (like the F1 - F12 keys)
return;
}

$event.preventDefault();

switch (key) {
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9': {
$scope.input(key);
break;
}
case '@':
case 'a': {
$scope.input(' @ ');
break;
}
case '>':
case 't': {
$scope.input(' THRU ');
break;
}
case 'f': {
$scope.input('FULL');
break;
}
case 'Backspace': {
$scope.input('backspace');
break;
}
case 'Enter': {
$scope.submit();
break;
}
}
};

$scope.submit = function() {
$scope.focusInput = true;

var dmx = [];
var input = $scope.field;
var result = regexkeypad.exec(input);
Expand Down Expand Up @@ -345,6 +399,8 @@ ola.controller('keypadUniverseCtrl',
return false;
}
};

$scope.focusInput = true;
}
]);

Expand Down Expand Up @@ -615,6 +671,30 @@ ola.constant('OLA', {
'MAX_CHANNEL_VALUE': 255
});

/*jshint browser: true, jquery: true*/
/* global ola */
ola.directive('autofocus', ['$timeout', '$parse',
function($timeout, $parse) {
'use strict';
return {
restrict: 'A',
link: function($scope, $element, $attrs) {
var model = $parse($attrs.autofocus);
$scope.$watch(model, function(value) {
if (value === true) {
$timeout(function() {
$element[0].focus();
});
}
});
$element.bind('blur', function() {
$scope.$apply(model.assign($scope, false));
});
}
};
}
]);

/*jshint browser: true, jquery: true*/
/* global ola */
// TODO(Dave_o): split this up further
Expand Down
2 changes: 1 addition & 1 deletion olad/www/new/js/app.min.js

Large diffs are not rendered by default.

Loading