# HG changeset patch # User ymh # Date 1329860839 -3600 # Node ID 7b76d97e3051c091a1f1b79824ff368a6ab7dbe5 # Parent 80040858c0065ddca28cc8c142fa08215294e635# Parent 5e1d7f77f3551ba422a171148a8b8db7d9797ac0 Merge with 5e1d7f77f3551ba422a171148a8b8db7d9797ac0 diff -r 80040858c006 -r 7b76d97e3051 client/compteur.html --- a/client/compteur.html Tue Feb 21 22:46:45 2012 +0100 +++ b/client/compteur.html Tue Feb 21 22:47:19 2012 +0100 @@ -7,20 +7,25 @@ @@ -41,6 +46,8 @@ * */ var searchKeywords = ['Sarkozy', 'Hollande', 'Bayrou']; + var totalTweets = 0; + $(function() { myTweetSource = new Btv_TweetSource({ @@ -48,16 +55,27 @@ }); myTweetSource.setOnNewTweets(function() { - var _filtered = this.afterDate(startHour); - $("#nbtweets").html(_filtered.count()); + totalTweets = this.afterDate(startHour).count(); }); + + setInterval(function() { + var _aff = parseInt($("#nbtweets").html()); + if (_aff < totalTweets) { + if (_aff) { + $("#nbtweets").html(1+_aff); + } else { + $("#nbtweets").html(totalTweets); + } + } + }, 200); });
-

Total des tweets #LGW

-

+

#LGW

+

Total des tweets

+

0

