couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cml...@apache.org
Subject svn commit: r900989 - in /couchdb/trunk/share/www: database.html script/futon.js style/layout.css
Date Tue, 19 Jan 2010 22:37:41 GMT
Author: cmlenz
Date: Tue Jan 19 22:37:41 2010
New Revision: 900989

URL: http://svn.apache.org/viewvc?rev=900989&view=rev
Log:
Futon: Simplify placeholder fallback using jQuery live focus events.

Modified:
    couchdb/trunk/share/www/database.html
    couchdb/trunk/share/www/script/futon.js
    couchdb/trunk/share/www/style/layout.css

Modified: couchdb/trunk/share/www/database.html
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/database.html?rev=900989&r1=900988&r2=900989&view=diff
==============================================================================
--- couchdb/trunk/share/www/database.html [utf-8] (original)
+++ couchdb/trunk/share/www/database.html [utf-8] Tue Jan 19 22:37:41 2010
@@ -120,7 +120,7 @@
         $("#toolbar button.delete").click(page.deleteDatabase);
         $("#toolbar button.compactview").click(page.compactView);
 
-        $('#jumpto input').addPlaceholder("Document ID").suggest(function(text, callback)
{
+        $('#jumpto input').suggest(function(text, callback) {
           page.db.allDocs({
             limit: 10, startkey: text, endkey: text + 'zzz',
             success: function(docs) {
@@ -158,7 +158,7 @@
       </div>
       <div id="jumpto">
         <label>Jump to:
-          <input type="text" name="docid" autocomplete="off" />
+          <input type="text" name="docid" placeholder="Document ID" autocomplete="off"
/>
         </label>
       </div>
       <ul id="toolbar">

Modified: couchdb/trunk/share/www/script/futon.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/futon.js?rev=900989&r1=900988&r2=900989&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/futon.js (original)
+++ couchdb/trunk/share/www/script/futon.js Tue Jan 19 22:37:41 2010
@@ -362,31 +362,21 @@
     storage: new Storage()
   });
 
-  $.fn.addPlaceholder = function(text) {
-    return this.each(function() {
+  $.fn.addPlaceholder = function() {
+    if (this[0] && "placeholder" in document.createElement("input")) {
+      return; // found native placeholder support
+    }
+    return this.live('focusin', function() {
       var input = $(this);
-      if ($.browser.safari) {
-        input.attr("placeholder", text);
-        return;
+      if (input.val() === input.attr("placeholder")) {
+        input.removeClass("placeholder").val("");
       }
-      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("");
-        }
-      });
-    });
+    }).live("focusout", function() {
+      var input = $(this);
+      if (input.val() === "") {
+        input.val(input.attr("placeholder")).addClass("placeholder");
+      }
+    }).trigger("focusout");
   }
 
   $.fn.enableTabInsertion = function(chars) {
@@ -422,6 +412,8 @@
       // doing this as early as possible prevents flickering
       $(document.body).addClass("fullwidth");
     }
+    $("input[placeholder]").addPlaceholder();
+
     $.get("_sidebar.html", function(resp) {
       $("#wrap").append(resp)
         .find("#sidebar-toggle").click(function(e) {
@@ -443,7 +435,6 @@
           $("#version").text(info.version);
         }
       });
-      
     });
   });
 

Modified: couchdb/trunk/share/www/style/layout.css
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/style/layout.css?rev=900989&r1=900988&r2=900989&view=diff
==============================================================================
--- couchdb/trunk/share/www/style/layout.css (original)
+++ couchdb/trunk/share/www/style/layout.css Tue Jan 19 22:37:41 2010
@@ -219,8 +219,8 @@
   height: 100%; margin-right: 210px; position: relative;
 }
 body.fullwidth #wrap { margin-right: 0; }
-#content { padding: 1em 16px 3em 10px; overflow: auto; position: absolute;
-  top: 33px; bottom: 0; left: 0; right: 0;
+#content { padding: 1em 16px 3em 10px; overflow: auto; overflow-y: scroll;
+  position: absolute; top: 33px; bottom: 0; left: 0; right: 0;
 }
 
 /* Toolbar */
@@ -260,18 +260,18 @@
   -webkit-box-shadow: 4px 4px 6px #333;
 }
 *html #dialog { width: 33em; }
-body.loading #dialog h2 {
-  background: url(../image/spinner.gif) center no-repeat;
-}
 #dialog.loading { width: 220px; height: 80px; }
 #dialog.loaded { background-image: none; }
-#dialog h2 { background: #666; border-top: 1px solid #555;
-  border-bottom: 1px solid #777; color: #ccc; font-size: 110%;
-  font-weight: bold; margin: 0 -2em; padding: .35em 2em;
+#dialog h2 { background: #666 right center no-repeat;
+  border-top: 1px solid #555; border-bottom: 1px solid #777; color: #ccc;
+  font-size: 110%; font-weight: bold; margin: 0 -2em; padding: .35em 2em;
+}
+body.loading #dialog h2 {
+  background-image: url(../image/spinner.gif);
 }
 #dialog h3 {
-      color: #ccc; font-size: 110%;
-      font-weight: bold; margin: 0 -2em; padding: .35em 2em;
+  color: #ccc; font-size: 110%; font-weight: bold; margin: 0 -2em;
+  padding: .35em 2em;
 }
 #dialog fieldset { background: #222; border-top: 1px solid #111;
   margin: 0 0 1em; padding: .5em 1em 1em;
@@ -351,8 +351,8 @@
   white-space: nowrap;
 }
 #viewcode .code textarea { border: none; border-top: 1px solid #ccc;
-  color: #333; font-size: 11px; margin: 0; min-height: 50px; padding: .4em 0 0;
-  resize: none; width: 100%; overflow: auto;
+  color: #333; font-size: 11px; margin: 0; min-height: 50px; overflow: auto;
+  padding: .4em 0 0; resize: none; width: 100%;
 }
 #viewcode .code textarea:focus { background: #e9f4ff; }
 #viewcode .bottom { border-bottom: none; clear: left; padding: 1px 3px; }



Mime
View raw message