Correction Live-client
authorRaphael Velt <raph.velt@gmail.com>
Wed, 14 Dec 2011 16:58:57 +0100
changeset 407 5ab44abc46df
parent 406 86b62b98fea7
child 408 4141c5821c98
Correction Live-client
web/client.php
web/res/css/twcx-img/bgdWriter.png
web/res/css/twcx-img/bgdWriterDisconnect.png
web/res/css/twcx-img/lefttt.png
web/res/css/tweetcast.css
web/res/js-tweetcast/live-polemic.js
web/traduction.php
--- a/web/client.php	Tue Dec 13 19:01:59 2011 +0100
+++ b/web/client.php	Wed Dec 14 16:58:57 2011 +0100
@@ -71,6 +71,13 @@
 
     <script type="text/javascript">
     l10n = { "rechercher" : "<?php echo $translate->_('Rechercher'); ?>" }
+    
+    function add_grammar(value) {
+        var _st = $('#status'),
+            _val = _st.val();
+        _st.val( _val + ( _val[_val.length - 1] == " " ? "" : " " ) + value ).change();
+    }
+    
     $(document).ready(function() {
         
         $("#accordeon li.acctitre").click(function() {
@@ -85,12 +92,6 @@
             $("#IDENTIFIER").click(function() {
                 document.location.href="<?php echo(URL_ROOT.$rep); ?>/client.php?CONNECT=true";
             });
-
-
-            function add_grammar(value) {
-                $('#status').val($('#status').val()+value+" ");
-                $('#status').change();
-            }
             
             // BUTTONS
             $(".tweetButton").click(function() {
@@ -173,6 +174,7 @@
             <div id="colgauche">
                 <div class="barre">
                     <img id="headlogo" src="<?php echo($head_logo); ?>" width="171" height="63" />
+                    <div id="minilogo"></div>
                     <ul class="menu">
                         <li>
                             <a href="<?php echo(URL_ROOT); ?>" class="menuLink">
@@ -305,6 +307,10 @@
                     <li class="acctexte">
                         <p><?php echo($translate->_('config__description')); ?></p>
                     </li>
+                    <li class="acctitre" id="suggkw_title">
+                        <h3><?php echo $translate->_('SuggestedKW'); ?></h3>
+                    </li>
+                    <li class="acctexte hidden" id="suggkw"></li>
                     <li class="acctitre">
                         <h3><?php echo $translate->_('Tagcloud'); ?></h3>
                     </li>
@@ -326,5 +332,9 @@
             <div id="hovercontent"></div>
             <div id="hoverarrow"></div>
         </div>
+        <ul id="hoverkw">
+            <li><a id="hkwsearch" href="#"><?php echo $translate->_('Rechercher'); ?></a></li>
+            <li><a id="hkwtweet" href="#"><?php echo $translate->_('addToTweet'); ?></a></li>
+        </ul>
   </body>
 </html>
\ No newline at end of file
Binary file web/res/css/twcx-img/bgdWriter.png has changed
Binary file web/res/css/twcx-img/bgdWriterDisconnect.png has changed
Binary file web/res/css/twcx-img/lefttt.png has changed
--- a/web/res/css/tweetcast.css	Tue Dec 13 19:01:59 2011 +0100
+++ b/web/res/css/tweetcast.css	Wed Dec 14 16:58:57 2011 +0100
@@ -60,7 +60,7 @@
 }
 
 #container {
-    width: 960px; margin: 0 auto;
+    position: relative; width: 960px; margin: 0 auto;
 }
 
 #colgauche {
@@ -86,6 +86,12 @@
     float: left; margin-right: 10px;
 }
 
+#minilogo {
+  background: url("../../images/pol_color.gif") left top no-repeat;
+  width: 46px; height: 5px; left: 99px; top: 55px;
+  position: absolute; z-index: 9;
+}
+
 .menu {
     border-left: 1px solid #C3C3C3;
     float: left;
@@ -118,28 +124,28 @@
     width: 430px; padding: 10px; background: #efefef;
 }
 .loginbutton{
-    margin: 10px auto; height: 60px; width: 330px; padding:5px;
-    background: url(../../images/tweetWriterBgdUnconnect.gif) no-repeat;
-    border: none; color:#fff;
+    margin: 10px 0; height: 45px; width: 420px; padding:5px;
+    background: url(twcx-img/bgdWriterDisconnect.png) no-repeat;
+    border: none; color:#fff; font-size: 12px;
 }
 .loginlink{
     text-decoration:none;
     color:#fff;
 }
 textarea {
-    display: block; margin: 10px auto; height: 60px; width: 330px; padding:5px;
-    background: url(../../images/tweetWriterBgdTxtArea.gif) no-repeat;
-    border: none; resize: none;
+    display: block; margin: 10px 0; height: 45px; width: 420px; padding:5px;
+    background: url(twcx-img/bgdWriter.png) no-repeat;
+    border: none; resize: none; font-size: 14px; font-family: 'PT Sans', Helvetica, Arial, sans-serif;
 }
 
 a#sendTweet {
     background: transparent url('../../images/bg_button_a_w.png') no-repeat top right;
     color: #444; display: block; font-size: 12px; height: 24px; line-height: 14px;
-    float:right; margin: 0 45px 0 50px; padding: 0 18px 0 0; text-decoration: none;
+    float:right; margin-left: 50px; padding: 0 18px 0 0; text-decoration: none;
 }
 a#sendTweet span {
     background: transparent url('../../images/bg_button_span_w.png') no-repeat; display: block; height: 14px;
-    padding: 5px 0 5px 18px;
+    padding: 5px 6px 5px 24px;
 }
 a#sendTweet:hover, a#sendTweet:active {
     background-position: right -24px;
