Simon Hunt

GUI: clean up coding style.

Change-Id: I1dcb036a12896bab88dfe2752c098fe5e8dfc009
...@@ -21,7 +21,11 @@ ...@@ -21,7 +21,11 @@
21 'use strict'; 21 'use strict';
22 22
23 // references to injected services 23 // references to injected services
24 - var $log, fs, ts, ns, qhs; 24 + var $log, $timeout, fs, ts, ns, qhs;
25 +
26 + // constants
27 + var eeggMin = 'shiftO',
28 + eeggMax = 'shiftONOS';
25 29
26 // internal state 30 // internal state
27 var enabled = true, 31 var enabled = true,
...@@ -32,20 +36,21 @@ ...@@ -32,20 +36,21 @@
32 viewKeys: {}, 36 viewKeys: {},
33 viewFn: null, 37 viewFn: null,
34 viewGestures: [] 38 viewGestures: []
35 - }; 39 + },
40 + eegg = '';
36 41
37 - var eegg = '', eeggMax = 'shiftONOS', eeggMin = 'shiftO'; 42 + function layEgg(key) {
38 - 43 + eegg += key;
39 - function layEgg(lastKey) { 44 + if (eeggMax.indexOf(eegg) === 0) {
40 - eegg += lastKey; 45 + if (eegg === eeggMax) {
41 - if (eeggMax.indexOf(eegg) == 0) { 46 + d3.select('body').append('div').attr('id', 'eegg')
42 - if (eeggMax == eegg) { 47 + .append('img').attr('src', 'data/img/eegg.png');
43 - d3.select('body').append('div').attr('id', 'eegg').append('img').attr('src', 'data/img/eegg.png'); 48 + $timeout(function () { d3.select('#eegg').remove(); }, 3000);
44 - setTimeout(function () { d3.select('#eegg').remove(); }, 3000);
45 eegg = ''; 49 eegg = '';
46 } 50 }
47 return true; 51 return true;
48 - } else if (eeggMin != eegg) { 52 + }
53 + if (eegg !== eeggMin) {
49 eegg = ''; 54 eegg = '';
50 } 55 }
51 return false; 56 return false;
...@@ -218,10 +223,11 @@ ...@@ -218,10 +223,11 @@
218 223
219 angular.module('onosUtil') 224 angular.module('onosUtil')
220 .factory('KeyService', 225 .factory('KeyService',
221 - ['$log', 'FnService', 'ThemeService', 'NavService', 226 + ['$log', '$timeout', 'FnService', 'ThemeService', 'NavService',
222 227
223 - function (_$log_, _fs_, _ts_, _ns_) { 228 + function (_$log_, _$timeout_, _fs_, _ts_, _ns_) {
224 $log = _$log_; 229 $log = _$log_;
230 + $timeout = _$timeout_;
225 fs = _fs_; 231 fs = _fs_;
226 ts = _ts_; 232 ts = _ts_;
227 ns = _ns_; 233 ns = _ns_;
......
...@@ -67,6 +67,6 @@ body.dark { ...@@ -67,6 +67,6 @@ body.dark {
67 transform: translate(-50%, -50%); 67 transform: translate(-50%, -50%);
68 box-shadow: 2px 2px 24px 5px #888; 68 box-shadow: 2px 2px 24px 5px #888;
69 background-color: #eee; 69 background-color: #eee;
70 - margin: 0px; 70 + margin: 0;
71 padding: 10px; 71 padding: 10px;
72 } 72 }
......