From 0eec182c1ea16e808184c88502118acb7f86e6e9 Mon Sep 17 00:00:00 2001
From: Felipe Fidelix <eu@felipefidelix.com>
Date: Fri, 17 Feb 2012 20:08:09 -0300
Subject: [PATCH] Whitespace fixes, allows ALT and Title fields to be used
 without breaking CSS. Added placeholder attribute to the
 inputs

---
 plup.css |   29 +++++++++++++++++------------
 plup.js  |   12 ++++++++----
 2 files changed, 25 insertions(+), 16 deletions(-)

diff --git a/plup.css b/plup.css
index 747f78e..7c6c52b 100644
--- a/plup.css
+++ b/plup.css
@@ -1,6 +1,5 @@
 #plup-list {
 height: auto;
-min-height: 120px;
 }
 
 #plup-list {
@@ -11,18 +10,17 @@ background-color: #f7f7f7;
 
 #plup-list li {
 margin: 3px 3px 3px 0;
-padding: 1px;
+padding: 3px;
 float: left;
-width: 100px;
-height: 135px;
 font-size: 8pt;
 list-style: none;
+position: relative;
+line-height: 0;
 }
 
 .plup-thumb-wrapper {
-width: 100px;
-height: 100px;
 cursor: move;
+line-height:0;
 }
 
 #plup-list li input.form-checkbox {
@@ -32,10 +30,16 @@ top: -100px;
 }
 
 #plup-list li input.form-text {
-width: 90px;
+width: 90%;
 height: 12px;
-top: -25px;
-position: relative;
+top: 8px;
+position: absolute;
+margin: 0 0 0 4px;
+display:none;
+}
+
+#plup-list li input.form-text.alt {
+top: 28px;
 }
 
 #plup-bar {
@@ -114,9 +118,9 @@ float: right;
 
 .plup-remove-item {
 opacity: 0.5;
-position: relative;
-right: 5px;
-top: -100px;
+position: absolute;
+right: 3px;
+top: 3px;
 }
 
 .plup-remove-item:hover {
@@ -133,6 +137,7 @@ overflow: auto;
 
 #plup-filelist table {
 margin: 0px;
+border: 1px solid #999;
 }
 
 #plup-filelist table tbody {
diff --git a/plup.js b/plup.js
index 2d30126..cbfed70 100644
--- a/plup.js
+++ b/plup.js
@@ -15,8 +15,12 @@
     $(selector).bind('focus', function(event) {
       $(this).css('z-index', '10').animate({'width': '300px', 'height': '15px'}, 300);
     });
-    $(selector).bind('blur', function(event) {
-      $(this).removeAttr('style');
+    $(selector).parent().bind("mouseenter focus", function(event) {
+      $(selector).fadeIn(200);
+    });
+    $(selector).parent().bind("mouseleave", function(event) {
+      $(selector).removeAttr('style');
+      $(selector).fadeOut(200);
     });
   }
 
@@ -119,8 +123,8 @@
           }
 
           $('#plup-filelist #' + file.id).remove(); // Remove uploaded file from queue
-          var title_field = Drupal.settings.plup.title_field ? '<input title="'+ Drupal.t('Title') +'" type="text" class="form-text" name="'+ name + '[title]" value="" />' : '';
-          var alt_field = Drupal.settings.plup.alt_field ? '<input title="'+ Drupal.t('Alternative text') +'" type="text" class="form-text" name="'+ name + '[alt]" value="" />' : '';
+          var title_field = Drupal.settings.plup.title_field ? '<input title="'+ Drupal.t('Title') +'" type="text" class="form-text title" placeholder="'+ Drupal.t('Title') +'" name="'+ name + '[title]" value="" />' : '';
+          var alt_field = Drupal.settings.plup.alt_field ? '<input title="'+ Drupal.t('Alternative text') +'" type="text" class="form-text alt" placeholder="'+ Drupal.t('Alternative text') +'" name="'+ name + '[alt]" value="" />' : '';
           // Add image thumbnail into list of uploaded items
           $('#plup-list').append(
             '<li class="ui-state-default">' +
-- 
1.7.5.4

