From c31d514753217d8b224a097f5db987ccb2ea356b Mon Sep 17 00:00:00 2001 From: jacktjong Date: Wed, 2 Nov 2022 11:47:10 +0100 Subject: [PATCH] Twitter Live Feed working (CONFLICT RESOLVED) --- dashboard_static/js/code.js | 28 ---------------------- dashboard_static/lib/tweets.js | 44 ---------------------------------- 2 files changed, 72 deletions(-) diff --git a/dashboard_static/js/code.js b/dashboard_static/js/code.js index e6c64f5..7679c8e 100644 --- a/dashboard_static/js/code.js +++ b/dashboard_static/js/code.js @@ -25,33 +25,6 @@ function getCSSVariable(name) { function tweetCell(tweet) { var cell = document.createElement("div"); cell.innerHTML = -<<<<<<< Updated upstream - '
'+ - '' + - '
' + - '
'+ - ''+tweet.user.name+' '+ - '@'+tweet.user.screen_name+''+ - '
'+ - ''+tweet.text+''+ - '
'+ - '
'+ - 'favorite'+ - ''+tweet.favorite_count+''+ - '
'+ - '
'+ - 'repeat'+ - ''+tweet.retweet_count+''+ - '
'+ - '
'+ - 'chat_bubble'+ - ''+tweet.reply_count+''+ - '
'+ - '
'+ - '
'+ - '
'; - parent.append(cell); -======= `
@@ -77,7 +50,6 @@ function tweetCell(tweet) {
` return cell ->>>>>>> Stashed changes } $(document).on('tweet', console.log(tweet)); diff --git a/dashboard_static/lib/tweets.js b/dashboard_static/lib/tweets.js index 5fa32a5..a20e7e9 100644 --- a/dashboard_static/lib/tweets.js +++ b/dashboard_static/lib/tweets.js @@ -71,54 +71,11 @@ block.fn.tweets = function(config) { memory: 100 }, config); -<<<<<<< Updated upstream:template_static/lib/tweets.js - // create the necessary HTML in the block container - //this.$element.append('
    '); - -======= ->>>>>>> Stashed changes:dashboard_static/lib/tweets.js // store list for later var $list = $("div.tweetcontainer"); // register default handler for handling tweet data this.actions(function(e, tweet){ -<<<<<<< Updated upstream:template_static/lib/tweets.js - var $item = $('
  1. '); - - var $tweet = $('
    '); - var $content = $('
    '); - var $header = $('
    '); - - // Build a tag image and header: - var $account = $(''); - $account.attr("href", "http://twitter.com/" + tweet.user.screen_name); - - var $avatar = $("").addClass("avatar"); - $avatar.attr("src", tweet.user.profile_image_url); - $account.append($avatar); - $account.append($('' + tweet.user.name + '')); - $account.append($(' ')); - $account.append($('@' + tweet.user.screen_name + '')); - $header.append($account); - - // Build timestamp: - var $time = $(''); - $time.append($('' + tweet.created_at + '')); - - $header.append($time); - $content.append($header); - - // Build contents: - var text = process_entities(tweet.text, tweet.entities); - var $text = $('

    ' + text + '

    '); - $content.append($text); - - // Build outer structure of containing divs: - $tweet.append($content); - $item.append($tweet); - - // place new tweet in front of list -======= tweets = window.sessionStorage.getItem('tweets'); tweets = JSON.parse(tweets); tweets.push(tweet); @@ -128,7 +85,6 @@ block.fn.tweets = function(config) { window.sessionStorage.setItem('tweets', JSON.stringify(tweets)); var $item = tweetCell(tweet) ->>>>>>> Stashed changes:dashboard_static/lib/tweets.js $list.prepend($item); // remove stale tweets