Filter still not done

This commit is contained in:
2022-11-03 12:03:32 +01:00
parent a4031cbb54
commit f908e86e48
4 changed files with 11 additions and 8 deletions

View File

Binary file not shown.

View File

@@ -68,12 +68,12 @@ var process_entities = function(message, entities) {
block.fn.tweets = function(config) { block.fn.tweets = function(config) {
var options = $.extend({ var options = $.extend({
memory: 100 memory: 20
}, config); }, config);
// store list for later // store list for later
var $list = $("div.tweetcontainer"); // var $list = $("div.tweetcontainer");
console.log(this.$element.find("div")) var $list = document.querySelector("#latest")
// register default handler for handling tweet data // register default handler for handling tweet data
this.actions(function(e, tweet){ this.actions(function(e, tweet){
@@ -86,16 +86,19 @@ block.fn.tweets = function(config) {
} }
window.sessionStorage.setItem('tweets', JSON.stringify(tweets)); window.sessionStorage.setItem('tweets', JSON.stringify(tweets));
// remove stale tweets
// if ($list.childElementCount > options.memory) {
// console.log("Deleted")
// // delete last child element
// // $list.removeChild($list.lastChild);
// }
$list.replaceChildren();
// tweets = filterTweets(tweets, filters.blockedWords, filters.searchedWords + filters.sports, filters.sorted, filters.order); // tweets = filterTweets(tweets, filters.blockedWords, filters.searchedWords + filters.sports, filters.sorted, filters.order);
// tweets = sortTweets(tweets); // tweets = sortTweets(tweets);
for (i = 0; i < tweets.length; i++){ for (i = 0; i < options.memory-1; i++){
$list.prepend(tweetCell(tweets[i])); $list.prepend(tweetCell(tweets[i]));
} }
// remove stale tweets
if ($list.children().length > options.memory) {
$list.children().last().remove();
}
}); });
return this.$element; return this.$element;

View File

Binary file not shown.

View File

Binary file not shown.