Improvements on PT live client
authorRaphael Velt <raph.velt@gmail.com>
Wed, 14 Dec 2011 18:22:27 +0100
changeset 408 4141c5821c98
parent 407 5ab44abc46df
child 412 97c082990f8d
Improvements on PT live client
web/client.php
web/config.js.tmpl
web/res/css/tweetcast.css
web/res/js-tweetcast/live-polemic.js
web/traduction.php
--- a/web/client.php	Wed Dec 14 16:58:57 2011 +0100
+++ b/web/client.php	Wed Dec 14 18:22:27 2011 +0100
@@ -48,7 +48,7 @@
   <head>
     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
     <title>Live Video and Annotation</title>
-    <meta http-equiv="X-UA-Compatible" content="IE=8" />
+    <meta http-equiv="X-UA-Compatible" content="IE=9" />
 
     <!-- FONT -->
     <link href='<?php echo(registry_url('PT-Sans_Narrow','font'))?>' rel='stylesheet' type='text/css'>
@@ -81,8 +81,7 @@
     $(document).ready(function() {
         
         $("#accordeon li.acctitre").click(function() {
-            $("#accordeon li.acctexte").slideUp();
-            $(this).next().dequeue().slideDown();
+            $("#accordeon li.acctexte").slideToggle();
         })
 
             //$("txt").hide();
@@ -307,14 +306,25 @@
                     <li class="acctexte">
                         <p><?php echo($translate->_('config__description')); ?></p>
                     </li>
-                    <li class="acctitre" id="suggkw_title">
-                        <h3><?php echo $translate->_('SuggestedKW'); ?></h3>
+                    <li class="acctitre">
+                        <h3><?php echo($translate->_('keywords')); ?></h3>
                     </li>
-                    <li class="acctexte hidden" id="suggkw"></li>
-                    <li class="acctitre">
-                        <h3><?php echo $translate->_('Tagcloud'); ?></h3>
+                    <li class="acctexte hidden">
+                        <div class="accsubtitle">
+                            <div class="aroundsubtitle">
+                                <h4><?php echo($translate->_('suggested')); ?></h4>
+                            </div>
+                        </div>
+                        <div class="tagcloud" id="suggkw"></div>
                     </li>
-                    <li class="acctexte hidden" id="motscles"></li>
+                    <li class="acctexte hidden">
+                        <div class="accsubtitle">
+                            <div class="aroundsubtitle">
+                                <h4><?php echo($translate->_('contextual')); ?></h4>
+                            </div>
+                        </div>
+                        <div class="tagcloud" id="motscles"></div>
+                    </li>
                 </ul>
             </div>
             <div class="footer">
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/config.js.tmpl	Wed Dec 14 18:22:27 2011 +0100
@@ -0,0 +1,65 @@
+var tracking_keywords = [ "#rsln" ],
+    suggested_keywords = [
+        "confiance",
+        "croyance",
+        "crédit",
+        "trace",
+        "foi",
+        "risque", 
+        "assurance", 
+        "démocratie", 
+        "expertise",
+        "catastrophe",
+        "transparence", 
+        "politique"
+    ],
+    annotations = {
+        "default" : {
+            "colors" : {
+                "tweet" : "#ffffff",
+                "timeline" : "#585858",
+                "h" : 0,
+                "s" : 0
+            }
+        },
+        "positive" : {
+            "display_name" : "++",
+            "keywords" : [ /\+\+/ ],
+            "colors" : {
+                "tweet" : "#c5e7cd",
+                "timeline" : "#1D973D",
+                "h" : .3,
+                "s" : .65
+            }
+        },
+        "negative" : {
+            "display_name" : "--",
+            "keywords" : [ /\-\-/ ],
+            "colors" : {
+                "tweet" : "#f6ced0",
+                "timeline" : "#CE0A15",
+                "h" : 0,
+                "s" : .8
+            }
+        },
+        "reference" : {
+            "display_name" : "==",
+            "keywords" : [ /\=\=/ ],
+            "colors" : {
+                "tweet" : "#ecedc1",
+                "timeline" : "#C5A62D",
+                "h" : .16,
+                "s" : .8
+            }
+        },
+        "question" : {
+            "display_name" : "??",
+            "keywords" : [ /\?\?/ ],
+            "colors" : {
+                "tweet" : "#bfdbec",
+                "timeline" : "#036AAE",
+                "h" : .6,
+                "s" : .8
+            }
+        }
+    }
--- a/web/res/css/tweetcast.css	Wed Dec 14 16:58:57 2011 +0100
+++ b/web/res/css/tweetcast.css	Wed Dec 14 18:22:27 2011 +0100
@@ -404,21 +404,37 @@
 }
 
 #accordeon h3 {
-    font-size: 16px; font-weight: bold; color: #666;
+    font-size: 16px; font-weight: bold; color: #555555;
 }
 
 #accordeon p {
-    margin: 5px 0; line-height: 1.5em; text-align: justify;
+    margin: 5px 0; line-height: 1.5em;
 }
 
 #accordeon li {