@@ -148,7 +154,7 @@
     background-position: 0 -24px;
 }
 a.tweetButton { 
-    float:right; margin: 2px 5px 0 0; width:32px; height:20px; text-decoration: none; font: normal 12px;
+    float:right; margin: 2px 10px 0 0; width:32px; height:20px; text-decoration: none; font: normal 12px;
     color: #444; text-align:center; cursor: pointer; cursor: hand;
 }
 
@@ -166,7 +172,7 @@
 }
 
 #tweetCounter{
-    float: left; background: transparent; border: none;font-weight:bold; margin: 2px 0 0 42px; padding: 0;
+    float: left; background: transparent; border: none;font-weight:bold; margin-top: 2px; padding: 0;
 }
 .tweetCounterNegative{
     color:red;
@@ -402,11 +408,15 @@
 }
 
 #accordeon p {
-    margin: 5px 0; line-height: 1.5em;
+    margin: 5px 0; line-height: 1.5em; text-align: justify;
 }
 
 #accordeon li {
-    float: left; width: 480px; margin: 0 1px 1px 1px; padding: 4px; border: 1px solid #ffffff;
+    float: left; text-align: center; width: 480px; margin: 0 1px 1px 1px; padding: 4px; border: 1px solid #ffffff;
+}
+
+#accordeon span {
+    padding: 2px; cursor: pointer; cursor: hand;
 }
 
 li.acctitre {
@@ -419,12 +429,18 @@
 
 /* Tag Cloud */
 
-#motscles {
-    text-align: center;
+#hoverkw {
+    list-style: none; position: absolute; width: 86px; height: 39px; font-size: 14px; line-height: 19px;
+    background: url(twcx-img/lefttt.png); padding: 5px 13px 5px 5px; text-align: center; display: none;
+    margin-left: -104px; margin-top: -24px;
 }
 
-#motscles span {
-    padding: 2px; cursor: pointer; cursor: hand;
+#hoverkw a {
+    text-decoration: none; color: #222222;
+}
+
+#hoverkw a:hover {
+    color: #0099FF; text-decoration: underline;
 }
 
 /* Footer */
--- a/web/res/js-tweetcast/live-polemic.js	Tue Dec 13 19:01:59 2011 +0100
+++ b/web/res/js-tweetcast/live-polemic.js	Wed Dec 14 16:58:57 2011 +0100
@@ -467,10 +467,93 @@
     return res;
 }
 
