summaryrefslogtreecommitdiff
path: root/share/www/script/futon.js
diff options
context:
space:
mode:
authorChristopher Lenz <cmlenz@apache.org>2009-07-21 21:06:00 +0000
committerChristopher Lenz <cmlenz@apache.org>2009-07-21 21:06:00 +0000
commitf2a91f36366d270b59d208712e59cf32533006be (patch)
tree703b3c29bf79b646bf89b316fa2525cac68336c3 /share/www/script/futon.js
parentfaa5479e472356770a8cda116defd002d88b20d6 (diff)
Make the view-selection and jump-to-document widgets at the top of the Futon database page a bit more compact.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@796535 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script/futon.js')
-rw-r--r--share/www/script/futon.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/share/www/script/futon.js b/share/www/script/futon.js
index 77bd8cc8..bdfbe93a 100644
--- a/share/www/script/futon.js
+++ b/share/www/script/futon.js
@@ -107,6 +107,33 @@
navigation: new Navigation()
});
+ $.fn.addPlaceholder = function(text) {
+ return this.each(function() {
+ var input = $(this);
+ if ($.browser.safari) {
+ input.attr("placeholder", text);
+ return;
+ }
+ input.blur(function() {
+ if ($.trim(input.val()) == "") {
+ input.addClass("placeholder").val(text);
+ } else {
+ input.removeClass("placeholder");
+ }
+ }).triggerHandler("blur")
+ input.focus(function() {
+ if (input.is(".placeholder")) {
+ input.val("").removeClass("placeholder");
+ }
+ });
+ $(this.form).submit(function() {
+ if (input.is(".placeholder")) {
+ input.val("");
+ }
+ });
+ });
+ }
+
$(document)
.ajaxStart(function() { $(this.body).addClass("loading"); })
.ajaxStop(function() { $(this.body).removeClass("loading"); });