diff -r f7ceddf99d6d -r bf5cf5a9e737 tweetcast/nodejs/client/js/script.js --- a/tweetcast/nodejs/client/js/script.js Wed Dec 07 19:28:46 2011 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,446 +0,0 @@ -var socket, - tlPaper, - twPaper, - tweetData = { - "tweetcount" : 0, - "position" : 0, - "feedMode" : true, - "followLast" : true, - "zoomLevel" : 3, - "timeLevel" : 2, - "tweets" : [], - "posIndex" : [], - "tlChanged" : true, - "tlLevelChanged" : true, - "blockUpdate" : false, - "waitUpdate" : true, - "htmlBuffer" : '', - "wheelDelta" : 0 - }, - displaySplitting = [ - { - positions : [ 10, 20, 22, 24, 25, 26, 27, 28, 29, 31, 33, 43, 53 ], - classNames : [ 'icons fade', 'icons', 'quarter fade', 'quarter', 'half fade', 'half', 'full', 'half', 'half fade', 'quarter', 'quarter fade', 'icons', 'icons fade' ] - }, - { - positions : [ 1, 3, 5, 7, 13, 33, 53 ], - classNames : [ 'full', 'half', 'half fade', 'quarter', 'quarter fade', 'icons', 'icons fade' ] - } - ]; - -function placeHolder(className) { - return '
'; -} - -function getLinkedTweets() { - socket.emit('linkedTweets',{"tweetpos":tweetData.position}); -} - -function changeMode() { - if (tweetData.feedMode) { - getLinkedTweets(); - } else { - tweetData.feedMode = true; - updateDisplay(); - } -} - -function clicTweet(tweetPos) { - if (tweetPos != tweetData.position) { - tweetData.position = tweetPos; - if (tweetData.feedMode) { - tweetData.followLast = (tweetData.position == tweetData.tweetcount); - } else { - getLinkedTweets(); - } - return false; - } else { - changeMode(); - } -} - -function tweetToHtml(tweet, className) { - if (!tweet) { - return placeHolder(className); - } - var html = '' + new Date(tweet.created_at).toLocaleTimeString() + '
'; - lastend = 0; - var tab = tweet.text.split(/\&\#|\;/); - var txta = ''; - for (i = 0; i < tab.length; i++) { - txta += (i % 2 && parseInt(tab[i]) != NaN) ? String.fromCharCode(tab[i]) : tab[i]; - } - var txt = '', - entities = []; - for (var i in tweet.entities.hashtags) { - entities.push({ - "start" : tweet.entities.hashtags[i].indices[0], - "end" : tweet.entities.hashtags[i].indices[1], - "html" : '#' + tweet.entities.hashtags[i].text + '' - }); - } - for (var i in tweet.entities.urls) { - entities.push({ - "start" : tweet.entities.urls[i].indices[0], - "end" : tweet.entities.urls[i].indices[1], - "html" : '' + tweet.entities.urls[i].expanded_url + '' - }); - } - for (var i in tweet.entities.user_mentions) { - entities.push({ - "start" : tweet.entities.user_mentions[i].indices[0], - "end" : tweet.entities.user_mentions[i].indices[1], - "html" : '@' + tweet.entities.user_mentions[i].screen_name + '' - }); - } - entities.sort(function(a, b) { return a.start - b.start }); - for (var i in entities) { - txt += txta.substring(lastend, entities[i].start) + entities[i].html; - lastend = entities[i].end; - } - txt += txta.substring(lastend); - html += txt + '