| author | Raphael Velt <raph.velt@gmail.com> |
| Wed, 14 Dec 2011 18:23:08 +0100 | |
| changeset 412 | 97c082990f8d |
| parent 408 | 4141c5821c98 |
| parent 410 | bf5cf5a9e737 |
| child 420 | eb7c2cff1816 |
| permissions | -rw-r--r-- |
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1 |
var socket, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
2 |
tlPaper, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
3 |
twCx = { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
4 |
followLast : true, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
5 |
position : "0", |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
6 |
date_levels : [ |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
7 |
3600 * 1000, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
8 |
15 * 60 * 1000, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
9 |
5 * 60 * 1000, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
10 |
60 * 1000 |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
11 |
], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
12 |
timeLevel : 1, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
13 |
deltaX : 40, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
14 |
tlWidth : 150, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
15 |
tlHeight : 480, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
16 |
globalWords : {}, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
17 |
refMouse : { x : 0, y : 0}, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
18 |
refPosTl : { x : 0, y : 0}, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
19 |
tlMouseMoved : false, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
20 |
tlMouseClicked : false, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
21 |
filtre : null |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
22 |
}, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
23 |
tlBuffer = '', |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
24 |
relHover = [], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
25 |
wheelDelta = 0, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
26 |
scrollEnabled = false, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
27 |
scrollExtent = 8000 - 480, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
28 |
lastScrollPos = 0, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
29 |
rx_url = /https?:\/\/[0-9a-zA-Z\.%\/-_]+/g, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
30 |
rx_word = /[^ \.&;,'"!\?\d\(\)\+\[\]\\\…\-«»:\/]{3,}/g, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
31 |
stop_list = [ 'and', 'avec', 'aux', 'car', 'comme', 'dans', 'donc', 'des', 'elle', 'est', 'être', 'eux', 'ils', 'les', 'leur', 'leurs', 'mes', 'mon', 'tes', 'ton', 'notre', 'nos', 'nous', 'ont', 'pas', 'que', 'qui', 'sont', 'the', 'une', 'votre', 'vos', 'vous' ], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
32 |
l10n = { "rechercher" : "Rechercher" }; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
33 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
34 |
function getColor(annotation, lum) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
35 |
return Raphael.hsl2rgb(annotations[annotation].colors.h, annotations[annotation].colors.s, lum); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
36 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
37 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
38 |
function tweetPopup(url) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
39 |
var popW = 550, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
40 |
popH = 350, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
41 |
scrW = screen.width, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
42 |
scrH = screen.height, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
43 |
posX = Math.round((scrW/2)-(popW/2)), |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
44 |
posY = (scrH > popH ? Math.round((scrH/2)-(popH/2)) : 0); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
45 |
window.open(url, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
46 |
'', |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
47 |
'left=' + posX + ',top=' + posY + ',width=' + popW + ',height=' + popH + ',personalbar=0,toolbar=0,scrollbars=1,resizable=1'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
48 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
49 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
50 |
function arc(source, target) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
51 |
var x3 = .3 * target.y - .3 * source.y + .8 * source.x + .2 * target.x; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
52 |
var y3 = .8 * source.y + .2 * target.y - .3 * target.x + .3 * source.x; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
53 |
var x4 = .3 * target.y - .3 * source.y + .2 * source.x + .8 * target.x; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
54 |
var y4 = .2 * source.y + .8 * target.y - .3 * target.x + .3 * source.x; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
55 |
return "M" + source.x + " " + source.y + "C" + [x3, y3, x4, y4, target.x, target.y].join(" "); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
56 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
57 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
58 |
function addTweet(tweet) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
59 |
function backRef(source_id, target_id, type) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
60 |
var target = tweetById(target_id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
61 |
if (target) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
62 |
var brobj = { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
63 |
"referenced_by_id" : source_id, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
64 |
"type" : type |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
65 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
66 |
if (target.backRefs) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
67 |
target.backRefs.push(brobj); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
68 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
69 |
target.backRefs = [ brobj ] |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
70 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
71 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
72 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
73 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
74 |
if (twCx.idIndex.indexOf(tweet.id) != -1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
75 |
return; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
76 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
77 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
78 |
var txt_date = tweet.created_at; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
79 |
if (navigator.userAgent.search(/MSIE/) != -1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
80 |
txt_date = txt_date.replace(/( \+)/, ' UTC$1'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
81 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
82 |
tweet.date_value = Date.parse(txt_date); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
83 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
84 |
var tab = tweet.text.match(/\&\#[0-9]+\;/g); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
85 |
for (var i in tab) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
86 |
var n = parseInt(tab[i].substr(2)); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
87 |
if (n != NaN) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
88 |
tweet.text = tweet.text.replace(tab[i], String.fromCharCode(n)); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
89 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
90 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
91 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
92 |
var ann = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
93 |
for (var j in annotations) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
94 |
if (j != "default") { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
95 |
for (var k in annotations[j].keywords) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
96 |
if (tweet.text.search(annotations[j].keywords[k]) != -1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
97 |
ann.push(j); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
98 |
break; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
99 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
100 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
101 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
102 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
103 |
tweet.annotations = ann; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
104 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
105 |
if (tweet.in_reply_to_status_id) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
106 |
backRef( tweet.id, tweet.in_reply_to_status_id, "reply" ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
107 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
108 |
if (tweet.retweeted_status) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
109 |
backRef( tweet.id, tweet.retweeted_status.id, "retweet" ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
110 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
111 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
112 |
var localWords = [] |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
113 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
114 |
var tab = tweet.text.replace(rx_url,'').match(rx_word); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
115 |
for (var i in tab) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
116 |
var word = tab[i].toLowerCase(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
117 |
if (stop_list.indexOf(word) == -1 && tracking_keywords.indexOf(word) == -1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
118 |
if (twCx.globalWords[word]) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
119 |
twCx.globalWords[word]++; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
120 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
121 |
twCx.globalWords[word] = 1; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
122 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
123 |
localWords.push(word); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
124 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
125 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
126 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
127 |
tweet.words = localWords; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
128 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
129 |
var p = twCx.idIndex.length; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
130 |
while (p && tweet.id < twCx.idIndex[p-1]) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
131 |
p--; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
132 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
133 |
twCx.tweets.splice(p, 0, tweet); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
134 |
twCx.idIndex.splice(p, 0, tweet.id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
135 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
136 |
if (!twCx.timeline.length) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
137 |
twCx.timeline = [ populateDateStruct(0, twCx.date_levels[0] * parseInt(tweet.date_value / twCx.date_levels[0])) ] |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
138 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
139 |
while (tweet.date_value > twCx.timeline[twCx.timeline.length - 1].end) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
140 |
twCx.timeline.push( populateDateStruct(0, twCx.timeline[twCx.timeline.length - 1].end) ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
141 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
142 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
143 |
insertIntoDateStruct(twCx.timeline, tweet); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
144 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
145 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
146 |
function getSliceContent(slice) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
147 |
if (slice.slices) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
148 |
var result = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
149 |
for (var i in slice.slices) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
150 |
result = result.concat(getSliceContent(slice.slices[i])); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
151 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
152 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
153 |
var result = slice.tweets; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
154 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
155 |
return result; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
156 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
157 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
158 |
function flattenDateStruct(slices, target_level) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
159 |
var current_level = slices[0].level, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
160 |
result = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
161 |
if (current_level < target_level) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
162 |
if (slices[0].slices) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
163 |
for (var i in slices) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
164 |
result = result.concat(flattenDateStruct(slices[i].slices, target_level)); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
165 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
166 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
167 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
168 |
else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
169 |
for (var i in slices) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
170 |
result.push({ |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
171 |
"start" : slices[i].start, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
172 |
"end" : slices[i].end, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
173 |
"tweets" : getSliceContent(slices[i]) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
174 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
175 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
176 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
177 |
return result; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
178 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
179 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
180 |
function trimFDS() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
181 |
var slices = flattenDateStruct(twCx.timeline, twCx.timeLevel); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
182 |
while (slices[0].tweets.length == 0) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
183 |
slices.splice(0,1); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
184 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
185 |
while (slices[slices.length - 1].tweets.length == 0) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
186 |
slices.pop(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
187 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
188 |
var centralTweet = ( twCx.centralTweet ? twCx.centralTweet : twCx.tweets[twCx.tweets.length - 1] ), |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
189 |
delta = 30 * twCx.date_levels[twCx.timeLevel], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
190 |
centre = Math.min(slices[slices.length - 1].end - delta , Math.max(slices[0].start + delta, centralTweet.date_value)), |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
191 |
min = centre - delta, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
192 |
max = centre + delta; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
193 |
while (slices[0].start < min) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
194 |
slices.splice(0,1); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
195 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
196 |
while (slices[slices.length - 1].end > max) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
197 |
slices.pop(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
198 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
199 |
return slices; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
200 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
201 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
202 |
function populateDateStruct(level, start) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
203 |
var end = start + twCx.date_levels[level], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
204 |
struct = { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
205 |
"level" : level, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
206 |
"start" : start, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
207 |
"end" : end |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
208 |
}; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
209 |
if (level < twCx.date_levels.length - 1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
210 |
struct.slices = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
211 |
var newstart = start; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
212 |
while (newstart < end) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
213 |
struct.slices.push(populateDateStruct(level + 1, newstart)); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
214 |
newstart += twCx.date_levels[level + 1]; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
215 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
216 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
217 |
struct.tweets = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
218 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
219 |
return struct; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
220 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
221 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
222 |
function insertIntoDateStruct(slices, tweet) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
223 |
var creadate = tweet.date_value; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
224 |
for (var i in slices) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
225 |
if (creadate < slices[i].end) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
226 |
if (slices[i].slices) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
227 |
insertIntoDateStruct(slices[i].slices, tweet); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
228 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
229 |
slices[i].tweets.push(tweet.id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
230 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
231 |
break; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
232 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
233 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
234 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
235 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
236 |
function placeHolder(className) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
237 |
return '<li class="placeholder ' + className + '"></li>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
238 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
239 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
240 |
function tweetById(tweetid) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
241 |
var pos = twCx.idIndex.indexOf(tweetid); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
242 |
return (pos == -1) ? false : twCx.tweets[pos]; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
243 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
244 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
245 |
function selectTweet(tweetid) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
246 |
twCx.position = tweetid; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
247 |
twCx.followLast = (twCx.position == twCx.idIndex[twCx.tweets.length - 1]); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
248 |
updateDisplay(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
249 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
250 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
251 |
function goToPos(nPos) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
252 |
twCx.position = twCx.currentIdIndex[Math.min( twCx.currentIdIndex.length - 1, Math.max(0, nPos ) )]; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
253 |
twCx.followLast = (!twCx.filtre && nPos == twCx.tweets.length - 1); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
254 |
updateDisplay(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
255 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
256 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
257 |
function movePos(delta) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
258 |
goToPos( delta + twCx.currentIdIndex.indexOf(twCx.position) ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
259 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
260 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
261 |
function tweetToHtml(tweet, className, elName) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
262 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
263 |
function highlight(texte) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
264 |
return ( twCx.filtre ? texte.replace(twCx.filtre, '<span class="highlight">$1</span>' ) : texte ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
265 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
266 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
267 |
if (!tweet) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
268 |
return placeHolder(className); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
269 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
270 |
var el = (elName ? elName : 'li'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
271 |
var html = '<' + el + ' class="tweet ' + className + '" id="tweet_' + tweet.id + '"'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
272 |
if (className != 'full') { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
273 |
html += ' onclick="selectTweet(\'' + tweet.id + '\'); return false;"'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
274 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
275 |
html += ' onmouseover="rolloverTweet(\'' + tweet.id + "', " + ( className == 'icons' ) + ');"'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
276 |
if (twCx.followLast && className == 'full' && el == 'li') { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
277 |
html += ' style="display: none"'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
278 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
279 |
html += '>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
280 |
if (tweet.annotations.length) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
281 |
html += '<div class="annotations">'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
282 |
for (var i in tweet.annotations) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
283 |
html += '<div class="annotation" style="width:' + (100/tweet.annotations.length) + '%; background:' + getColor(tweet.annotations[i], (className == 'icons' ? .4 : .85)).hex + '"></div>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
284 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
285 |
html += '</div>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
286 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
287 |
html += '<div class="twmain">'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
288 |
var a_user = '<a href="http://twitter.com/' + tweet.user.screen_name + '" onclick="filtrerTexte(\'@' + tweet.user.screen_name + '\'); return false;" target="_blank">'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
289 |
html += '<div class="around_img">' + a_user + '<img class="profile_image" src="' + tweet.user.profile_image_url + '" /></a>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
290 |
if (className == 'full') { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
291 |
html += '<p class="created_at">' + new Date(tweet.date_value).toTimeString().substr(0,8) + '</a></p>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
292 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
293 |
html += '</div>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
294 |
if (className != 'icons') { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
295 |
lastend = 0; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
296 |
var txt = '', |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
297 |
entities = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
298 |
for (var i in tweet.entities.hashtags) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
299 |
entities.push({ |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
300 |
"start" : tweet.entities.hashtags[i].indices[0], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
301 |
"end" : tweet.entities.hashtags[i].indices[1], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
302 |
"link" : '<a href="http://twitter.com/search?q=%23' + tweet.entities.hashtags[i].text + '" onclick="filtrerTexte(\'#' + tweet.entities.hashtags[i].text + '\'); return false;" target="_blank">', |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
303 |
"text" : '#' + tweet.entities.hashtags[i].text |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
304 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
305 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
306 |
for (var i in tweet.entities.urls) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
307 |
var linkurl = ( tweet.entities.urls[i].expanded_url ? tweet.entities.urls[i].expanded_url : tweet.entities.urls[i].url ), |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
308 |
dispurl = linkurl.replace(/https?:\/\//,''); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
309 |
if (linkurl.search(/https?:\/\//) == -1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
310 |
linkurl = 'http://' + linkurl; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
311 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
312 |
entities.push({ |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
313 |
"start" : tweet.entities.urls[i].indices[0], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
314 |
"end" : tweet.entities.urls[i].indices[1], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
315 |
"link" : '<a href="' + linkurl + '" target="_blank">', |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
316 |
"text" : dispurl |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
317 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
318 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
319 |
for (var i in tweet.entities.user_mentions) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
320 |
entities.push({ |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
321 |
"start" : tweet.entities.user_mentions[i].indices[0], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
322 |
"end" : tweet.entities.user_mentions[i].indices[1], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
323 |
"link" : '<a href="http://twitter.com/' + tweet.entities.user_mentions[i].screen_name + '" onclick="filtrerTexte(\'@' + tweet.entities.user_mentions[i].screen_name + '\'); return false;" target="_blank">', |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
324 |
"text" : '@' + tweet.entities.user_mentions[i].screen_name |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
325 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
326 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
327 |
entities.sort(function(a, b) { return a.start - b.start }); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
328 |
for (var i in entities) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
329 |
txt += highlight( tweet.text.substring(lastend, entities[i].start) ) + entities[i].link + highlight( entities[i].text ) + '</a>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
330 |
lastend = entities[i].end; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
331 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
332 |
txt += highlight( tweet.text.substring(lastend) ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
333 |
html += '<p class="tweet_text"><b>' + a_user + highlight('@' + tweet.user.screen_name) + '</a>' + ( className == 'full' ? ' (' + tweet.user.name + ')</b><br />' : '</b> : ') + txt + '</p>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
334 |
if (className == 'full' && el == 'li') { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
335 |
html += '<div class="tweet_actions"><a href="http://twitter.com/' + tweet.user.screen_name + '/status/' + tweet.id + '" onclick="tweetPopup(this.href); return false;" target="_blank">afficher tweet</a> - '; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
336 |
html += '<a href="http://twitter.com/intent/tweet?in_reply_to=' + tweet.id + '" onclick="tweetPopup(this.href); return false;" target="_blank">répondre</a> · '; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
337 |
html += '<a href="http://twitter.com/intent/retweet?tweet_id=' + tweet.id + '" onclick="tweetPopup(this.href); return false;" target="_blank">retweeter</a> · '; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
338 |
html += '<a href="http://twitter.com/intent/favorite?tweet_id=' + tweet.id + '" onclick="tweetPopup(this.href); return false;" target="_blank">favori</a></div>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
339 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
340 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
341 |
html += '</div></' + el + '>'; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
342 |
return html; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
343 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
344 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
345 |
function tlIdFromPos(x, y, outside) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
346 |
if (!twCx.tlOnDisplay) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
347 |
return; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
348 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
349 |
var ligne = Math.min( twCx.tlOnDisplay.length - 1, Math.max( 0, Math.floor(( twCx.tlHeight - y ) / twCx.scaleY) ) ), |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
350 |
colonne = Math.floor(( x - twCx.deltaX ) / twCx.scaleX ), |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
351 |
l = 0; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
352 |
if (colonne >= twCx.tlOnDisplay[ligne].totalTweets || colonne < 0 ) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
353 |
if (outside) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
354 |
colonne = Math.min( twCx.tlOnDisplay[ligne].totalTweets - 1, Math.max( 0, colonne )); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
355 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
356 |
return null; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
357 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
358 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
359 |
for (var i in twCx.tlOnDisplay[ligne].displayData) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
360 |
var nl = l + twCx.tlOnDisplay[ligne].displayData[i].length; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
361 |
if (colonne < nl) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
362 |
return { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
363 |
"id" : twCx.tlOnDisplay[ligne].displayData[i][colonne - l], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
364 |
"annotation" : i |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
365 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
366 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
367 |
l = nl; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
368 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
369 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
370 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
371 |
function tlPosTweet(tweet, annotation) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
372 |
if (!twCx.tweets) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
373 |
return; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
374 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
375 |
var x, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
376 |
y, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
377 |
dt = tweet.date_value, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
378 |
ann = ( annotation ? annotation : ( tweet.annotations.length ? tweet.annotations[0] : 'default' ) ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
379 |
for (var i = 0; i < twCx.tlOnDisplay.length; i++) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
380 |
if (twCx.tlOnDisplay[i].end > dt) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
381 |
y = twCx.tlHeight - (i + .5) * twCx.scaleY; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
382 |
var l = 0; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
383 |
for (var j in twCx.tlOnDisplay[i].displayData) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
384 |
if (j == ann) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
385 |
var p = twCx.tlOnDisplay[i].displayData[j].indexOf(tweet.id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
386 |
if (p != -1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
387 |
x = twCx.deltaX + twCx.scaleX * ( p + l + .5 ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
388 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
389 |
break; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
390 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
391 |
l += twCx.tlOnDisplay[i].displayData[j].length; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
392 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
393 |
break; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
394 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
395 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
396 |
return ( x && y ? { "x" : x, "y" : y } : null); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
397 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
398 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
399 |
function rolloverTweet(tweetid, showPopup, annotation) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
400 |
var t = tweetById(tweetid); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
401 |
if (!t) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
402 |
return; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
403 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
404 |
var p = tlPosTweet(t, annotation); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
405 |
if (!p) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
406 |
return; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
407 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
408 |
var ptl = $("#timeline").offset(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
409 |
if (showPopup) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
410 |
$("#hovercontent").html(tweetToHtml(t, 'full', 'div')); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
411 |
$("#hovertweet").css({ |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
412 |
"left" : parseInt(ptl.left + p.x) + "px", |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
413 |
"top" : parseInt(ptl.top + p.y), |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
414 |
"display" : "block"}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
415 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
416 |
$("#hovertweet").hide(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
417 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
418 |
for (var i in relHover) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
419 |
relHover[i].remove(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
420 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
421 |
relHover = drawTweetArcs(t, p, '#303030'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
422 |
relHover.push(drawTweetPos(p, '#ffffff')); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
423 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
424 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
425 |
function drawTweetPos(pos, color) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
426 |
var rel = tlPaper.rect(pos.x - .5 * twCx.scaleX, pos.y - .5 * twCx.scaleY, twCx.scaleX, twCx.scaleY); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
427 |
rel.attr({ "stroke" : color, "fill" : color, "fill-opacity" : .25 }); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
428 |
return rel; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
429 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
430 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
431 |
function drawTweetArcs(tweet, pos, color) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
432 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
433 |
var res = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
434 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
435 |
function tweetAndArc(a, b, aorb) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
436 |
if (a && b) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
437 |
res.push(drawTweetPos(aorb ? a : b, color)); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
438 |
var aa = tlPaper.path(arc(a,b)) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
439 |
.attr({ "stroke" : color, "stroke-width" : 1.5, "stroke-opacity" : .8 }); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
440 |
res.push(aa); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
441 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
442 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
443 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
444 |
if (tweet.retweeted_status) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
445 |
var t = tweetById(tweet.retweeted_status.id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
446 |
if (t) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
447 |
tweetAndArc(pos, tlPosTweet(t)); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
448 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
449 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
450 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
451 |
if (tweet.in_reply_to_status_id) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
452 |
var t = tweetById(tweet.in_reply_to_status_id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
453 |
if (t) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
454 |
tweetAndArc(pos, tlPosTweet(t)); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
455 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
456 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
457 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
458 |
if (tweet.backRefs) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
459 |
for (var i in tweet.backRefs) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
460 |
var t = tweetById(tweet.backRefs[i].referenced_by_id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
461 |
if (t) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
462 |
tweetAndArc(tlPosTweet(t), pos, true); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
463 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
464 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
465 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
466 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
467 |
return res; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
468 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
469 |
|
| 407 | 470 |
function mouseoverkw() { |
471 |
var _jel = $(this), |
|
472 |
_off = _jel.offset(); |
|
473 |
_jel.css({ |
|
474 |
color: "#0099ff" |
|
475 |
}); |
|
476 |
$("#hoverkw") |
|
477 |
.css({ |
|
478 |
"left" : _off.left + "px", |
|
479 |
"top" : ( parseInt(_off.top) + ~~ (_jel.height() / 2) ) + "px", |
|
480 |
"display" : "block" |
|
481 |
}) |
|
482 |
.attr("kw", _jel.text()); |
|
483 |
} |
|
484 |
||
485 |
function mouseoutkw() { |
|
486 |
$("#hoverkw").hide(); |
|
487 |
$(this).css({ |
|
488 |
color: "#000000" |
|
489 |
}); |
|
490 |
} |
|
491 |
||
492 |
function makeTagCloud(tab, div) { |
|
493 |
var minfreq = _(tab).min( function(a) { return a.freq} ).freq, |
|
494 |
maxfreq = Math.max(minfreq + .1, _(tab).max( function(a) { return a.freq} ).freq), |
|
495 |
echfreq = 8 / Math.sqrt( maxfreq - minfreq ), |
|
496 |
html = ''; |
|
497 |
_(tab).each(function(_j) { |
|
498 |
var maxann = 0, |
|
499 |
ann = "default"; |
|
500 |
for (var k in _j.annotations) { |
|
501 |
if (_j.annotations[k] == maxann) { |
|
502 |
ann = "default"; |
|
503 |
} |
|
504 |
if (_j.annotations[k] > maxann) { |
|
505 |
ann = k; |
|
506 |
maxann = _j.annotations[k]; |
|
507 |
} |
|
508 |
} |
|
509 |
if (ann == "default") { |
|
510 |
var coul = ''; |
|
511 |
} else { |
|
512 |
var c = getColor(ann, .6), |
|
513 |
coul = "background: rgba(" + [ Math.floor(c.r), Math.floor(c.g), Math.floor(c.b), ( _j.annotations[ann] / _j.freq )].join(',') + ")"; |
|
514 |
} |
|
515 |
var fontsize = Math.floor( ( 12 + Math.sqrt( _j.freq - minfreq ) * echfreq ) ); |
|
516 |
html += '<span style="line-height: ' + (8 + fontsize) + 'px; font-size: ' + fontsize + 'px;' + coul + '">' + _j.word + '</span> '; |
|
517 |
}); |
|
518 |
$(div).html(html); |
|
519 |
$(div + " span") |
|
520 |
.mouseover(mouseoverkw) |
|
521 |
.mouseout(mouseoutkw) |
|
522 |
.click(function() { |
|
523 |
$("#hoverkw").toggle(); |
|
524 |
}); |
|
525 |
} |
|
526 |
||
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
527 |
function updateDisplay() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
528 |
if (!twCx.tweets) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
529 |
return; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
530 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
531 |
if (twCx.filtre) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
532 |
var tweets = twCx.tweets.filter(function(tweet) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
533 |
var mention = '@' + tweet.user.screen_name; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
534 |
return ( tweet.text.search(twCx.filtre) != -1 ) || ( mention.search(twCx.filtre) != -1 ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
535 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
536 |
$("#inp_q").val(twCx.filtreTexte + ' (' + tweets.length + ' tweets)'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
537 |
if (tweets.length) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
538 |
var idIndex = tweets.map(function(tweet) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
539 |
return tweet.id; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
540 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
541 |
var p = idIndex.indexOf(twCx.position); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
542 |
if (p == -1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
543 |
for (p = idIndex.length - 1; p > 0 && idIndex[p] > twCx.position; p--) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
544 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
545 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
546 |
twCx.position = idIndex[p]; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
547 |
twCx.currentIdIndex = idIndex; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
548 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
549 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
550 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
551 |
twCx.currentIdIndex = twCx.idIndex; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
552 |
var tweets = twCx.tweets; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
553 |
var p = twCx.idIndex.indexOf(twCx.position); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
554 |
if (p == -1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
555 |
p = (twCx.followLast ? twCx.idIndex.length - 1 : 0); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
556 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
557 |
} |
|
408
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
558 |
|
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
559 |
|
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
560 |
if (suggested_keywords && suggested_keywords.length) { |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
561 |
var _skw = suggested_keywords.map(function(_e) { |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
562 |
return { |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
563 |
"word" : _e, |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
564 |
"rgxp" : new RegExp(_e, "im"), |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
565 |
"freq" : 0, |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
566 |
"annotations" : {} |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
567 |
} |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
568 |
}) |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
569 |
} |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
570 |
|
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
571 |
var l = tweets.length, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
572 |
lines = 0, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
573 |
ppy = 0, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
574 |
html = '', |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
575 |
tweetsOnDisplay = [], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
576 |
localWords = {}; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
577 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
578 |
function pushTweet(tp, className) { |
|
408
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
579 |
|
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
580 |
if (tp < l && tp >= 0) { |
|
408
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
581 |
|
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
582 |
if (_skw) { |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
583 |
_(_skw).each(function(_k) { |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
584 |
if (tweets[tp].text.search(_k.rgxp) != -1) { |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
585 |
_k.freq++; |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
586 |
_(tweets[tp].annotations).each(function(_a) { |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
587 |
_k.annotations[_a] = 1 + ( _k.annotations[_a] || 0 ) |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
588 |
}) |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
589 |
} |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
590 |
}); |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
591 |
} |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
592 |
|
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
593 |
html += tweetToHtml(tweets[tp], className); |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
594 |
|
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
595 |
tweetsOnDisplay.push(tp); |
|
408
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
596 |
|
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
597 |
for (var i in tweets[tp].words) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
598 |
var w = tweets[tp].words[i]; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
599 |
if (localWords[w]) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
600 |
localWords[w].freq++ |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
601 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
602 |
localWords[w] = { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
603 |
"freq" : 1, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
604 |
"annotations" : {} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
605 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
606 |
for (var j in annotations) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
607 |
if (j != 'default') { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
608 |
localWords[w].annotations[j] = 0; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
609 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
610 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
611 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
612 |
for (var j in tweets[tp].annotations) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
613 |
localWords[w].annotations[tweets[tp].annotations[j]]++; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
614 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
615 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
616 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
617 |
html += placeHolder(className); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
618 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
619 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
620 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
621 |
if (l) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
622 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
623 |
lastScrollPos = Math.floor( scrollExtent * ( 1 - ( p / l ) ) ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
624 |
$("#scrollcont").scrollTop(lastScrollPos); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
625 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
626 |
if (l > p + 18) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
627 |
lines++; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
628 |
ppy += 20; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
629 |
for (var i = p + 31; i >= p + 18; i--) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
630 |
pushTweet(i, 'icons'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
631 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
632 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
633 |
if (l > p + 4) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
634 |
lines++; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
635 |
ppy += 20; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
636 |
for (var i = p + 17; i >= p + 4; i--) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
637 |
pushTweet(i, 'icons'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
638 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
639 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
640 |
for (var k = 3; k >= 1; k--) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
641 |
if (l > p + k) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
642 |
ppy += 47; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
643 |
lines++; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
644 |
pushTweet(p + k, 'half'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
645 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
646 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
647 |
pushTweet(p, 'full'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
648 |
var n = p - 1; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
649 |
for (var i = 0; i < Math.min(6, Math.max(3, 6 - lines)); i++) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
650 |
if (n < 0) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
651 |
break; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
652 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
653 |
pushTweet(n, 'half'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
654 |
n--; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
655 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
656 |
for (var i = 0; i < 14 * Math.min(4, Math.max(2, 7 - lines)); i++) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
657 |
if (n < 0) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
658 |
break; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
659 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
660 |
pushTweet(n, 'icons'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
661 |
n--; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
662 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
663 |
if (html != tlBuffer) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
664 |
$("#tweetlist").html(html); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
665 |
$(".tweet.full").fadeIn(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
666 |
tlBuffer = html; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
667 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
668 |
|
|
408
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
669 |
if (_skw) { |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
670 |
makeTagCloud(_skw, "#suggkw"); |
|
4141c5821c98
Improvements on PT live client
Raphael Velt <raph.velt@gmail.com>
parents:
407
diff
changeset
|
671 |
} |
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
672 |
/* Recherche des mots pertinents correspondant à la sélection */ |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
673 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
674 |
var tab = _(localWords).map(function(v, k) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
675 |
return { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
676 |
"word": k, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
677 |
"freq" : v.freq, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
678 |
"annotations" : v.annotations, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
679 |
"score" : v.freq / Math.log( 2 + twCx.globalWords[j] ) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
680 |
}; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
681 |
}).filter(function(v) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
682 |
return v.freq > 1; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
683 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
684 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
685 |
if (tab.length) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
686 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
687 |
tab = _(tab).sortBy( function(a) { return ( - a.score ) }).slice(0,20); |
| 407 | 688 |
makeTagCloud(tab,"#motscles"); |
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
689 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
690 |
$("#motscles").html(''); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
691 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
692 |
twCx.centralTweet = tweets[p]; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
693 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
694 |
$("#tweetlist").html(''); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
695 |
tlBuffer = ''; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
696 |
$("#motscles").html(''); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
697 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
698 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
699 |
twCx.tlOnDisplay = trimFDS(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
700 |
twCx.scaleY = twCx.tlHeight / twCx.tlOnDisplay.length; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
701 |
var maxTweets = 0, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
702 |
startTl = 0, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
703 |
endTl = twCx.tlOnDisplay.length - 1; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
704 |
if (l) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
705 |
var startTw = tweets[tweetsOnDisplay[tweetsOnDisplay.length - 1]].date_value, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
706 |
endTw = tweets[tweetsOnDisplay[0]].date_value; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
707 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
708 |
for (var i = 0; i < twCx.tlOnDisplay.length; i++) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
709 |
if (l) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
710 |
if (startTw >= twCx.tlOnDisplay[i].start && startTw < twCx.tlOnDisplay[i].end) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
711 |
startTl = i; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
712 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
713 |
if (endTw >= twCx.tlOnDisplay[i].start && endTw < twCx.tlOnDisplay[i].end) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
714 |
endTl = i; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
715 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
716 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
717 |
var displayData = {}; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
718 |
for (var j in annotations) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
719 |
displayData[j] = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
720 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
721 |
for (var j in twCx.tlOnDisplay[i].tweets) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
722 |
var tweetid = twCx.tlOnDisplay[i].tweets[j], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
723 |
tweet = tweetById(tweetid); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
724 |
if (tweet) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
725 |
if (tweet.annotations.length) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
726 |
for (var k in tweet.annotations) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
727 |
displayData[tweet.annotations[k]].push(tweetid); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
728 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
729 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
730 |
displayData['default'].push(tweetid); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
731 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
732 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
733 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
734 |
var nbT = 0; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
735 |
for (var j in displayData) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
736 |
nbT += displayData[j].length; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
737 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
738 |
maxTweets = Math.max(maxTweets, nbT); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
739 |
twCx.tlOnDisplay[i].displayData = displayData; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
740 |
twCx.tlOnDisplay[i].totalTweets = nbT; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
741 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
742 |
twCx.scaleX = ( twCx.tlWidth - twCx.deltaX ) / maxTweets; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
743 |
tlPaper.clear(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
744 |
relHover = null; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
745 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
746 |
// Dessin de la correspondance liste-timeline |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
747 |
if (l) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
748 |
var startY = twCx.tlHeight - startTl * twCx.scaleY, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
749 |
endY = twCx.tlHeight - ( endTl + 1 ) * twCx.scaleY, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
750 |
path = "M0 " + twCx.tlHeight + "C" + .7*twCx.deltaX + " " + twCx.tlHeight + " " + .3*twCx.deltaX + " " + startY + " " + twCx.deltaX + " " + startY + "L" + twCx.tlWidth + " " + startY + "L" + twCx.tlWidth + " " + endY + "L" + twCx.deltaX + " " + endY + "C" + .3*twCx.deltaX + " " + endY + " " + .7*twCx.deltaX + " 0 0 0"; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
751 |
tlPaper.path( path ).attr({ "stroke" : "none", "fill" : "#000080", "opacity" : .2 }); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
752 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
753 |
// dessin de la date de début |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
754 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
755 |
tlPaper.text(twCx.deltaX / 2, twCx.tlHeight - 7, new Date(twCx.tlOnDisplay[0].start).toTimeString().substr(0,5)) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
756 |
.attr({ "text-anchor" : "middle", "font-size": "9px" }); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
757 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
758 |
// dessin de la date de fin |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
759 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
760 |
tlPaper.text(twCx.deltaX / 2, 7, new Date(twCx.tlOnDisplay[twCx.tlOnDisplay.length - 1].end).toTimeString().substr(0,5)) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
761 |
.attr({ "text-anchor" : "middle", "font-size": "9px" }); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
762 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
763 |
for (var i = 0; i < twCx.tlOnDisplay.length; i++) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
764 |
var n = 0, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
765 |
posY = twCx.tlHeight - ( i + 1 ) * twCx.scaleY; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
766 |
for (var j in twCx.tlOnDisplay[i].displayData) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
767 |
var ll = twCx.tlOnDisplay[i].displayData[j].length; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
768 |
if (ll > 0) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
769 |
tlPaper.rect( twCx.deltaX + n * twCx.scaleX, posY, ll * twCx.scaleX, twCx.scaleY ) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
770 |
.attr({"stroke" : "none", "fill" : getColor(j, .4).hex }); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
771 |
n += ll; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
772 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
773 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
774 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
775 |
// Si on est à une demi-heure, on trace un axe secondaire + heure |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
776 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
777 |
if (i < twCx.tlOnDisplay.length - 1 && !(twCx.tlOnDisplay[i].end % 1800000)) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
778 |
tlPaper.path("M0 "+posY+"L" + twCx.tlWidth +" "+posY).attr({"stroke":"#ccc"}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
779 |
tlPaper.text(twCx.deltaX / 2, posY, new Date(twCx.tlOnDisplay[i].end).toTimeString().substr(0,5)).attr({ "text-anchor" : "middle", "font-size": "9px" }); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
780 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
781 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
782 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
783 |
// dessin du tweet courant |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
784 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
785 |
if (l) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
786 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
787 |
if (twCx.filtre) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
788 |
for (var i = 0; i < tweets.length; i++) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
789 |
if (i != p) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
790 |
var pos = tlPosTweet(tweets[i]); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
791 |
if (pos) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
792 |
drawTweetPos(pos, "#ffccff"); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
793 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
794 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
795 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
796 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
797 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
798 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
799 |
var posp = tlPosTweet(tweets[p]); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
800 |
if (posp) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
801 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
802 |
drawTweetPos(posp, "#ffff00"); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
803 |
var yy = posp.y - .5 * twCx.scaleY, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
804 |
path = "M0 " + ppy + "C" + ( .7 * twCx.deltaX ) + " " + ppy + " " + ( .2 * twCx.deltaX ) + " " + yy + " " + ( twCx.deltaX ) + " " + yy + "L" + ( posp.x - .5 * twCx.scaleX ) + " " + yy; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
805 |
yy = posp.y + .5 * twCx.scaleY; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
806 |
ppy += 117; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
807 |
path += "L" + ( posp.x - .5 * twCx.scaleX ) + " " + yy + "L" + twCx.deltaX + " " + yy + "C" + ( .2 * twCx.deltaX ) + " " + yy + " " + ( .7 * twCx.deltaX ) + " " + ppy + " 0 " + ppy; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
808 |
tlPaper.path( path ).attr({"stroke":"#ffff00", "fill" : "#ffff00", "fill-opacity" : .15}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
809 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
810 |
drawTweetArcs(tweets[p], posp, '#800080'); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
811 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
812 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
813 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
814 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
815 |
function filtrerAnnotation(annotation) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
816 |
if (annotations[annotation]) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
817 |
effectuerFiltrage(annotations[annotation].display_name, |
| 407 | 818 |
new RegExp( "(" + annotations[annotation].keywords.map(function(a) { return a.source }).join("|") + ")", "gim" ) ); |
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
819 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
820 |
effectuerFiltrage('', null) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
821 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
822 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
823 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
824 |
function filtrerTexte(valeur) { |
| 407 | 825 |
effectuerFiltrage( valeur, valeur ? new RegExp("(" + valeur.replace(/(\W)/g, '\\$1') + ")" ,'gim') : null ); |
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
826 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
827 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
828 |
function effectuerFiltrage(filtreTexte, tabRegexp) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
829 |
$("#recherche_annot").slideUp(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
830 |
$("#inp_q").val(filtreTexte).attr("class","rechercheCourante"); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
831 |
twCx.filtreTexte = filtreTexte; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
832 |
twCx.filtre = tabRegexp; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
833 |
twCx.followLast = !tabRegexp && (twCx.position == twCx.idIndex[twCx.idIndex.length - 1]); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
834 |
updateDisplay(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
835 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
836 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
837 |
function clicTl(evt) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
838 |
var o = $("#timeline").offset(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
839 |
if (twCx.tlMouseClicked && twCx.tlMouseMoved) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
840 |
var twid = tlIdFromPos(evt.pageX - o.left + twCx.refPosTl.x - twCx.refMouse.x, evt.pageY - o.top + twCx.refPosTl.y - twCx.refMouse.y, true); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
841 |
if (twid) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
842 |
selectTweet(twid.id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
843 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
844 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
845 |
var twid = tlIdFromPos(evt.pageX - o.left, evt.pageY - o.top, twCx.tlMouseClicked); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
846 |
if (twCx.tlMouseMoved && !twCx.tlMouseClicked) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
847 |
if (twid) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
848 |
rolloverTweet(twid.id, true, twid.annotation); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
849 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
850 |
$("#hovertweet").hide(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
851 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
852 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
853 |
if (twCx.tlMouseClicked && !twCx.tlMouseMoved) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
854 |
if (twid) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
855 |
selectTweet(twid.id); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
856 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
857 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
858 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
859 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
860 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
861 |
function loadTweets(tweets, append) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
862 |
if (!append) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
863 |
twCx.timeline = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
864 |
twCx.idIndex = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
865 |
twCx.tweets = []; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
866 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
867 |
for (var i in tweets) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
868 |
addTweet(tweets[i]); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
869 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
870 |
if (twCx.followLast) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
871 |
twCx.position = twCx.idIndex[twCx.tweets.length - 1]; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
872 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
873 |
updateDisplay(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
874 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
875 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
876 |
function focusOutRecherche() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
877 |
$("#recherche_annot").slideUp(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
878 |
var inpq = $("#inp_q"), |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
879 |
val = inpq.val(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
880 |
if (val == '' || val == twCx.filtreTexte) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
881 |
if (twCx.filtre) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
882 |
inpq.attr("class", "rechercheCourante").val(twCx.filtreTexte); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
883 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
884 |
inpq.attr("class", "greyed").val(l10n.rechercher); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
885 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
886 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
887 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
888 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
889 |
function chaineTimeZoom() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
890 |
var chaine = "", |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
891 |
t = twCx.date_levels[twCx.timeLevel], |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
892 |
h = 3600*1000, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
893 |
m = 60*1000, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
894 |
s = 1000, |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
895 |
heures = Math.floor(t/h); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
896 |
if (heures) { chaine += heures + ' h. ' }; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
897 |
t -= (heures * h); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
898 |
var minutes = Math.floor(t/m); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
899 |
if (minutes) { chaine += minutes + ' min. ' }; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
900 |
t -= (minutes * m); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
901 |
if (t) { chaine += Math.floor(t/s) + ' sec.' } |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
902 |
$("#time_scale").html(chaine); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
903 |
$("#time_zoomout").attr("class",(twCx.timeLevel == 0 ? "inactive" : "")); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
904 |
$("#time_zoomin").attr("class",(twCx.timeLevel == twCx.date_levels.length - 1 ? "inactive" : "")); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
905 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
906 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
907 |
$(document).ready(function() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
908 |
tlPaper = Raphael("timeline", twCx.tlWidth, twCx.tlHeight); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
909 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
910 |
connectTweets(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
911 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
912 |
var html = ''; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
913 |
for (var j in annotations) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
914 |
if (j != "default") { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
915 |
html += '<a href="#" style="background: ' + getColor(j, .7).hex + ';" onclick=filtrerAnnotation(\'' + j + '\'); return false;">' + annotations[j].display_name + '</a> ' |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
916 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
917 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
918 |
$("#rech_list_annot").html(html); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
919 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
920 |
chaineTimeZoom(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
921 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
922 |
$("#tweetlist").mousewheel(function(e, d) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
923 |
wheelDelta += d; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
924 |
if (Math.abs(wheelDelta) >= 1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
925 |
movePos( parseInt(wheelDelta) ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
926 |
wheelDelta = 0; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
927 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
928 |
return false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
929 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
930 |
$("#timeline").mousewheel(function(e, d) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
931 |
wheelDelta += d; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
932 |
if (Math.abs(wheelDelta) >= 1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
933 |
if (wheelDelta > 0) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
934 |
tl = Math.min(twCx.date_levels.length - 1, twCx.timeLevel + 1); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
935 |
} else { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
936 |
tl = Math.max(0, twCx.timeLevel - 1); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
937 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
938 |
if (tl != twCx.timeLevel) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
939 |
twCx.timeLevel = tl; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
940 |
chaineTimeZoom(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
941 |
updateDisplay(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
942 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
943 |
wheelDelta = 0; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
944 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
945 |
return false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
946 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
947 |
$("#time_zoomin").click(function() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
948 |
if (twCx.timeLevel < twCx.date_levels.length - 1) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
949 |
twCx.timeLevel++; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
950 |
chaineTimeZoom(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
951 |
updateDisplay(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
952 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
953 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
954 |
$("#time_zoomout").click(function() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
955 |
if (twCx.timeLevel > 0) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
956 |
twCx.timeLevel--; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
957 |
chaineTimeZoom(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
958 |
updateDisplay(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
959 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
960 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
961 |
$("#timeline, #tweetlist").mouseout(function() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
962 |
twCx.tlMouseClicked = false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
963 |
twCx.tlMouseMoved = false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
964 |
$("#hovertweet").hide(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
965 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
966 |
$("#timeline").mousemove(function(evt) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
967 |
twCx.tlMouseMoved = true; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
968 |
clicTl(evt); |
| 407 | 969 |
}).mousedown(function(evt) { |
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
970 |
twCx.tlMouseClicked = true; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
971 |
twCx.tlMouseMoved = false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
972 |
var o = $(this).offset(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
973 |
twCx.refMouse = { x : evt.pageX - o.left, y : evt.pageY - o.top }; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
974 |
twCx.refPosTl = tlPosTweet(tweetById(twCx.position)) || twCx.refMouse; |
| 407 | 975 |
}).mouseup(function(evt) { |
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
976 |
clicTl(evt); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
977 |
twCx.tlMouseClicked = false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
978 |
twCx.tlMouseMoved = false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
979 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
980 |
$("#inp_q").focus(function() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
981 |
$("#recherche_annot").slideDown(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
982 |
$(this).val($(this).val().replace(/ \(.+\)$/, '')) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
983 |
if ($(this).hasClass("greyed")) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
984 |
$(this).val(""); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
985 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
986 |
$(this).attr("class",""); |
| 407 | 987 |
}).focusout(function() { |
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
988 |
focusOutRecherche(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
989 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
990 |
$("#inp_reset").click(function() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
991 |
$("#inp_q").val(''); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
992 |
if (twCx.filtre) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
993 |
twCx.filtre = null; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
994 |
updateDisplay(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
995 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
996 |
twCx.filtreTexte = ''; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
997 |
focusOutRecherche(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
998 |
return false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
999 |
}) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1000 |
$("#recherche").submit(function(evt) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1001 |
evt.preventDefault(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1002 |
if (!$("#inp_q").hasClass("greyed")) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1003 |
var valeur = $("#inp_q").val(); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1004 |
filtrerTexte(valeur); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1005 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1006 |
return false; |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1007 |
}); |
| 407 | 1008 |
$("#hoverkw").mouseover(function() { |
1009 |
$(this).dequeue().show(); |
|
1010 |
}).mouseout(function() { |
|
1011 |
$(this).hide(); |
|
1012 |
}); |
|
1013 |
|
|
1014 |
$("#hkwsearch").click(function() { |
|
1015 |
var _hkw = $("#hoverkw"); |
|
1016 |
filtrerTexte(_hkw.attr("kw")); |
|
1017 |
_hkw.hide(); |
|
1018 |
return false; |
|
1019 |
}); |
|
1020 |
$("#hkwtweet").click(function() { |
|
1021 |
var _hkw = $("#hoverkw"); |
|
1022 |
add_grammar(_hkw.attr("kw")); |
|
1023 |
_hkw.hide(); |
|
1024 |
return false; |
|
1025 |
}); |
|
|
406
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1026 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1027 |
setInterval(function() { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1028 |
var sc = $("#scrollcont"); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1029 |
if (sc.scrollTop() != lastScrollPos && twCx.tweets) { |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1030 |
var p = Math.floor( twCx.currentIdIndex.length * ( 1 - sc.scrollTop() / scrollExtent ) ); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1031 |
goToPos(p); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1032 |
} |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1033 |
|
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1034 |
}, 100) |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1035 |
}); |
|
86b62b98fea7
Polemic Tweet client now uses rv's live system
Raphael Velt <raph.velt@gmail.com>
parents:
diff
changeset
|
1036 |