-    float: left; text-align: center; width: 480px; margin: 0 1px 1px 1px; padding: 4px; border: 1px solid #ffffff;
+    float: left; width: 480px; margin: 0 1px 1px 1px; padding: 4px; border: 1px solid #ffffff; position: relative;
 }
 
 #accordeon span {
     padding: 2px; cursor: pointer; cursor: hand;
 }
 
+div.accsubtitle {
+    position: absolute; top: 0; left: 0; width: 20px; height: 100%; background: #e0e0e0; border-right: 1px solid #999999; overflow: hidden;
+}
+
+div.aroundsubtitle {
+    position: absolute; top: 50%; left: 0; width: 0; height: 0; -moz-transform: rotate(-90deg); -webkit-transform: rotate(-90deg); -ms-transform: rotate(-90deg);
+}
+
+.aroundsubtitle h4 {
+    position: absolute; top: 0; left: -75px; width: 150px; height: 20px; font-size: 13px; font-weight: bold; text-align: center; color: #555555;
+}
+
+div.tagcloud {
+    width: 460px; text-align: center; margin-left: 20px;
+}
+
 li.acctitre {
     background: #efefef; cursor: pointer; cursor: hand;
 }
--- a/web/res/js-tweetcast/live-polemic.js	Wed Dec 14 16:58:57 2011 +0100
+++ b/web/res/js-tweetcast/live-polemic.js	Wed Dec 14 18:22:27 2011 +0100
@@ -524,36 +524,10 @@
         });
 }
 
-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;
@@ -581,7 +555,19 @@
             p = (twCx.followLast ? twCx.idIndex.length - 1 : 0);
         }
     }
-
+    
+    
+    if (suggested_keywords && suggested_keywords.length) {
+        var _skw = suggested_keywords.map(function(_e) {
+            return {
+                "word" : _e,
+                "rgxp" : new RegExp(_e, "im"),
+                "freq" : 0,
+                "annotations" : {}
+            }
+        })
+    }
+    
     var l = tweets.length,
         lines = 0,
         ppy = 0,
@@ -590,9 +576,24 @@
         localWords = {};
     
     function pushTweet(tp, className) {
+        
         if (tp < l && tp >= 0) {
-            html += tweetToHtml(tweets[tp], className)
+            
+            if (_skw) {
+                _(_skw).each(function(_k) {
+                    if (tweets[tp].text.search(_k.rgxp) != -1) {
+                        _k.freq++;
+                        _(tweets[tp].annotations).each(function(_a) {
+                            _k.annotations[_a] = 1 + ( _k.annotations[_a] || 0 )
+                        })
+                    }
+                });
+            }
+            
+            html += tweetToHtml(tweets[tp], className);
+            
             tweetsOnDisplay.push(tp);
+            
             for (var i in tweets[tp].words) {
                 var w = tweets[tp].words[i];
                 if (localWords[w]) {
@@ -665,6 +666,9 @@
             tlBuffer = html;
         }
         
+        if (_skw) {
+            makeTagCloud(_skw, "#suggkw");
+        }
         /* Recherche des mots pertinents correspondant à la sélection */
         
         var tab = _(localWords).map(function(v, k) {
--- a/web/traduction.php	Wed Dec 14 16:58:57 2011 +0100
+++ b/web/traduction.php	Wed Dec 14 18:22:27 2011 +0100
@@ -146,14 +146,15 @@
 				// Polemic Tweet Tweetcast (rv)
 				
 				"Rechercher" => "Rechercher",
-				"Tagcloud" => "Nuage de mots-clés contextuel",
 				"SearchByPolemic" => "Rechercher par polémique",
 				"Agree" => "accord",
 				"Disagree" => "désaccord",
 				"Question" => "question",
 				"Reference" => "référence",
                 "addToTweet" => "Tweeter",
-                "SuggestedKW" => "Mots-clés suggérés"
+                "keywords" => "Mots-clés",
+                "suggested" => "Suggérés",
+                "contextual" => "Contextuels"
 				);
                               
 $english = array(
@@ -287,14 +288,15 @@
                 // Polemic Tweet Tweetcast (rv)
                 
                 "Rechercher" => "Search",
-                "Tagcloud" => "Contextual keyword cloud",
                 "SearchByPolemic" => "Search by polemic",
                 "Agree" => "agree",
                 "Disagree" => "disagree",
                 "Question" => "question",
                 "Reference" => "reference",
                 "addToTweet" => "Tweet it",
-                "SuggestedKW" => "Suggested Keywords"
+                "keywords" => "Keywords",
+                "suggested" => "Suggested",
+                "contextual" => "Contextual"
 				);
                 
 $japan = array(
@@ -420,13 +422,14 @@
                 // Polemic Tweet Tweetcast (rv)
                 
                 "Rechercher" => "Search",
-                "Tagcloud" => "Contextual keyword cloud",
                 "SearchByPolemic" => "Search by polemic",
                 "Agree" => "agree",
                 "Disagree" => "disagree",
                 "Question" => "question",
                 "Reference" => "reference",
                 "addToTweet" => "Tweet it",
-                "SuggestedKW" => "Suggested Keywords"
+                "keywords" => "Keywords",
+                "suggested" => "Suggested",
+                "contextual" => "Contextual"
 );
 ?>
\ No newline at end of file