"Fixing" GUI key handling.
Change-Id: Ia610fc787aee12f773ab8bbe85628a7c5f5bdb10
diff --git a/web/gui/src/main/webapp/app/fw/util/keys.js b/web/gui/src/main/webapp/app/fw/util/keys.js
index 5ff4f7f..d56402a 100644
--- a/web/gui/src/main/webapp/app/fw/util/keys.js
+++ b/web/gui/src/main/webapp/app/fw/util/keys.js
@@ -34,6 +34,23 @@
viewGestures: []
};
+ var eegg = '', eeggMax = 'shiftONOS', eeggMin = 'shiftO';
+
+ function layEgg(lastKey) {
+ eegg += lastKey;
+ if (eeggMax.indexOf(eegg) == 0) {
+ if (eeggMax == eegg) {
+ d3.select('body').append('div').attr('id', 'eegg').append('img').attr('src', 'data/img/eegg.png');
+ setTimeout(function () { d3.select('#eegg').remove(); }, 3000);
+ eegg = '';
+ }
+ return true;
+ } else if (eeggMin != eegg) {
+ eegg = '';
+ }
+ return false;
+ }
+
function whatKey(code) {
switch (code) {
case 13: return 'enter';
@@ -81,6 +98,8 @@
d3.event.stopPropagation();
if (enabled) {
+ if (layEgg(key)) return;
+
// global callback?
if (gcb && gcb(token, key, keyCode, event)) {
// if the event was 'handled', we are done
diff --git a/web/gui/src/main/webapp/app/onos.css b/web/gui/src/main/webapp/app/onos.css
index b42af35..3ed0dd5 100644
--- a/web/gui/src/main/webapp/app/onos.css
+++ b/web/gui/src/main/webapp/app/onos.css
@@ -58,3 +58,15 @@
.dark #view h2 {
color: #CE5650;
}
+
+#eegg {
+ position: fixed;
+ top: 50%;
+ left: 50%;
+ -webkit-transform: translate(-50%, -50%);
+ transform: translate(-50%, -50%);
+ box-shadow: 2px 2px 24px 5px #888;
+ background-color: #eee;
+ margin: 0px;
+ padding: 10px;
+}
diff --git a/web/gui/src/main/webapp/data/img/eegg.png b/web/gui/src/main/webapp/data/img/eegg.png
new file mode 100644
index 0000000..f43ce38
--- /dev/null
+++ b/web/gui/src/main/webapp/data/img/eegg.png
Binary files differ