diff -r 80040858c006 -r 7b76d97e3051 client/css/controlpanel.css --- a/client/css/controlpanel.css Tue Feb 21 22:46:45 2012 +0100 +++ b/client/css/controlpanel.css Tue Feb 21 22:47:19 2012 +0100 @@ -8,9 +8,7 @@ background-image: -ms-linear-gradient(right, rgb(224,224,224) 20%, rgb(250,250,250) 80%); top: 0; height: 100%; border-right: 4px solid #666666; -} -#btv-cp-container:hover { - left: 0; + z-index: 20; } .btv-cp-line { position: relative; width: 100%; height: 100%; margin: 0 auto; @@ -54,6 +52,11 @@ .btv-cp-tweet-from { font-weight: bold; } + +.btv-cp-tweet-remove { + background-position: -30px 0; +} + .btv-cp-liste-tweets li:hover { background: #00f; color: #fff; } diff -r 80040858c006 -r 7b76d97e3051 client/css/main.css --- a/client/css/main.css Tue Feb 21 22:46:45 2012 +0100 +++ b/client/css/main.css Tue Feb 21 22:47:19 2012 +0100 @@ -1,17 +1,21 @@ +#canvas div { + z-index: 5; +} + #podium-container { position: absolute; width: 1480px; - top: 600px; + top: 700px; left: 400px; } #podium { width: 100%; - height: 300px; + height: 200px; } #podium-labels { position: absolute; width: 100%; - top: 320px; + top: 215px; } #podium-labels li { float: left; @@ -23,7 +27,7 @@ #podium-chiffres { position: absolute; width: 100%; - top: 240px; + top: 145px; } #podium-chiffres li { float: left; @@ -47,17 +51,33 @@ display: none; } .btv-bigtweet-image { + position: absolute; width: 100px; height: 100px; - margin: 0 30px 30px 0; - float: left; } .btv-bigtweet-screen-name { - font-weight: bold; + font-weight: bold; margin: -8px 0 0 140px; } .btv-bigtweet-name { - margin: 10px 0; + margin: 10px 0 20px 140px; } .btv-tweet-text { clear: both; -} \ No newline at end of file +} + +#btv-tooltip { + display: none; position: absolute; z-index: 8; font-size: 20px; background: #0031ff; color: #ffffff; + width: 350px; padding: 10px; margin: -30px 0 0 -380px; border-right: 5px solid; +} + +.btv-tooltip-arrow { + position: absolute; width: 35px; height: 50px; top: 30px; left: 370px; background: url('../img/tooltip-arrow.png'); +} + +.btv-tooltip-name { + font-weight: bold; +} + +.btv-tooltip-image { + float: left; margin: 0 10px 10px 0; +} diff -r 80040858c006 -r 7b76d97e3051 client/img/addshow.png Binary file client/img/addshow.png has changed diff -r 80040858c006 -r 7b76d97e3051 client/img/tooltip-arrow.png Binary file client/img/tooltip-arrow.png has changed diff -r 80040858c006 -r 7b76d97e3051 client/js/main.js --- a/client/js/main.js Tue Feb 21 22:46:45 2012 +0100 +++ b/client/js/main.js Tue Feb 21 22:47:19 2012 +0100 @@ -2,6 +2,13 @@ myTweetSource, myQueueManager; +var columnCounts, + onlineTweets = [], + dumpIsPaused = false; + +var MAX_TWEETS_BEFORE_DUMP = 20, + TWEETS_TO_DUMP_AT_ONCE = 10; + function updateLastTweetList() { var _filtered = myTweetSource.afterDate(startHour), _txtFilter = $("#btv-cp-champ-filtre").val(), @@ -9,6 +16,17 @@ if (_txtFilter.length > 1) { _filtered = _filtered.search(_txtFilter); _reFilter = regexpFromText(_txtFilter); + for (var _i = 0; _i < onlineTweets.length; _i++) { + if (onlineTweets[_i].text.search(_reFilter) == -1) { + $('#'+onlineTweets[_i].id_str).fadeTo(250, 0.1); + } else { + $('#'+onlineTweets[_i].id_str).fadeTo(250, 1); + } + } + } else { + for (var _i = 0; _i < onlineTweets.length; _i++) { + $('#'+onlineTweets[_i].id_str).fadeTo(250, 1); + } } $('#btv-cp-liste-tweets-tout').html( _filtered.reverse().slice(0,20).map(function(_t) { @@ -29,15 +47,16 @@ var _t = myTweetSource.tweetById(tweetId); if (_t) { $("#btv-cp-liste-tweets-selection").prepend( - '
  • ' - + _t.created_at.match(/\d+:\d+:\d+/)[0] - + ' @' - + _t.from_user - + ' ' - + _t.text - + '
  • ' + '
  • ' + + _t.created_at.match(/\d+:\d+:\d+/)[0] + + ' @' + + _t.from_user + + ' ' + + _t.text + + '
    ' + + '
  • ' ); } } @@ -59,7 +78,41 @@ } } +function showTooltip(_t, _x, _y) { + $("#btv-tooltip").html('

    ' + + _t.from_user + + ' (' + + _t.from_user_name + +')

    ' + + _t.text + +'

    ').show().css({ + "left": _x + "px", + "top": _y + "px", + }) +} + +function hideTooltip() { + $("#btv-tooltip").hide(); +} + +function showControlPanel() { + $("#btv-cp-container").dequeue().animate({ + "left": 0 + }); +} + +function hideControlPanel() { + $("#btv-cp-container").dequeue().animate({ + "left": "-315px" + }); +} + $(function() { + columnCounts = columnKeywords.map(function() { + return 0; + }) setInterval(function() { var _t = Math.floor((new Date() - startHour)/1000), _s = _t % 60, @@ -102,13 +155,39 @@ } } if (_cat != -1) { - if (_cat == 2) { - console.log(_t.text); + _t.cat = _cat; + columnCounts[_cat]++; + onlineTweets.push(_t); + createBallTweetForce(_t); + if (!dumpIsPaused) { + for (var _i = 0; _i < columnCounts.length; _i++) { + if (columnCounts[_cat] > MAX_TWEETS_BEFORE_DUMP) { + var toDel = onlineTweets.splice(0,TWEETS_TO_DUMP_AT_ONCE); + + for (var _j = 0; _j < toDel.length; _j++) { + var _id = toDel[_j].id_str; + world.DestroyBody(b2bod[_id]); + + $('#'+_id).fadeTo(500, 0, function() { + $(this).remove(); + }); + } + + // Regenerate column counts + columnCounts = columnKeywords.map(function() { + return 0; + }); + for (var _k = 0; _k < onlineTweets.length; _k++) { + columnCounts[onlineTweets[_k].cat]++; + } + break; + } + } } - _t.cat = _cat; - createBallTweetForce(_t); } -}); + }); + + $("#btv-cp-container").mouseover(showControlPanel).mouseout(hideControlPanel); $("#btv-cp-champ-filtre").keyup(function() { updateLastTweetList(); @@ -130,4 +209,14 @@ $(this).removeClass("btv-cp-status-play"); } }); + $("#btv-cp-cont-pause-aval").click(function() { + dumpIsPaused = !dumpIsPaused + if (dumpIsPaused) { + $(this).removeClass("btv-cp-status-pause"); + $(this).addClass("btv-cp-status-play"); + } else { + $(this).addClass("btv-cp-status-pause"); + $(this).removeClass("btv-cp-status-play"); + } + }); }); \ No newline at end of file diff -r 80040858c006 -r 7b76d97e3051 client/js/podium.js --- a/client/js/podium.js Tue Feb 21 22:46:45 2012 +0100 +++ b/client/js/podium.js Tue Feb 21 22:47:19 2012 +0100 @@ -25,8 +25,8 @@ } Btv_Podium.prototype.update = function(data, noAnimate) { - var _data = data || []; - var i = 0; + var _data = data || [], + _oldcount = this._$.children().length; while (_data.length > this._$.children().length) { var _newCol = document.createElement("div"); this.$(_newCol).css({ @@ -38,10 +38,6 @@ "margin-left": 0 }); this._$.append(_newCol); - i++; - if (i > 10) { - break; - } } while (_data.length < this._$.children().length) { this._$.children().last().detach(); @@ -55,13 +51,16 @@ _width = Math.floor(( this.options.width - (_data.length - 1) * _spacing) / _data.length), _this = this; this._$.children().each(function(_i, _e) { - var _height = _scale * _data[_i] + _this.options.minHeight, - _css = { - "margin-top": _this.options.height - _height, - "height": _height, - "width": _width, - "margin-left": (_i ? _spacing : 0) - } + var _height = Math.floor(_scale * _data[_i] + _this.options.minHeight), + _css = {}; + if (_height != _this.$(_e).height()) { + _css["margin-top"] = _this.options.height - _height, + _css["height"] = _height + } + if (_data.length != _oldcount) { + _css["width"] = _width; + _css["margin-left"] = (_i ? _spacing : 0); + } if (noAnimate) { _this.$(_e).css(_css); } else { diff -r 80040858c006 -r 7b76d97e3051 client/js/tweetanim.js --- a/client/js/tweetanim.js Tue Feb 21 22:46:45 2012 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +0,0 @@ -var tweetQueue = []; -var isAnimating = false; -var countTweets = 0; -var isPlayingTweets = false; // auto start -var SPEED_TWEETS = 10; -var MAX_VOTES = 25; -var DUMP_TWEETS = 10; -var toDel = []; - -var current_tweet = null; -var current_past_tweet = 0; - -var ts = []; - -var b = 0; - -var defaultTweet = { - created_at: "Sun, 19 Feb 2012 19:12:15 +0000", - date_value: 1329678735000, - from_user: "chateaudeau", - from_user_id: 164810536, - from_user_id_str: "164810536", - from_user_name: "Olivia Duchâteau", - geo: null, - id: 171311150900854800, - id_str: "171311150900854784", - iso_language_code: "fr", - profile_image_url: "http://a2.twimg.com/profile_images/1481618117/clip_image00212_normal.jpg", - profile_image_url_https: "https://si0.twimg.com/profile_images/1481618117/clip_image00212_normal.jpg", - source: "<a href="http://phnxapp.com" rel="nofollow">phnx</a>", - text: "RT @LeProf_Higgins: Le carton rouge à Sarkozy, on a eu l'idée avant MLP mais le mien sera rouge, puis rose, mais pas brun !", - to_user: null, - to_user_id: null, - to_user_id_str: null, - to_user_name: null, -}; - -var TweetAnim = { - - init: function() { - - var html = getDefaultTweet(); - $('#tweet-container').fadeOut(0).html(html).fadeIn(2000, function() { - $(this).fadeOut(500, function() { - isPlayingTweets=true; - $(this).html("").fadeIn(); - }); - }); - - - - }, - queueTweet: function(t) { - console.log("Queued " + t.text); - tweetQueue.push({t: t, anim: true}); - $('#nbr-mesure-new').html(tweetQueue.length); - /* - if(tweetQueue.length>0) - document.getElementById('btn-tweet-next').style.visibility="visible"; - */ - }, - - shiftQueue: function() { - if(tweetQueue.length==0) { - $('#tweet-container').html(getDefaultTweet()); - } - if((tweetQueue.length>0) && (!isAnimating)) { - countTweets++; - isAnimating = true; - var q = tweetQueue.shift(); - this.showTweet(q.t, q.anim); - - } - - }, - - skipQueue: function() { - - if((tweetQueue.length>0) && (current_tweet!=null)) { - countTweets++; - isAnimating = true; - $('#tweet_anim_'+ current_tweet.id_str).dequeue(); - TweetAnim.animate(current_tweet, true); - var q = tweetQueue.shift(); - this.showTweet(q.t, true); - } - }, - - showTweet: function(t, anim) { - - var tweetId = "tweet_anim_" + t.id_str; - var imgId = "img_" + t.id_str; - - if(anim) - current_tweet = t; - - var htmlStr = "
    "; - htmlStr += " "; - htmlStr += "
    "; - htmlStr += "
    "; - htmlStr += " "+t.from_user+""; - htmlStr += " "+t.from_user_name+""; - htmlStr += "
    "+t.text+"
    "; - htmlStr += " "; - htmlStr += "
    "; - - $('#tweet-container').html(htmlStr); - $('#nbr-mesure-show').html(countTweets); - $('#nbr-mesure-new').html(tweetQueue.length); - /* - if(tweetQueue.length>0) - document.getElementById('btn-tweet-next').style.visibility="visible"; - else - document.getElementById('btn-tweet-next').style.visibility="hidden"; -*/ - - if(anim) { - TweetAnim.animate(t, true); - - $('#'+tweetId).hover(function() { - $(this).stop(true, true).fadeIn(); - }, function() { - TweetAnim.animate(t, true); - }); - } - }, - - animate: function(t, doSshift) { - var tweetId = "tweet_anim_" + t.id_str; - - t.cat = t.from_user_id%4; - createBallTweetForce(t); - - - // Pour expérimenter le balayage de tout le podium - //setInterval(function() {defaultTweet.cat = b%4; createBallTweetForce(defaultTweet); b++;}, 500); - - - - isAnimating = false; - if(doSshift) - TweetAnim.shiftQueue(); - -/* - toDel.push(t); - current_past_tweet = toDel.length; - ts[t.candidats[0]]++; - checkSilos(); - */ - } -} - - -function getDefaultTweet() { - - var htmlStr = "
    "; - htmlStr += " "; - htmlStr += "
    "; - htmlStr += "
    "; - htmlStr += " Bubble T"; - htmlStr += " tea or tweet ?"; - htmlStr += " "; - htmlStr += "
    maintenant
    "; - - return htmlStr; - -} - -function checkSilos() { - - for(var j=0; jMAX_VOTES) { - j=ts.length+1; - emptySilos(); - } - } -} - - -function emptySilos() { - - var toDel2 = []; - var m =0; - - for(var k=0; k> 1)) + 'px'; element.style.top = (body.m_position0.y - (element.height >> 1)) + 'px'; - - if (element.tagName == 'DIV') { - var rotationStyle = 'rotate(' + (body.m_rotation0 * 57.2957795) + 'deg)'; - text.style.WebkitTransform = rotationStyle; - text.style.MozTransform = rotationStyle; - text.style.OTransform = rotationStyle; - text.style.msTransform = rotationStyle; - } } } function createBox(world, x, y, width, height, fixed) { -var c=document.createElement('canvas'); -var ctx=c.getContext("2d"); -ctx.fillStyle="#FF0000"; -ctx.fillRect(0,0,1500,750); + var c=document.createElement('canvas'); + var ctx=c.getContext("2d"); + ctx.fillStyle="#FF0000"; + ctx.fillRect(0,0,1500,750); if (typeof(fixed) == 'undefined') { fixed = true; @@ -207,49 +113,10 @@ boxBd.AddShape(boxSd); boxBd.position.Set(x,y); - return world.CreateBody(boxBd); } -function mouseDrag() -{ - // mouse press - if (createMode) { - } else if (isMouseDown && !mouseJoint) { - - var body = getBodyAtMouse(); - - if (body) { - var md = new b2MouseJointDef(); - md.body1 = world.m_groundBody; - md.body2 = body; - md.target.Set(mouse.x, mouse.y); - md.maxForce = 30000 * body.m_mass; - md.timeStep = timeStep; - mouseJoint = world.CreateJoint(md); - body.WakeUp(); - } else { - createMode = true; - } - } - - if (!isMouseDown) { // mouse release - - createMode = false; - destroyMode = false; - - if (mouseJoint) { - world.DestroyJoint(mouseJoint); - mouseJoint = null; - } - } - - if (mouseJoint) { // mouse move - var p2 = new b2Vec2(mouse.x, mouse.y); - mouseJoint.SetTarget(p2); - } -} function getBodyAtMouse() { @@ -290,74 +157,42 @@ walls[2] = null; walls[3] = null; } else { - - wall_thickness = 20; - - walls[0] = createBox(world, 1910, 900, wall_thickness, 900); // rightmost wall - walls[1] = createBox(world, 1540, 600, wall_thickness, 300); // wall 4 / 3 - - walls[2] = createBox(world, 1160, 600, wall_thickness, 300); // wall 3 / 2 - walls[3] = createBox(world, 790, 600, wall_thickness, 300); // wall 2 / 1 - walls[4] = createBox(world, 420, 600, wall_thickness, 300); // leftmostwall - - walls[5] = createBox(world, 580, 600, 170, 10); // 4 - walls[6] = createBox(world, 950, 750, 170, 10); // 3 - walls[7] = createBox(world, 1320, 750, 170, 10); // 2 - walls[8] = createBox(world, 1690, 600, 170, 10); // 1 - - setInterval(function() { - - if($('#podium div').size() > 0) { - - $('#podium div').each( function(idx, panel) { - - var idxWall = 5+idx; - var yWall = 945-$(this).height(); - world.DestroyBody(walls[idxWall]); - walls[idxWall] = createBox(world, 580+370*idx, yWall, 170, 10); - - }); - } - }, 1000); - -// walls[6] = createBox(world, 1340, 800, 170, 10); // 3 - - /* - setInterval(function() { + + walls[0] = createBox(world, 1910, 900, wall_thickness, 900); // rightmost wall + walls[1] = createBox(world, 1540, 600, wall_thickness, 300); // wall 4 / 3 + + walls[2] = createBox(world, 1160, 600, wall_thickness, 300); // wall 3 / 2 + walls[3] = createBox(world, 790, 600, wall_thickness, 300); // wall 2 / 1 + walls[4] = createBox(world, 420, 600, wall_thickness, 300); // leftmostwall + + walls[5] = createBox(world, 580, 600, 170, 10); // 4 + walls[6] = createBox(world, 950, 750, 170, 10); // 3 + walls[7] = createBox(world, 1320, 750, 170, 10); // 2 + walls[8] = createBox(world, 1690, 600, 170, 10); // 1 - var tmp = walls[5].m_position.y; - world.DestroyBody(walls[5]); - walls[5] = createBox(world, 1690, tmp-1, 170, 10, true); - - console.log(walls[5].m_position.y); - - }, 1000); - */ - - /* - walls[0] = createBox(world, stage[0] , stage[3] + wall_thickness-32, stage[2], wall_thickness); // bottom wall + setInterval(function() { - walls[2] = createBox(world, stage[2]-400, 850, 50, 100); // middle wall - - // walls[3] = createBox(world, stage[2]-400, 100, wall_thickness, 700); // right wall - walls[3] = createBox(world, 300, 800, 100, 200); // left wall -/* - for (var i = 0; i < candidats.length; i++) { // drawing silos walls - createBox(world, (stage[2]/candidats.length*i)-(wall_thickness/3), stage[3], wall_thickness/3, 200); - } - */ + // Check if div podiums are already loaded + if($('#podium div').size() > 0) { + + $('#podium div').each( function(idx, panel) { + + var idxWall = 5+idx; + var yWall = 920-$(this).height(); + world.DestroyBody(walls[idxWall]); + walls[idxWall] = createBox(world, 580+370*idx, yWall, 170, 10); + + }); + } + }, 1000); } } function createBallTweetForce(t) { - - var xpos = 40; - var ypos = 70; - var element = document.createElement( 'div' ); - element.width = BALL_SIZE; - element.height = BALL_SIZE; + element.width = 96; + element.height = 96; element.style.position = 'absolute'; element.style.left = -200 + 'px'; element.style.top = -200 + 'px'; @@ -366,93 +201,39 @@ element.id = t.id_str; var id = "tweet_"+bodies.length; -var canvas = document.getElementById( 'canvas' ); + var canvas = document.getElementById('canvas'); canvas.appendChild(element); elements.push( element ); - $("#"+t.id_str).mouseover(function() { - - $(this).fadeTo(250, 0.1); - $("#tooltip-bulle .tweet-screen-name").text(t.from_user); - $("#tooltip-bulle .tweet-full-name").text(t.from_user_name); - $("#tooltip-bulle .tweet-text").text(t.text); - $("#tooltip-bulle .tweet-time").text(t.created_at); - $("#tooltip-bulle .tweet-img-avatar").attr( 'src' , t.profile_image_url ); - var thisX = parseInt($(this).css('left'),10)+10; -// console.log(thisX);//visibility:hidden - $('#bulle-tooltip-template').css('visibility','visible'); - //$('#bulle-tooltip-template').css('top', thisX).css('left', thisY); - $(this).css('cursor','pointer'); - if(thisX<960/2){ - $('#accolade-left').css('visibility','visible'); - }else{ - $('#accolade-right').css('visibility','visible'); - } - - }); - - $("#"+t.id_str).mouseout(function() { - $('#bulle-tooltip-template').css('visibility','hidden'); - $('#accolade-right').css('visibility','hidden'); - $('#accolade-left').css('visibility','hidden'); - $(this).css('cursor','auto'); - - $(this).dequeue(); - $(this).fadeTo(250, 0.8); - }); - - $("#"+t.id_str).click(function() { - if(!isMouseDragging) { - fancyBoxTwitter(t.from_user, (t.candidats && t.candidats.length ? candidats[t.candidats[0]].couleur : '#666699')); -// window.open("https://twitter.com/#!/"+t.from_user+"/status/"+t.id_str); - } - }); - BALL_SIZE = 150; var circle = document.createElement('canvas'); - circle.width = BALL_SIZE; - circle.height = BALL_SIZE; + circle.width = 96; + circle.height = 96; var offset = (48 - BALL_SIZE)/2; var graphics = circle.getContext('2d'); - graphics.fillStyle = "white"; - graphics.beginPath(); - graphics.arc(BALL_SIZE* .25+10, BALL_SIZE* .25, BALL_SIZE* .25, 0, PI2, true); - graphics.closePath(); - graphics.fill(); + graphics.fillStyle = "white"; + graphics.beginPath(); + graphics.arc(BALL_SIZE* .25+10, BALL_SIZE* .25, BALL_SIZE* .25, 0, PI2, true); + graphics.closePath(); + graphics.fill(); graphics.fillStyle = "#E2F0D6"; graphics.beginPath(); graphics.arc(BALL_SIZE * .5 +offset+24, BALL_SIZE * .5+offset+14, BALL_SIZE * .20, 0, PI2, true); graphics.closePath(); graphics.fill(); - - var size = BALL_SIZE; -// for (var i = size; i > 0; i-= (size/10)) { - - - - // } - - /* ORIGIN - graphics.fillStyle = "#E2F0D6"; - graphics.beginPath(); - graphics.arc(BALL_SIZE * .5 +offset, BALL_SIZE * .5+offset, BALL_SIZE * .25, 0, PI2, true); - graphics.closePath(); - graphics.fill(); - - */ var img = new Image(); img.src = t.profile_image_url; img.onload = function(){ - + + // Resize image var canvasCopy = document.createElement("canvas"); var copyContext = canvasCopy.getContext("2d"); - canvasCopy.width = 96; canvasCopy.height = 96; copyContext.drawImage(img, 0, 0, 96, 96); @@ -460,109 +241,80 @@ var ptrn = graphics.createPattern(canvasCopy,'no-repeat'); graphics.fillStyle = ptrn; graphics.fill(-5,0,150,150); - } - - - element.appendChild( circle ); + element.appendChild(circle); - text = document.createElement( 'div' ); - text.onSelectStart = null; - text.style.color = "#95AB63"; - text.style.position = 'absolute'; - text.style.left = '0px'; - text.style.top = '0px'; - text.style.fontFamily = 'Georgia'; - text.style.textAlign = 'center'; - element.appendChild(text); - var circle = new b2CircleDef(); circle.radius = BALL_SIZE/4+2 ; circle.density = 1; circle.friction = 0.3; circle.restitution = 0.3; - - var b2body = new b2BodyDef(); - b2body.AddShape(circle); - b2body.userData = {element: element}; - b2body.position.Set( xpos, ypos); - - var a, b; + + var a, b, xpos, ypos; switch (t.cat) { case 0: // 1 - a = 150; + a = 250; b = -100; + xpos = 40; + ypos = 250; break; case 1: // 2 a = 250; b = -150; + xpos = 40; + ypos = 70; break; case 2: // 3 - a = 350; - b = -100; + a = 290; + b = -180; + xpos = 40; + ypos = 100; break; case 3: // 4 - a = 390; - b = -180; - break; - /* - case 4: // Jean-Pierre Chevènement - a = 390; + a = 400; b = -180; - break; - - case 5: // Eva Joly - a = 170; - b = -30; - break; - case 6: // Corinne Lepage - a = 200; - b = -40; - break; - case 7: // François Bayrou - a = 200; - b = -60; - break; - case 8: // Hervé Morin - a = 230; - b = -60; - break; - case 9: // Dominique de Villepin - a = 260; - b = -60; - break; - case 10: // Nicolas Sarkozy - a = 290; - b = -60; + xpos = 40; + ypos = 150; break; - case 11: // Nicolas Dupont-Aignan - a = 300; - b = -70; - break; - case 12: // Frederic Nihous - a = 320; - b = -70; - break; - case 13: // Christine Boutin - a = 350; - b = -70; - break; - case 14: // Marine Le pen - a = 390; - b = -80; - break; - default: a = 390; b = -180; - console.log("default impulse!"); + xpos = 40; + ypos = 70; + console.log("DEFAULT IMPULS PARAMS! Should not be there.."); break; - */ } + var b2body = new b2BodyDef(); + b2body.AddShape(circle); + b2body.userData = {element: element}; + b2body.position.Set( xpos, ypos); + b2body.linearVelocity.Set(a, b); b2bod[t.id_str] = world.CreateBody(b2body); + console.log("created " + t.id_str) bodies.push(b2bod[t.id_str]); + + $("#"+t.id_str).mouseover(function() { + var _of = $(this).offset(); + $(this).css({ + "cursor": "pointer" + }); + showTooltip(t, _of.left, _of.top); + }).mouseout(hideTooltip).click(function() { + addTweetToSelection(t.id_str); + $(this).fadeTo(100,.25, function() { + $(this).fadeTo(100,1); + showControlPanel(); + }) + }); + +/* $("#"+t.id_str).click(function() { + if(!isMouseDragging) { + fancyBoxTwitter(t.from_user, (t.candidats && t.candidats.length ? candidats[t.candidats[0]].couleur : '#666699')); +// window.open("https://twitter.com/#!/"+t.from_user+"/status/"+t.id_str); + } + }); */ } \ No newline at end of file diff -r 80040858c006 -r 7b76d97e3051 client/main.html --- a/client/main.html Tue Feb 21 22:46:45 2012 +0100 +++ b/client/main.html Tue Feb 21 22:47:19 2012 +0100 @@ -13,7 +13,6 @@ - @@ -38,8 +37,7 @@ -
    - +
    @@ -89,6 +87,8 @@
    +
    +