Skip to content

Commit

Permalink
Merge pull request #5 from payalnik/master
Browse files Browse the repository at this point in the history
margins for header, menu and comment cancel
  • Loading branch information
SiTLar committed Jun 4, 2015
2 parents acea513 + adc2edf commit 30d4f7f
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 18 deletions.
7 changes: 4 additions & 3 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
var gConfig = {
"serverURL":"http://twinspect.net:3000/v1/"
, "front":"http://moimosk.ru/Frf_dev/"
, "static":"http://moimosk.ru/Frf_dev/static/"
, "front":"http://104.236.251.209/"
, "static":"http://104.236.251.209/"
, "offset":"30"

, 'likesFold':4
,
}
33 changes: 29 additions & 4 deletions main.css
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ color: #000088;
cursor: pointer;
}

h1{
margin-bottom: 0.3em;
}

.controls-user{
margin-bottom: 0.5em;
}

.edit-txt-area{
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
Expand All @@ -23,15 +31,20 @@ cursor: pointer;
border-right: 1px solid #b4b4b4;
border-style: solid;
border-width: 1px;
height: 26px;
margin-bottom: 3px;
margin-bottom: 0.5em;
width: 100%;
height: 4em;
padding: 3px;
}
.control-button-post{
margin-right:0.3em;
}

.edit-buttons-post{
margin-right: 3em;
font-size: 100%;
}

.nodeAuth{
margin: 10% auto 0 auto;
position: absolute;
Expand Down Expand Up @@ -115,9 +128,10 @@ display: inline-block;
content: " - ";
margin-right: 0.3em;
}
.likes ul {

.likes ul{
float: left;
list-style: outside none none;
list-style: outside none none;
margin: 0 4px 4px 2em;
padding: 0;
}
Expand All @@ -130,6 +144,13 @@ content: ",";
display: inline-block;
margin-right:.3em;
}

.post-body .likes ul li.nocomma:before {
content: "";
display: inline-block;
margin-right:.3em;
}

.comment-body {
font-size: 13px;
line-height: 16px;
Expand All @@ -151,6 +172,9 @@ clear: both;
font-size: 13px;
line-height: 16px;
}
.fa-spinner{
margin-left: 0.5em
}
.likes-smile {

float: left;
Expand All @@ -159,6 +183,7 @@ width: auto;
font-size: 1.5em;
position: relative;
}

.likes-smile .icon-bg{
line-height: 0.9;
color: #ffb914;
Expand Down
28 changes: 17 additions & 11 deletions parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ var gMe = new Object();
var gComments = new Object();
var gAttachments = new Object();
var autolinker = new Autolinker({'truncate':20, 'replaceFn':frfAutolinker } );

function unfoldLikes(id){
var post = document.getElementById(id).rawData;
var span = document.getElementById(id+'-unl');
var nodeLikes = span.parentNode;
nodeLikes.removeChild(span);

if (post.omittedLikes > 0){
var oReq = new XMLHttpRequest();
oReq.onload = function(){
if(oReq.status < 400){
nodeLikes.removeChild(span);
var postUpd = JSON.parse(this.response);
post.likes = postUpd.posts.likes;
postUpd.users.forEach(addUser);
Expand All @@ -39,14 +41,16 @@ function writeAllLikes(id,nodeLikes){
if (nodeLikes.childNodes[idx].nodeName == 'UL')break;
var nodeLike = document.createElement('li');
nodeLike.className = "p-timeline-user-like";
for(var like = 4; like < post.likes.length; like++){
for(var like = gConfig.likesFold; like < post.likes.length; like++){
var nodeCLike = nodeLike.cloneNode();
nodeCLike.innerHTML = gUsers[post.likes[like]].link;
nodeLikes.childNodes[idx].appendChild(nodeCLike);
//nodeLikes.childNodes[idx].appendChild(nodeCLike);
nodeLikes.appendChild(nodeCLike);
}
span = document.createElement('span');
span.innerHTML = " liked this";
nodeLikes.childNodes[idx].appendChild(span);
var suffix = document.createElement('span');
suffix.innerHTML = " liked this";
//nodeLikes.childNodes[idx].appendChild(suffix);
nodeLikes.appendChild(suffix);
}
function genLikes(post, postNBody){
postNBody.cNodes["post-info"].cNodes["likes"].appendChild(gNodes['likes-smile'].cloneNode(true));
Expand All @@ -64,19 +68,21 @@ function genLikes(post, postNBody){
}
var nodeLike = document.createElement('li');
nodeLike.className = "p-timeline-user-like";
for (var idx = 0; idx < (4<l?4:l) ; idx++){
for (var idx = 0; idx < (gConfig.likesFold<l?gConfig.likesFold:l) ; idx++){
var nodeCLike = nodeLike.cloneNode();
nodeCLike.innerHTML = gUsers[post.likes[idx]].link;
nodeLikes.appendChild(nodeCLike);
}
var suffix = document.createElement("span");
var suffix = document.createElement("li");
suffix.id = post.id+'-unl'
if (post.omittedLikes>0) l += post.omittedLikes;
if ( l > 4)
suffix.innerHTML = 'and <a onclick="unfoldLikes(\''+post.id+'\')">'+ (l - 4) +' other people</a>' ;
if ( l > gConfig.likesFold)
suffix.innerHTML = 'and <a onclick="unfoldLikes(\''+post.id+'\')">'+ (l - gConfig.likesFold) +' other people</a>' ;
suffix.innerHTML += ' liked this';
suffix.className = 'nocomma';
nodeLikes.appendChild(suffix);
postNBody.cNodes["post-info"].cNodes["likes"].appendChild(nodeLikes);
postNBody.cNodes["post-info"].cNodes["likes"].appendChild(suffix);
//postNBody.cNodes["post-info"].cNodes["likes"].appendChild(suffix);
if(typeof gMe !== 'undefined'){
if(post.likes[0] == gMe.users.id){
postNBody.cNodes["post-info"].myLike = nodeLikes.childNodes[0];
Expand Down

0 comments on commit 30d4f7f

Please sign in to comment.