# HG changeset patch # User Raphael Velt # Date 1324047443 -3600 # Node ID eb7c2cff1816ee3a3c508b43d2bdf09e45e0a8a4 # Parent ad151a86046f8b7d8464f76636f2e75d692d22e9 Modifs pour ENMI diff -r ad151a86046f -r eb7c2cff1816 web/client.php --- a/web/client.php Fri Dec 16 10:39:51 2011 +0100 +++ b/web/client.php Fri Dec 16 15:57:23 2011 +0100 @@ -39,322 +39,6 @@ $head_logo = URL_ROOT."$rep/".$translate->_('config__head_logo'); } -?> - - - - - - - Live Video and Annotation - - - - ' rel='stylesheet' type='text/css'> - ' rel='stylesheet' type='text/css'> - - - - - - - - - - - - - - - - - - - - - - - -
+include dirname(__FILE__). ( ( isset($config['use_tweetcast']) && $config['use_tweetcast'] ) ? '/client_new.php' : '/client_old.php' ) -
-
- -
- "); - } else { - echo(""); - } - ?> - - - - _("Envoyer"); ?> - - - - - ++ - -- - == - ?? - -
- -
-
-
-
-
- - - -
-
-
- - -
-
- _('SearchByPolemic'); ?> :
-
-
-
-
    -
    -
    -
    -
    -
    -
    -
    -
    -
    - - - - - - - - - - 0):?> - - - - -
    -
    -
    - -
    - -
    - - -
    -
    -
    -
    - - - \ No newline at end of file +?> \ No newline at end of file diff -r ad151a86046f -r eb7c2cff1816 web/client_new.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/client_new.php Fri Dec 16 15:57:23 2011 +0100 @@ -0,0 +1,320 @@ + + + + + + Live Video and Annotation + + + + ' rel='stylesheet' type='text/css'> + ' rel='stylesheet' type='text/css'> + + + + + + + + + + + + + + + + + + + + + + +
    + +
    +
    + +
    + "); + } else { + echo(""); + } + ?> + + + + _("Envoyer"); ?> + + + + + ++ + -- + == + ?? + +
    + +
    +
    +
    +
    +
    + + + +
    +
    +
    + + +
    +
    + _('SearchByPolemic'); ?> :
    +
    +
    +
    +
      +
      +
      +
      +
      +
      +
      + +
      +
      +
      + + + + + + + + + + 0):?> + + + + +
      +
      +
      + +
      + +
      + + +
      +
      +
      +
      + + + \ No newline at end of file diff -r ad151a86046f -r eb7c2cff1816 web/client_old.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/client_old.php Fri Dec 16 15:57:23 2011 +0100 @@ -0,0 +1,378 @@ + + + + + + Live Video and Annotation + + + + + + + + + + + + + + + + + + ' rel='stylesheet' type='text/css'> + ' rel='stylesheet' type='text/css'> + ' rel='stylesheet' type='text/css'> + + + + + + + +
      +
      + + + + + + + +
      + +
      + + + + + + + + + +
      + 0):?> +
      + +
      + +
      + +
      + + +
      + +
      + +
      +
      +
      +
      + _('config__title')); ?>
      +
      +
      _('config__description')); ?>
      + + +
      + + "); + }else{ + echo(""); + } + ?> + + +
      + _("Envoyé"); ?>

      +
      + +
      + _("Erreur1"); ?>
       


      +
      + + + + + _("Envoyer"); ?> + + + + + + ++ + -- + == + ?? + +
      + +
      + +
      + + + + + + + + diff -r ad151a86046f -r eb7c2cff1816 web/common.php --- a/web/common.php Fri Dec 16 10:39:51 2011 +0100 +++ b/web/common.php Fri Dec 16 15:57:23 2011 +0100 @@ -187,9 +187,6 @@ 'json-js' => URL_ROOT.'res/douglascrockford-JSON-js/json2.js', 'underscore' => URL_ROOT.'res/underscore/underscore-min.js' , 'jquery-scrollto'=>URL_ROOT.'res/jquery.scrollto/jquery.scrollTo-1.4.2-min.js' , - 'twcx-gevent' => URL_ROOT.'res/js-tweetcast/connect-gevent.js' , - 'twcx-nodejs' => URL_ROOT.'res/js-tweetcast/connect-nodejs.js' , - 'twcx-standalone'=> URL_ROOT.'res/js-tweetcast/connect-standalone.js' , 'twcx-main' => URL_ROOT.'res/js-tweetcast/live-polemic.js' , ), @@ -208,9 +205,6 @@ 'json-js' => URL_ROOT.'res/douglascrockford-JSON-js/json2.js', 'underscore' => URL_ROOT.'res/underscore/underscore-min.js' , 'jquery-scrollto'=>URL_ROOT.'res/jquery.scrollto/jquery.scrollTo-1.4.2-min.js' , - 'twcx-gevent' => URL_ROOT.'res/js-tweetcast/connect-gevent.js' , - 'twcx-nodejs' => URL_ROOT.'res/js-tweetcast/connect-nodejs.js' , - 'twcx-standalone'=> URL_ROOT.'res/js-tweetcast/connect-standalone.js' , 'twcx-main' => URL_ROOT.'res/js-tweetcast/live-polemic.js' , ) diff -r ad151a86046f -r eb7c2cff1816 web/config.js.tmpl --- a/web/config.js.tmpl Fri Dec 16 10:39:51 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -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 - } - } - } diff -r ad151a86046f -r eb7c2cff1816 web/enmi2011/config.php --- a/web/enmi2011/config.php Fri Dec 16 10:39:51 2011 +0100 +++ b/web/enmi2011/config.php Fri Dec 16 15:57:23 2011 +0100 @@ -69,4 +69,67 @@ 'div_height' => 700, 'player_width' => 650, 'player_height' => 488, + + // New Tweet live parameters + 'use_tweetcast' => true, + 'js_config' => " + var connect_type = 'standalone', + source_address = 'http://velt.info/polemic/tweetdata.js', + tracking_keywords = [ \"#enmi\" ], + suggested_keywords = [ + \"confiance\", + \"croyance\", + \"crédit\", + \"trace\", + \"foi\", + \"risque\", + \"assurance\", + \"démocratie\", + \"expertise\", + \"catastrophe\", + \"transparence\", + \"politique\" + ], + annotations = { + \"default\" : { + \"colors\" : { + \"h\" : 0, + \"s\" : 0 + } + }, + \"positive\" : { + \"display_name\" : \"++\", + \"keywords\" : [ /\\+\\+/ ], + \"colors\" : { + \"h\" : .3, + \"s\" : .65 + } + }, + \"negative\" : { + \"display_name\" : \"--\", + \"keywords\" : [ /\\-\\-/ ], + \"colors\" : { + \"h\" : 0, + \"s\" : .8 + } + }, + \"reference\" : { + \"display_name\" : \"==\", + \"keywords\" : [ /\\=\\=/ ], + \"colors\" : { + \"h\" : .16, + \"s\" : .8 + } + }, + \"question\" : { + \"display_name\" : \"??\", + \"keywords\" : [ /\\?\\?/ ], + \"colors\" : { + \"h\" : .6, + \"s\" : .8 + } + } + }" + + ); \ No newline at end of file diff -r ad151a86046f -r eb7c2cff1816 web/res/css/twcx-img/bg_onglet.png Binary file web/res/css/twcx-img/bg_onglet.png has changed diff -r ad151a86046f -r eb7c2cff1816 web/res/css/tweetcast.css --- a/web/res/css/tweetcast.css Fri Dec 16 10:39:51 2011 +0100 +++ b/web/res/css/tweetcast.css Fri Dec 16 15:57:23 2011 +0100 @@ -379,12 +379,27 @@ /* Colonne de droite */ +#onglets { + float: left; width: 441px; margin: 43px 25px 0; list-style: none; + border-left: 1px solid #999; +} + +#onglets li { + float: left; text-transform: uppercase; background: url(twcx-img/bg_onglet.png) repeat-x; + line-height: 12px; font-size: 12px; height: 12px; padding: 6px 10px; font-weight: bold; + border: 1px #999; border-style: solid solid solid none; margin-top: 1px; +} + +#onglets li.selected { + background-position: 0 -22px; padding-bottom: 8px; border-bottom: none; margin-top: 0; +} + #coldroite { float: left; width: 492px; } #vlWrap { - float: left; border: 5px solid #ffffff; background: #999999; padding: 1px; margin-top: 70px; + float: left; border: 5px solid #ffffff; background: #999999; padding: 1px; } #videoLivePlayer { @@ -449,6 +464,7 @@ li.acctexte { background: url(twcx-img/bgdeplie.png) top repeat-x #efefef; + max-height: 228px; overflow: auto; } /* Tag Cloud */ diff -r ad151a86046f -r eb7c2cff1816 web/res/js-tweetcast/connect-gevent.js --- a/web/res/js-tweetcast/connect-gevent.js Fri Dec 16 10:39:51 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -function connectTweets() { - $.getJSON('http://' + document.location.hostname + ':8888/?callback=?', function(data) { - loadTweets(data.tweets) - } ); - - setInterval(function() { - if (!twCx.tweets) { - return; - } - $.getJSON('http://' + document.location.hostname + ':8888/?after_id=' + twCx.tweets[twCx.tweets.length - 1].id + '&callback=?', function(data) { - loadTweets(data.tweets, true); - }); - }, 1000) -} \ No newline at end of file diff -r ad151a86046f -r eb7c2cff1816 web/res/js-tweetcast/connect-nodejs.js --- a/web/res/js-tweetcast/connect-nodejs.js Fri Dec 16 10:39:51 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,16 +0,0 @@ -document.write(' - +
      +
      diff -r ad151a86046f -r eb7c2cff1816 web/sweet-tweet/pt_logo.gif Binary file web/sweet-tweet/pt_logo.gif has changed diff -r ad151a86046f -r eb7c2cff1816 web/sweet-tweet/script.js --- a/web/sweet-tweet/script.js Fri Dec 16 10:39:51 2011 +0100 +++ b/web/sweet-tweet/script.js Fri Dec 16 15:57:23 2011 +0100 @@ -1,12 +1,10 @@ -var AVATARWIDTH = 35, - COLUMNWIDTH = 2, - COLUMNHEIGHT = 420, - THRESHOLD = 24, +var THRESHOLD = 12, DROPCOUNT = 12; var swTw = { "keyword" : "#enmi", "columns_words" : [ + "politique", "confiance", "croyance", "crédit", @@ -17,58 +15,57 @@ "démocratie", "expertise", "catastrophe", - "transparence", - "politique" + "transparence" ], "tweets" : [], "tweetsIndex" : [], + "twInCol" : [], "firstDisplayedTweet" : 0, "cursor" : -1, -/* "annotations" : { + "annotations" : { "positive" : { "keyword" : "+", "colors" : { "tweet" : "#c5e7cd", - "timeline" : "#00ff00" + "timeline" : "#1D973D" } }, "negative" : { "keyword" : "-", "colors" : { "tweet" : "#f6ced0", - "timeline" : "#ff0000" + "timeline" : "#CE0A15" } }, "reference" : { - "keyword" : "#", + "keyword" : " #", "colors" : { "tweet" : "#efefa1", - "timeline" : "#ffff00" + "timeline" : "#C5A62D" } }, "question" : { "keyword" : "?", "colors" : { "tweet" : "#bfdbec", - "timeline" : "#0000ff" + "timeline" : "#036AAE" } } -} */ + } } -function highlightKeyword(stra, strb) { +function highlightKeyword(stra, strb, color) { var rgxp = RegExp( '(' + strb.replace(/(\W)/gm, '\\$1') + ')', "gim"); - return stra.replace(rgxp, '$1'); + return stra.replace(rgxp, '$1'); } function highlightText(txt) { - var res = highlightKeyword(txt, swTw.keyword); res = swTw.columns_words.reduce(function(a, b) { - return highlightKeyword(a,b); + return highlightKeyword(a,b, '#333333'); + }, txt); + res = _(swTw.annotations).reduce(function(a, b) { + return (b.keyword ? highlightKeyword(a,b.keyword,b.colors.timeline) : a); }, res); -/* res = _(swTw.annotations).reduce(function(a, b) { - return (b.keyword ? highlightKeyword(a,b.keyword) : a); - }, res); */ return res; } @@ -78,31 +75,21 @@ } if (swTw.cursor < swTw.tweets.length - 1) { swTw.cursor = Math.max(swTw.cursor + 1, swTw.tweets.length - 120); - var nTweet = swTw.cursor; + var tweet = swTw.tweets[swTw.cursor], + html = '

      @' + + tweet.from_user + + ' (' + + tweet.from_user_name + + ')' + + '

      ' + + highlightText(tweet.text) + + '

      '; + $("#tweetcont").html(html) } else { - var nTweet = swTw.tweets.length - 1 - ~~( Math.random() * Math.min(swTw.tweets.length,50) ); + $("#tweetcont").html("") } - var tweet = swTw.tweets[nTweet]; - $("#tweetcont").html('

      @' - + tweet.from_user - + ' (' - + tweet.from_user_name - + ')' - + '

      ' - + highlightText(tweet.text) - + '

      '); -/* var bgcolor = ''; - for (var i in swTw.annotations) { - if (swTw.annotations[i].keyword) { - if (tweet.text.indexOf(swTw.annotations[i].keyword) != -1) { - bgcolor = swTw.annotations[i].colors.tweet; - break; - } - } - } */ - $("#tweetcont").css("background",bgcolor); } function dropOldTweets() { @@ -112,26 +99,15 @@ return _(col).without(tweet.id_str); }); _(tweet.elements).each(function(elid) { - $("#" + elid).fadeOut(2000, function() { + $("#" + elid).animate({ + "width": "0px" + }, + 2000, + function() { $(this).detach(); - }); + }) }); }); - - _(swTw.tweets.slice(_newPos)).each(function(tweet) { - _(tweet.elements).each(function(elid) { - var iword = parseInt(elid.split('_')[2]), - iel = swTw.twInCol[iword].indexOf(tweet.id_str), - posx = COLUMNHEIGHT - AVATARWIDTH * (1 + ~~( iel / COLUMNWIDTH)), - posy = AVATARWIDTH * (iel % COLUMNWIDTH); - $("#" + elid).delay(500).animate({ - "top" : posy + "px", - "left" : posx + "px" - }, - 500); - }); - }); - console.log("fin"); swTw.firstDisplayedTweet = _newPos; } @@ -144,36 +120,30 @@ tweet.elements = []; _(tweet.columns).each(function(word) { var iword = swTw.columns_words.indexOf(word), - tcl = swTw.twInCol[iword], - tclen = tcl.length; - var posx = COLUMNHEIGHT - AVATARWIDTH * (1 + ~~( tclen / COLUMNWIDTH)), - posy = AVATARWIDTH * (tclen % COLUMNWIDTH), + icol = ( swTw.twInCol[iword*2+1].length < swTw.twInCol[iword*2].length ? iword*2+1 : iword*2 ), elid = 'avatar_' + tweet.id_str + '_' + iword, - bgcolor = '#999999'; -/* for (var i in swTw.annotations) { - if (swTw.annotations[i].keyword) { - if (tweet.text.indexOf(swTw.annotations[i].keyword) != -1) { - bgcolor = swTw.annotations[i].colors.timeline; - break; - } - } - } */ - $('#column_' + iword).append( + colA = swTw.colAnnot[iword], + ttl = 0; + _(swTw.annotations).each(function(v,k) { + if (tweet.text.indexOf(v.keyword) != -1) { + colA[k]++; + ttl++; + } + }); + colA.total += Math.max(1,ttl); + $('#tube_' + icol).append( '
      ' ); tweet.elements.push(elid); - tcl.push(tweet.id_str); + swTw.twInCol[icol].push(tweet.id_str); $("#" + elid).animate({ - "left" : posx + "px" - }, 2000); + "margin-right" : "0px" + }, + 2000); }) swTw.tweets.push(tweet); swTw.tweetsIndex.push(tweet.id_str); @@ -183,6 +153,11 @@ })) { dropOldTweets(); } + _(swTw.colAnnot).each(function(colA, i) { + _(swTw.annotations).each(function(v, k) { + $("#polemic_" + i + "_" + k).css("width", ~~(100 * colA[k] / colA.total) + "%"); + }); + }) } function retrieveTweets() { @@ -191,7 +166,7 @@ "lang" : "fr", // "keyword" : "#enmi", "pages" : 1, - "rpp" : 50, + "rpp" : 100, "cbEnd" : function() { callbackTweets(this.tweets); } @@ -240,20 +215,42 @@ function(mot, i) { return '

      ' + + '">
      ' + + _(swTw.annotations).map(function(v,k) { + return '
      ' + }).join('') + +'

      ' + mot + '

      ' } ).join("") ); - - swTw.twInCol = swTw.columns_words.map(function() { - return []; + + for (var i = 0; i < swTw.columns_words.length * 2; i++) { + swTw.twInCol.push([]); + } + + swTw.colAnnot = swTw.columns_words.map(function() { + var res = { "total" : 0 } + _(swTw.annotations).map(function(v,k) { + res[k] = 0; + }); + return res; }); retrieveTweets(); - setInterval(retrieveTweets,5000); + setInterval(retrieveTweets, 5000); - setInterval(nextTweet, 3000); + setInterval(nextTweet, 6000); }); diff -r ad151a86046f -r eb7c2cff1816 web/sweet-tweet/small.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/web/sweet-tweet/small.html Fri Dec 16 15:57:23 2011 +0100 @@ -0,0 +1,34 @@ + + + + + + Sweet Tweet + + + +
      + +
      + + + \ No newline at end of file diff -r ad151a86046f -r eb7c2cff1816 web/sweet-tweet/style.css --- a/web/sweet-tweet/style.css Fri Dec 16 10:39:51 2011 +0100 +++ b/web/sweet-tweet/style.css Fri Dec 16 15:57:23 2011 +0100 @@ -2,12 +2,20 @@ margin: 0; font-family: Helvetica, Arial, sans-serif; } +body.jour { + background: #ffffff; +} + +body.nuit { + background: #000000; +} + img { border: none; } .highlight { - background: #ffff80; + font-weight: bold; padding: 0 2px; color: #ffffff; } #container { @@ -15,52 +23,73 @@ height: 1280px; margin: 0 auto; position: relative; + overflow: hidden; } #tweetcont { - float: left; width: 780px; height: 72px; background: #dddddd; - padding: 15px 10px; + float: left; width: 760px; height: 96px; background: #dddddd; + padding: 20px; } #tweetcont img { - float: left; width: 72px; height: 72px; + float: left; width: 96px; height: 96px; } #tweetcont p { - margin: -2px 5px 10px 82px; padding: 0; font-size: 18px; + margin: -2px 5px 10px 106px; padding: 0; font-size: 20px; } p.tweet_text { color: #666; } +#ptimg { + position: absolute; top: -5px; right: -10px; +} + #columncont { float: left; width: 800px; margin-top: 20px; } .column { - float: left; width: 780px; height: 70px; margin: 8px 10px; overflow: hidden; position: relative; + float: left; width: 780px; height: 70px; margin: 8px 10px; position: relative; } .column-tube { - float: left; width: 420px; height: 70px; background: #eeeeee; + float: left; width: 420px; height: 70px; +} + +.tube { + width: 1000px; height: 35px; margin-left: -580px; overflow: hidden; } .column-title { - float: left; margin-left: 10px; width: 350px; height: 70px; background: #eeeeee; + float: left; margin-left: 10px; width: 350px; height: 70px; +} + +.polemicvol { + float: right; height: 70px; } .column-title h3 { - margin: 10px; padding: 0; font-size: 40px; line-height: 50px; - height: 50px; text-transform: uppercase; color: #666; + position: absolute; margin: 10px; padding: 0; font-size: 40px; line-height: 50px; + height: 50px; text-transform: uppercase; } +.jour .column-tube, .jour .column-title { + background: #cccccc; color: #ffffff; +} + +.nuit .column-tube, .nuit .column-title { + background: #eeeeee; color: #000000; +} + div.avatar { - display: block; position: absolute; width: 35px; height: 35px; z-index: 2; + float: right; width: 35px; height: 35px; overflow: hidden; } .avatar img { - width: 35px; height: 35px; + width: 100%; height: 100%; } div#logos {