From 7a32e9c7e82a884d58ec2774d0148e5075a4791c Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 29 Feb 2012 03:44:16 -0500
Subject: [PATCH] Decorate search filter drop-down with a more Larry like style

---
 skins/larry/ui.js |   38 ++++++++++++++++++++++++++++++--------
 1 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/skins/larry/ui.js b/skins/larry/ui.js
index aed41bb..5e12186 100644
--- a/skins/larry/ui.js
+++ b/skins/larry/ui.js
@@ -173,15 +173,37 @@
     // turn a group of fieldsets into tabs
     $('.tabbed').each(function(idx, elem){ init_tabs(elem); })
 
-    $(document.body).bind('mouseup', body_mouseup)
-    .bind('keyup', function(e){
-      if (e.keyCode == 27) {
-        for (var id in popups) {
-          if (popups[id].is(':visible'))
-            show_popup(id, false);
+    // decorate select elements
+    if (!bw.opera) {
+      $('select.decorated').each(function(){
+        var title = $('option', this).first().text();
+        if ($('option:selected', this).val() != '')
+          title = $('option:selected', this).text();
+        var select = $(this)
+          .change(function(){
+            var val = $('option:selected', this).text();
+            $(this).next().children().html(val);
+          });
+
+        $('<a class="menuselector dropdownselector"><span class="handle">' + title + '</span></a>')
+          .offset(select.position())
+          .insertAfter(select)
+          .children().width(select.width() - 5);
+
+        select.parent().css('position', 'relative');
+      });
+    }
+
+    $(document.body)
+      .bind('mouseup', body_mouseup)
+      .bind('keyup', function(e){
+        if (e.keyCode == 27) {
+          for (var id in popups) {
+            if (popups[id].is(':visible'))
+              show_popup(id, false);
+          }
         }
-      }
-    });
+      });
 
     $('iframe').load(function(e){
       // this = iframe

--
Gitblit v1.9.1