From b8d4febf6c792a35b6603f510013be864aa5ef64 Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Wed, 30 Jun 2010 07:17:51 -0400
Subject: [PATCH] - googiespell layer resizing + small css improvements - better googiespell suggestions popup positioning

---
 skins/default/mail.css        |    3 +--
 skins/default/googiespell.css |    6 +++---
 program/js/googiespell.js     |   28 +++++++++++++++++-----------
 skins/default/functions.js    |    3 +++
 4 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/program/js/googiespell.js b/program/js/googiespell.js
index a9879f3..27658a4 100644
--- a/program/js/googiespell.js
+++ b/program/js/googiespell.js
@@ -111,9 +111,8 @@
 
         this.checkSpellingState();
     }
-    else 
-        if (this.report_ta_not_found)
-            alert('Text area not found');
+    else if (this.report_ta_not_found)
+        alert('Text area not found');
 };
 
 //////
@@ -393,11 +392,7 @@
         table = document.createElement('table'),
         list = document.createElement('tbody');
 
-    pos.top -= this.edit_layer.scrollTop;
-
-    $(this.error_window).css({'visibility': 'visible',
-	'top': (pos.top+20)+'px', 'left': (pos.left)+'px'}).html('');
-
+    $(this.error_window).html('');
     $(table).addClass('googie_list').attr('googie_action_btn', '1');
 
     // Check if we should use custom menu builder, if not we use the default
@@ -541,6 +536,16 @@
     table.appendChild(list);
     this.error_window.appendChild(table);
 
+    // calculate and set position
+    var height = $(this.error_window).height(),
+        width = $(this.error_window).width(),
+        pageheight = $(document).height(),
+        pagewidth = $(document).width(),
+        top = pos.top + height + 20 < pageheight ? pos.top + 20 : pos.top - height,
+        left = pos.left + width < pagewidth ? pos.left : pos.left - width;
+
+    $(this.error_window).css({'visibility': 'visible', 'top': top+'px', 'left': left+'px'});
+
     // Dummy for IE - dropdown bug fix
     if ($.browser.msie) {
 	    if (!this.error_window_iframe) {
@@ -561,7 +566,8 @@
 //////
 this.createEditLayer = function(width, height) {
     this.edit_layer = document.createElement('div');
-    $(this.edit_layer).addClass('googie_edit_layer').width(width-10).height(height);
+    $(this.edit_layer).addClass('googie_edit_layer').attr('id', 'googie_edit_layer')
+        .width(width).height(height);
 
     if (this.text_area.nodeName.toLowerCase() != 'input' || $(this.text_area).val() == '') {
         $(this.edit_layer).css('overflow', 'auto').height(height-4);
@@ -621,7 +627,7 @@
         };
 
     $(elm).html(text).addClass('googie_link').bind('click', d)
-	.attr({'googie_action_btn' : '1', 'g_id' : id, 'is_corrected' : false});
+	    .attr({'googie_action_btn' : '1', 'g_id' : id, 'is_corrected' : false});
 
     return elm;
 };
@@ -702,7 +708,7 @@
 this.createLangWindow = function() {
     this.language_window = document.createElement('div');
     $(this.language_window).addClass('googie_window')
-	.width(100).attr('googie_action_btn', '1');
+	    .width(100).attr('googie_action_btn', '1');
 
     // Build up the result list
     var table = document.createElement('table'),
diff --git a/skins/default/functions.js b/skins/default/functions.js
index 258742e..877d152 100644
--- a/skins/default/functions.js
+++ b/skins/default/functions.js
@@ -344,6 +344,9 @@
     $('#compose-body_tbl').width((w+4)+'px').height('');
     $('#compose-body_ifr').width((w+2)+'px').height((h-54)+'px');
   }
+  else {
+    $('#googie_edit_layer').width(w-(bw.ie || bw.opera || bw.safari ? 2 : 0)+'px').height(h+'px');
+  }
 },
 
 show_header_form: function(id)
diff --git a/skins/default/googiespell.css b/skins/default/googiespell.css
index f5f7e3b..c48ff5a 100644
--- a/skins/default/googiespell.css
+++ b/skins/default/googiespell.css
@@ -13,10 +13,8 @@
 }
 
 .googie_edit_layer {
-  border: 1px solid #666666;
   background-color: #ffffff;
-  padding: 1px 4px;
-  margin: 1px 0px;
+  padding: 0 4px;
   font-size: 9pt;
   font-family: monospace;
 }
@@ -75,6 +73,8 @@
   color: #b91414;
   text-decoration: underline;
   cursor: pointer;
+  font-size: 9pt;
+  font-family: monospace;
 }
 
 .googie_check_spelling_link {  
diff --git a/skins/default/mail.css b/skins/default/mail.css
index f78d982..dfaf453 100644
--- a/skins/default/mail.css
+++ b/skins/default/mail.css
@@ -137,8 +137,7 @@
   background-position: -416px -32px;
 }
 
-#messagetoolbar select,
-#compose-container select
+#messagetoolbar select
 {
   font-size: 11px;
 }

--
Gitblit v1.9.1