From 2c27419e5ff0d1d064cf4d7e1417c469c82aef34 Mon Sep 17 00:00:00 2001
From: Greg Burri <greg.burri@gmail.com>
Date: Sun, 1 Jun 2008 09:33:06 +0000
Subject: [PATCH] =?utf8?q?FIX=20quelques=20modifications=20de=20comptabili?=
 =?utf8?q?t=C3=A9=20avec=20IE7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=utf8
Content-Transfer-Encoding: 8bit

---
 index.yaws         |  1 +
 js/euphorik.js     | 23 +++++++++++------------
 js/pageMinichat.js | 28 +++++++---------------------
 js/pageRegister.js |  4 ++--
 pages/about.html   |  2 +-
 5 files changed, 22 insertions(+), 36 deletions(-)

diff --git a/index.yaws b/index.yaws
index d73bc2b..f345df0 100755
--- a/index.yaws
+++ b/index.yaws
@@ -3,6 +3,7 @@
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
 <head>
+   <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>euphorik.ch</title>
    <erl>
       out(A) -> 
diff --git a/js/euphorik.js b/js/euphorik.js
index 3a9b0d7..8c0c8a2 100755
--- a/js/euphorik.js
+++ b/js/euphorik.js
@@ -252,19 +252,16 @@ Util.prototype.replaceSelection = function(input, replaceString) {
          this.setCaretToPos(input, selectionStart + replaceString.length)
    }
    else if (document.selection)
-   {
-      var range = document.selection.createRange();
+   {
+      input.focus()
+      var range = document.selection.createRange()
       if (range.parentElement() == input)
       {
          var isCollapsed = range.text == ''
          range.text = replaceString
          if (!isCollapsed)
-         {
-            // there has been a selection
-            // it appears range.select() should select the newly 
-            // inserted text but that fails with IE
+         {
             range.moveStart('character', -replaceString.length);
-            range.select();
          }
       }
    }
@@ -718,14 +715,16 @@ Client.prototype.delCookie = function()
    document.cookie = "cookie=; max-age=0"
 }
 
-Client.prototype.setCookie = function(cookie)
+Client.prototype.setCookie = function()
 {
-   if (this.cookie == null)
+   if (this.cookie == null || this.cookie == undefined)
       return
       
-   document.cookie =
-      "cookie="+this.cookie+
-      "; max-age="  + (60 * 60 * 24 * 365)
+   // ne fonctionne pas sous IE....
+   /*document.cookie = "cookie=" + this.cookie + "; max-age="  + (60 * 60 * 24 * 365) */
+   
+   document.cookie = 
+      "cookie="+this.cookie+"; expires=" + new Date(new Date().getTime() + 1000 * 60 * 60 * 24 * 365).toUTCString()
 }
 
 Client.prototype.authentifie = function()
diff --git a/js/pageMinichat.js b/js/pageMinichat.js
index 10bc999..48ab5be 100755
--- a/js/pageMinichat.js
+++ b/js/pageMinichat.js
@@ -63,6 +63,7 @@ PageMinichat.prototype.charger = function()
       this.util.outilsBan = $(
          '<span id="outilsBan">' +
          '<form action=""><p><input id="raison" name="raison" type="text" size="10" maxlength="200"></input></p></form>' +
+         '<form action=""><p><input id="raison" name="raison" type="text" size="10" maxlength="200"></input></p></form>' +
          '<img id="ban" src="img/ban.gif" alt="Ban de 3 jours" />' +
          '<img id="kick" src="img/kick.gif" alt="Ban de 15min" />' +
          '<img id="slap" src="img/slap.gif" alt="Avertissement" />' +
@@ -87,26 +88,11 @@ PageMinichat.prototype.charger = function()
          $(this).click(
             function(event)
             {
-               thisPage.util.replaceSelection($("form input.message")[0], thisPage.formateur.smiles[$(this).attr("class")][0].source.replace(/\\/g, ""))
-            }
-         )
-         .hover(
-            function()
-            {
-               $(this).animate(
-                  {
-                     opacity: 1
-                  }, 200
-               )
-            },
-            function()
-            {
-               $(this).animate(
-                  {
-                     opacity: opacityBase
-                  }, 200
-               )
+               thisPage.util.replaceSelection($("form#posterMessage input.message")[0], thisPage.formateur.smiles[$(this).attr("class")][0].source.replace(/\\/g, ""))
             }
+         ).hover(
+            function() { $(this).animate({opacity: 1}, 200) },
+            function() { $(this).animate({opacity: opacityBase}, 200) }
          )
       }
    )
@@ -807,7 +793,7 @@ Messages.prototype.ajouterMessage = function(element, numConversation)
          function(num) // insertion du lien vers la conversation
          {
                thisPage.util.replaceSelection(
-                  $("form input.message")[0],
+                  $("form#posterMessage input.message")[0],
                   "{" + thisMessages.client.conversations[num-1].root.toString(36) + "}"
                )
          }
@@ -878,7 +864,7 @@ Messages.prototype.ajusterLargeurConversations = function()
    var largeurPourcent = (100 / this.conversations.length)   
    // le "- 0.01" evite que IE se chie dessus lamentablement et affiche les conversations les unes au dessus des autres
    if($.browser["msie"])
-      largeurPourcent -= 0.01
+      largeurPourcent -= 0.05
    $("#conversations .conversation").css("width", largeurPourcent + "%")
 }
 
diff --git a/js/pageRegister.js b/js/pageRegister.js
index 83e63dd..4d107e9 100755
--- a/js/pageRegister.js
+++ b/js/pageRegister.js
@@ -32,7 +32,7 @@ PageRegister.prototype.contenu = function()
  <table>\
   <tr>\
    <td>login</td>\
-   <td><input class="login" type="text" size="20" maxlength="20"/><input class="captcha" name="captcha" type="text" size="12"></input>\</td>\
+   <td><input class="login" type="text" size="20" maxlength="20"/><input class="captcha" name="captcha" type="text" size="12"></input></td>\
   </tr>\
   <tr>\
    <td>password</td>\
@@ -47,7 +47,7 @@ PageRegister.prototype.contenu = function()
   <td><button>valider</button>\
   </tr>\
  </table>\
-<form>'
+</form>'
 }
 
 PageRegister.prototype.charger = function()
diff --git a/pages/about.html b/pages/about.html
index bb97415..dd66cd0 100644
--- a/pages/about.html
+++ b/pages/about.html
@@ -1,7 +1,7 @@
 <!-- encoding: utf-8 -->
 
 <h1>euphorik.ch</h1>
-<p>Version : 0.9</p>
+<p>Version : 0.9 (beta)</p>
 <p>Auteur : <a href="{EMAIL_LIEN}">Pifou</a></p>
 
 <h2>FAQ</h2>
-- 
2.49.0