summaryrefslogtreecommitdiff
path: root/src/scaladoc/scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-03-14 19:28:41 +0100
committerFelix Mulder <felix.mulder@gmail.com>2016-03-14 19:35:21 +0100
commitc2781f5a1d81a3362035bde4d0d5d6f320a7bd16 (patch)
treea37b1fd5008f591a726ac4a70bc3be1369acde57 /src/scaladoc/scala
parent66588a78f22aa3595df9938449268e432f27e3ff (diff)
downloadscala-c2781f5a1d81a3362035bde4d0d5d6f320a7bd16.tar.gz
scala-c2781f5a1d81a3362035bde4d0d5d6f320a7bd16.tar.bz2
scala-c2781f5a1d81a3362035bde4d0d5d6f320a7bd16.zip
Change behavior of clear-button on input fields
This commit changes the behavior to only remove the "x" if there is no input in the input field. The old behavior was to bind the blur event to be fired later - but this had the drawback of not working properly on fast hardware as the timeout would actually beat the click event.
Diffstat (limited to 'src/scaladoc/scala')
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js13
-rw-r--r--src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js19
2 files changed, 13 insertions, 19 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js
index 494ad91cc8..55224eae52 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js
+++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js
@@ -33,14 +33,11 @@ $(document).ready(function() {
configureTextFilter();
- $("#index-input").on("focus", function(e) {
- $("#textfilter > .input > .clear").show();
- });
-
- $("#index-input").on("blur", function() {
- setTimeout(function() {
+ $("#index-input").on("input", function(e) {
+ if($(this).val().length > 0)
+ $("#textfilter > .input > .clear").show();
+ else
$("#textfilter > .input > .clear").hide();
- }, 10);
});
});
@@ -229,6 +226,8 @@ function configureTextFilter() {
$("div#search-results").hide();
$("#search > span.close-results").hide();
$("#search > span#doc-title").show();
+
+ $(this).hide();
});
});
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js
index ae39f83852..5f42dfa114 100644
--- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js
+++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js
@@ -147,10 +147,10 @@ $(document).ready(function() {
});
$("#memberfilter > .clear").click(function() {
$("#memberfilter input").attr("value", "");
+ $(this).hide();
filter();
});
$(document).keydown(function(event) {
-
if (event.keyCode == 9) { // tab
$("#index-input", window.parent.document).focus();
input.attr("value", "");
@@ -162,8 +162,7 @@ $(document).ready(function() {
if ($(this).hasClass("in")) {
$(this).removeClass("in");
$(this).addClass("out");
- }
- else if ($(this).hasClass("out")) {
+ } else if ($(this).hasClass("out")) {
$(this).removeClass("out");
$(this).addClass("in");
}
@@ -174,8 +173,7 @@ $(document).ready(function() {
if ($(this).hasClass("in")) {
$(this).removeClass("in");
$(this).addClass("out");
- }
- else if ($(this).hasClass("out")) {
+ } else if ($(this).hasClass("out")) {
$(this).removeClass("out");
$(this).addClass("in");
}
@@ -307,14 +305,11 @@ $(document).ready(function() {
exposeMember(jqElem);
}
- $("#mbrsel-input").on("focus", function() {
- $("#memberfilter > .clear").show();
- });
-
- $("#mbrsel-input").on("blur", function() {
- setTimeout(function() {
+ $("#mbrsel-input").on("input", function() {
+ if ($(this).val().length > 0)
+ $("#memberfilter > .clear").show();
+ else
$("#memberfilter > .clear").hide();
- }, 10);
});
});