+function mouseoverkw() {
+    var _jel = $(this),
+        _off = _jel.offset();
+    _jel.css({
+        color: "#0099ff"
+    });
+    $("#hoverkw")
+        .css({
+            "left" : _off.left + "px",
+            "top" : ( parseInt(_off.top) + ~~ (_jel.height() / 2) )  + "px",
+            "display" : "block"
+        })
+        .attr("kw", _jel.text());
+}
+
+function mouseoutkw() {
+    $("#hoverkw").hide();
+    $(this).css({
+        color: "#000000"
+    });
+}
+
+function makeTagCloud(tab, div) {
+    var minfreq = _(tab).min( function(a) { return a.freq} ).freq,
+        maxfreq = Math.max(minfreq + .1, _(tab).max( function(a) { return a.freq} ).freq),
+        echfreq = 8 / Math.sqrt( maxfreq - minfreq ),
+        html = '';
+    _(tab).each(function(_j) {
+        var maxann = 0,
+            ann = "default";
+        for (var k in _j.annotations) {
+            if (_j.annotations[k] == maxann) {
+                ann = "default";
+            }
+            if (_j.annotations[k] > maxann) {
+                ann = k;
+                maxann = _j.annotations[k];
+            }
+        }
+        if (ann == "default") {
+            var coul = '';
+        } else {
+            var c = getColor(ann, .6),
+                coul = "background: rgba(" + [ Math.floor(c.r), Math.floor(c.g), Math.floor(c.b), ( _j.annotations[ann] / _j.freq )].join(',') + ")";
+        }
+        var fontsize = Math.floor( ( 12 + Math.sqrt( _j.freq - minfreq ) * echfreq ) );
+        html += '<span style="line-height: ' + (8 + fontsize) + 'px; font-size: ' + fontsize + 'px;' + coul + '">' + _j.word + '</span> ';
+    });
+    $(div).html(html);
+    $(div + " span")
+        .mouseover(mouseoverkw)
+        .mouseout(mouseoutkw)
+        .click(function() {
+            $("#hoverkw").toggle();
+        });
+}
+
+function updateSuggested() {
+    if (!suggested_keywords || !suggested_keywords.length) {
+        return;
+    }
+    var _skw = suggested_keywords.map(function(_e) {
+        return {
+            "word" : _e,
+            "rgxp" : new RegExp(_e, "im"),
+            "freq" : 0,
+            "annotations" : {}
+        }
+    })
+    _(twCx.tweets).each(function(_t) {
+        _(_skw).each(function(_k) {
+            if (_t.text.search(_k.rgxp) != -1) {
+                _k.freq++;
+                _(_t.annotations).each(function(_a) {
+                    _k.annotations[_a] = 1 + ( _k.annotations[_a] || 0 )
+                })
+            }
+        });
+    });
+    makeTagCloud(_skw, "#suggkw");
+}
+
 function updateDisplay() {
     if (!twCx.tweets) {
         return;
     }
+    updateSuggested();
     if (twCx.filtre) {
         var tweets = twCx.tweets.filter(function(tweet) {
             var mention = '@' + tweet.user.screen_name;
@@ -598,32 +681,7 @@
         if (tab.length) {
             
             tab = _(tab).sortBy( function(a) { return ( - a.score ) }).slice(0,20);
-            var minfreq = _(tab).min( function(a) { return a.freq} ).freq,
-                maxfreq = Math.max(minfreq + .1, _(tab).max( function(a) { return a.freq} ).freq),
-                echfreq = 8 / Math.sqrt( maxfreq - minfreq ),
-                html = '';
-            for (var j in tab) {
-                var maxann = 0,
-                    ann = "default";
-                for (var k in tab[j].annotations) {
-                    if (tab[j].annotations[k] == maxann) {
-                        ann = "default";
-                    }
-                    if (tab[j].annotations[k] > maxann) {
-                        ann = k;
-                        maxann = tab[j].annotations[k];
-                    }
-                }
-                if (ann == "default") {
-                    var coul = '';
-                } else {
-                    var c = getColor(ann, .6),
-                        coul = "background: rgba(" + [ Math.floor(c.r), Math.floor(c.g), Math.floor(c.b), ( tab[j].annotations[ann] / tab[j].freq )].join(',') + ")";
-                }
-                var fontsize = Math.floor( ( 12 + Math.sqrt( tab[j].freq - minfreq ) * echfreq ) );
-                html += '<span style="line-height: ' + (8 + fontsize) + 'px; font-size: ' + fontsize + 'px;' + coul + '" onclick="filtrerTexte(\'' + tab[j].word.replace(/('|")/g, '\\$1') + '\')">' + tab[j].word + '</span> ';
-            }
-            $("#motscles").html(html);
+            makeTagCloud(tab,"#motscles");
         } else {
             $("#motscles").html('');
         }
@@ -753,14 +811,14 @@
 function filtrerAnnotation(annotation) {
     if (annotations[annotation]) {
         effectuerFiltrage(annotations[annotation].display_name,
-            new RegExp( "(" + annotations[annotation].keywords.map(function(a) { return a.source }).join("|") + ")", "gi" ) );
+            new RegExp( "(" + annotations[annotation].keywords.map(function(a) { return a.source }).join("|") + ")", "gim" ) );
     } else {
         effectuerFiltrage('', null)
     }
 }
 
 function filtrerTexte(valeur) {
-    effectuerFiltrage( valeur, valeur ? new RegExp("(" + valeur.replace(/(\W)/g, '\\$1') + ")" ,'gi') : null );
+    effectuerFiltrage( valeur, valeur ? new RegExp("(" + valeur.replace(/(\W)/g, '\\$1') + ")" ,'gim') : null );
 }
 
 function effectuerFiltrage(filtreTexte, tabRegexp) {
@@ -904,15 +962,13 @@
     $("#timeline").mousemove(function(evt) {
         twCx.tlMouseMoved = true;
         clicTl(evt);
-    });
-    $("#timeline").mousedown(function(evt) {
+    }).mousedown(function(evt) {
         twCx.tlMouseClicked = true;
         twCx.tlMouseMoved = false;
         var o = $(this).offset();
         twCx.refMouse = { x : evt.pageX - o.left, y : evt.pageY - o.top };
         twCx.refPosTl = tlPosTweet(tweetById(twCx.position)) || twCx.refMouse;
-    });
-    $("#timeline").mouseup(function(evt) {
+    }).mouseup(function(evt) {
         clicTl(evt);
         twCx.tlMouseClicked = false;
         twCx.tlMouseMoved = false;
@@ -924,8 +980,7 @@
             $(this).val("");
         }
         $(this).attr("class","");
-    });
-    $("#inp_q").focusout(function() {
+    }).focusout(function() {
         focusOutRecherche();
     });
     $("#inp_reset").click(function() {
@@ -946,6 +1001,24 @@
         }
         return false;
     });
+    $("#hoverkw").mouseover(function() {
+        $(this).dequeue().show();
+    }).mouseout(function() {
+        $(this).hide();
+    });
+    
+    $("#hkwsearch").click(function() {
+        var _hkw = $("#hoverkw");
+        filtrerTexte(_hkw.attr("kw"));
+        _hkw.hide();
+        return false;
+    });
+    $("#hkwtweet").click(function() {
+        var _hkw = $("#hoverkw");
+        add_grammar(_hkw.attr("kw"));
+        _hkw.hide();
+        return false;
+    });
     
     setInterval(function() {
         var sc = $("#scrollcont");
--- a/web/traduction.php	Tue Dec 13 19:01:59 2011 +0100
+++ b/web/traduction.php	Wed Dec 14 16:58:57 2011 +0100
@@ -151,8 +151,9 @@
 				"Agree" => "accord",
 				"Disagree" => "désaccord",
 				"Question" => "question",
-				"Reference" => "référence"
-				
+				"Reference" => "référence",
+                "addToTweet" => "Tweeter",
+                "SuggestedKW" => "Mots-clés suggérés"
 				);
                               
 $english = array(
@@ -291,7 +292,9 @@
                 "Agree" => "agree",
                 "Disagree" => "disagree",
                 "Question" => "question",
-                "Reference" => "reference"
+                "Reference" => "reference",
+                "addToTweet" => "Tweet it",
+                "SuggestedKW" => "Suggested Keywords"
 				);
                 
 $japan = array(
@@ -422,6 +425,8 @@
                 "Agree" => "agree",
                 "Disagree" => "disagree",
                 "Question" => "question",
-                "Reference" => "reference"
+                "Reference" => "reference",
+                "addToTweet" => "Tweet it",
+                "SuggestedKW" => "Suggested Keywords"
 );
 ?>
\ No newline at end of file