From 6389f5010af929d3140172ec4a067d77235c781b Mon Sep 17 00:00:00 2001 From: Jackson Chen Date: Tue, 27 Aug 2013 23:59:20 -0600 Subject: [PATCH 1/2] Initial commit to solve issue 149 --- emperor/support_files/emperor/js/emperor.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/emperor/support_files/emperor/js/emperor.js b/emperor/support_files/emperor/js/emperor.js index 40196be0..bfda95fb 100644 --- a/emperor/support_files/emperor/js/emperor.js +++ b/emperor/support_files/emperor/js/emperor.js @@ -997,6 +997,13 @@ function toScreenXY( position, camera, jqdiv ) { y: (-screenPosition.y+1)*jqdiv.height()/2 + jqdiv.offset().top}; } +// This function stops refreshing the page after pressing the enter key in filterkey() +function stopRKey(evt) { + var evt = (evt) ? evt : ((event) ? event : null); + var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); + if ((evt.keyCode == 13) && (node.type=="text")) {return false;} +} + /*This function is used to filter the key to a user's provided search string*/ function filterKey() { var searchVal = document.keyFilter.filterBox.value.toLowerCase(); @@ -2003,6 +2010,8 @@ $(document).ready(function() { event.preventDefault(); }); + document.keyFilter.filterBox.onkeypress = stopRKey; + init(); animate(); @@ -2277,5 +2286,4 @@ $(document).ready(function() { g_mainRenderer.render( g_mainScene, g_sceneCamera); } - -}); +}); \ No newline at end of file From 986c54369be0f12590f52dd326f523e2c20324b3 Mon Sep 17 00:00:00 2001 From: Jackson Chen Date: Wed, 28 Aug 2013 21:41:05 -0600 Subject: [PATCH 2/2] Fixes #149 --- emperor/format.py | 2 +- emperor/support_files/emperor/js/emperor.js | 16 +++++++--------- tests/test_format.py | 10 +++++----- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/emperor/format.py b/emperor/format.py index c913aef9..35cccd1f 100755 --- a/emperor/format.py +++ b/emperor/format.py @@ -538,7 +538,7 @@ def format_emperor_html_footer_string(has_biplots=False, has_ellipses=False,
- +
diff --git a/emperor/support_files/emperor/js/emperor.js b/emperor/support_files/emperor/js/emperor.js index bfda95fb..a70aa8fc 100644 --- a/emperor/support_files/emperor/js/emperor.js +++ b/emperor/support_files/emperor/js/emperor.js @@ -997,13 +997,6 @@ function toScreenXY( position, camera, jqdiv ) { y: (-screenPosition.y+1)*jqdiv.height()/2 + jqdiv.offset().top}; } -// This function stops refreshing the page after pressing the enter key in filterkey() -function stopRKey(evt) { - var evt = (evt) ? evt : ((event) ? event : null); - var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null); - if ((evt.keyCode == 13) && (node.type=="text")) {return false;} -} - /*This function is used to filter the key to a user's provided search string*/ function filterKey() { var searchVal = document.keyFilter.filterBox.value.toLowerCase(); @@ -2009,8 +2002,13 @@ $(document).ready(function() { if (g_validAsciiCodes.indexOf(code)==-1) event.preventDefault(); }); - - document.keyFilter.filterBox.onkeypress = stopRKey; + + // Disables the enter key in the search bar + $('#searchBox').keypress(function(event) { + if (event.keyCode == 13) { + event.preventDefault(); + } + }); init(); animate(); diff --git a/tests/test_format.py b/tests/test_format.py index ef20d44f..888d8da2 100755 --- a/tests/test_format.py +++ b/tests/test_format.py @@ -493,7 +493,7 @@ def test_format_emperor_html_footer_string(self):
- +
@@ -656,7 +656,7 @@ def test_format_emperor_html_footer_string(self):
- +
@@ -830,7 +830,7 @@ def test_format_emperor_html_footer_string(self):
- +
@@ -988,7 +988,7 @@ def test_format_emperor_html_footer_string(self):
- +
@@ -1150,7 +1150,7 @@ def test_format_emperor_html_footer_string(self):
- +