relita

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

commit f35d89285b089185670d4496a5c6425edbb62899
parent 649b76a5e5d0af63d33e6c356145f27088b71368
Author: Ne02ptzero <louis@ne02ptzero.me>
Date:   Mon, 10 Apr 2017 06:56:27 +0200

Add(Feed): Better way to read feed (Templating + UI)

Diffstat:
Mcss/main.css | 94+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mindex.html | 24+++++++++++++++++++++++-
Mjs/renderer.js | 8+++++++-
Mmain.js | 19+++++++++++++++++--
4 files changed, 141 insertions(+), 4 deletions(-)

diff --git a/css/main.css b/css/main.css @@ -324,4 +324,98 @@ input:focus { .posts_list { display: none; margin-top: 15px; + margin-left: 10px; +} + +.posts_list ul { + display: inline; + list-style: none; + width: 100%; +} + +.posts_list ul li { + display: block; + float: left; +} + +.posts_list ul .post { + width: 50%; +} + +.posts_list ul .full { + width: 100%; +} + +.posts_list .single_post { + margin-right: 10px; + background: rgba(255, 255, 255, 0.83); + color: black; + padding: 10px 5px 10px 5px; + margin-bottom: 10px; +} + +.posts_list .single_post .header { + display: inline; + list-style: none; + color: #2c2d2b; +} + +.posts_list .single_post .header li { + display: block; + float: left; + width: 50%; +} + +.posts_list .single_post .header .time { + text-align: right; +} + +.posts_list .single_post .bottom { + display: inline; + list-style: none; + color: #2c2d2b; +} + +.posts_list .single_post .bottom li { + display: block; + float: left; + width: 10%; + text-align: center; + transition-property: all; + transition-duration: 0.3s; +} + +.posts_list .single_post .bottom .padding { + width: 60%; +} + +.posts_list .single_post .content { + padding-top: 25px; + padding-bottom: 25px; + padding-left: 10px; + font-size: 1.5em; +} + +.posts_list .single_post .bottom .heart:hover { + color: #703030; + cursor: pointer; +} + +.posts_list .single_post .bottom .repost:hover { + color: green; + cursor: pointer; +} + +.posts_list .single_post .bottom .comment:hover { + color: #2F343B; + cursor: pointer; +} + +.posts_list .single_post .bottom .report:hover { + color: red; + cursor: pointer; +} + +.templates { + display: none; } diff --git a/index.html b/index.html @@ -57,7 +57,29 @@ </div> </div> </div> - <div class='posts_list'></div> + <div class='posts_list'> + <ul class='main_list'> + </ul> + </div> + <div class='templates'> + <div class='single_post'> + <ul class='header'> + <li class='author'>@Louis</li> + <li class="time">Sun. 09/04 02:04</li> + </ul> + <div class='content'> + Sup ? + </div> + <ul class='bottom'> + <li class="heart"><i class="fa fa-heart"></i></li> + <li class="repost"><i class="fa fa-retweet"></i></li> + <li class="comment"><i class="fa fa-comments"></i></li> + <li class='padding'>&nbsp;</li> + <li class='report'><i class="fa fa-ban"></i></li> + </ul> + <br /> + </div> + </div> </body> <script>window.$ = window.jQuery = require('./js/jquery.min.js');</script> diff --git a/js/renderer.js b/js/renderer.js @@ -59,8 +59,14 @@ $(function() { } function add_post_to_page(arg) { + html = $(".templates .single_post").clone() if (arg.value.content.sub_type === "post") { - $(".posts_list").append("<strong>"+ arg.value.author + "</strong>: "+ arg.value.content.value.text + "<br />") + console.log(arg) + var date = new Date(arg.timestamp) + $(html).find('.content').html(arg.value.content.value.text) + $(html).find('.author').html("@"+ arg.author_about.value.content.name) + $(html).find('.time').html(date.toDateString()) + $(".posts_list .main_list").prepend("<li class='post'><div class='single_post'>" + $(html).html() + "</div></li>") } } diff --git a/main.js b/main.js @@ -66,8 +66,23 @@ function create_window() { } function live_drain(msg) { - console.log(msg) - mainWindow.webContents.send('new_entry', msg) + //console.log(msg) + if (msg.sync !== true) + { + pull( + sbot_client.links({ + source: msg.value.author, + dest: msg.value.author, + rel: 'about', + values: true + }), + pull.collect(function(err, msgs) { + if (msgs[0] !== undefined) + msg.author_about = msgs[0]; + mainWindow.webContents.send('new_entry', msg) + }) + ) + } } app.on('ready', create_window)