relita

an encrypted, decentralized, peer-to-peer social network
Log | Files | Refs | README | LICENSE | git clone https://git.ne02ptzero.me/git/relita

commit 54886232f149bda6e734c00ca516796adf473300
parent c7b7870e5521205d9ef4777e283d87344c9514e5
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Tue, 11 Apr 2017 14:21:50 +0200

Fix(Feed): Proper loading for feed

Diffstat:
Mcss/add_post.css | 1-
Mcss/main.css | 7++++++-
Mcss/menu.css | 2+-
Mjs/renderer.js | 35+++++++++++++----------------------
Mmain.js | 9+--------
5 files changed, 21 insertions(+), 33 deletions(-)

diff --git a/css/add_post.css b/css/add_post.css @@ -1,5 +1,4 @@ .add_post { - display: none; width: 100%; border: 0; height: 6.2%; diff --git a/css/main.css b/css/main.css @@ -40,11 +40,16 @@ div.tooltip-inner { } .title { - height: 90%; + position: fixed; + top: 0; + left: 0; + height: 100%; width: 100%; display: flex; align-items: center; justify-content: center; + z-index: 999; + background-color: #262526; } .title ul { diff --git a/css/menu.css b/css/menu.css @@ -7,7 +7,7 @@ text-align: center; background: #2F343B; border-right: 3px solid rgba(0, 0, 0, 0.19); - display: none; + z-index: 1; } .menu ul { diff --git a/js/renderer.js b/js/renderer.js @@ -5,21 +5,10 @@ $(function() { "post" ] - var $grid = $('.grid').masonry({ - itemSelector: '.grid-item', - columnWidth: 1, - }); - + var $grid = null; ipcRenderer.on('connect_client', (event, arg) => { - $(".title .status").html("Connection established. ("+ arg +")") - $(".title i").fadeOut(600, function() { - $(".title").fadeOut(500, function() { - $(".menu").fadeIn(300, function() { - $(".add_post").fadeIn(200); - }); - }); - }) + $(".title .status").html("Loading feed...") }) ipcRenderer.on('add_post', (event, arg) => { @@ -35,17 +24,15 @@ $(function() { }) ipcRenderer.on('new_entry', (event, arg) => { - if (arg.sync === true) + if ($grid === null) { - $('[data-toggle="tooltip"]').tooltip(); - return ; + $grid = $('.grid').masonry({ + itemSelector: '.grid-item', + columnWidth: 1, + }); } - if (arg.value.content.sub_type === "post") add_post_to_page(arg) - - $grid.masonry('reloadItems'); - $grid.masonry('layout'); }) ipcRenderer.on('connection_event', (event, arg) => { @@ -53,7 +40,11 @@ $(function() { $(".status i").removeClass("failed") $(".status i").removeClass("success") if (arg.peer.state === 'connected') + { + $grid.masonry('layout') + $(".title").fadeOut(200); $(".status i").addClass("success") + } else $(".status i").addClass("failed") }) @@ -92,7 +83,8 @@ $(function() { post_class = 'grid-item grid-item-w2'; if (arg.value.content.value.text.length > 30) post_class = 'grid-item grid-item-w3'; - $(".posts_list").prepend("<div class='single_post "+ post_class +"'>" + $(html).html() + "</div>") + new_entry = $("<div class='single_post "+ post_class +"'>" + $(html).html() + "</div>") + $grid.prepend(new_entry).masonry('prepended', new_entry) $('[data-toggle="tooltip"]').tooltip(); } } @@ -131,5 +123,4 @@ $(function() { $(".add_post .content_edition div").fadeOut(0); $(".add_post .content_edition ."+current_post_type).fadeIn(0); }) - }) diff --git a/main.js b/main.js @@ -68,12 +68,9 @@ function create_window() { } function live_drain(msg) { - //console.log(msg) if (msg.sync === true) - { - mainWindow.webContents.send('new_entry', msg) return; - } + pull( sbot_client.links({ source: msg.value.author, @@ -89,10 +86,6 @@ function live_drain(msg) { ) } -function live_gossip(arg) { - console.log("Test !") - console.log(arg) -} app.on('ready', create_window) app.on('window-all-closed', function () {