From 0576d626f98f8a611258bac5d5f676182af11a6c Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 3 Jun 2015 12:58:54 -0700 Subject: [PATCH 1/3] margins for header, menu and comment cancel --- main.css | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/main.css b/main.css index e8eaa62..70d1a7e 100644 --- a/main.css +++ b/main.css @@ -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; @@ -23,8 +31,7 @@ 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; @@ -32,6 +39,12 @@ 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; @@ -115,7 +128,8 @@ display: inline-block; content: " - "; margin-right: 0.3em; } -.likes ul { + +.likes ul{ float: left; list-style: outside none none; margin: 0 4px 4px 2em; @@ -159,6 +173,7 @@ width: auto; font-size: 1.5em; position: relative; } + .likes-smile .icon-bg{ line-height: 0.9; color: #ffb914; From 9b0de0a5935f1dd570a2555ceaa3586c2d99f92a Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 3 Jun 2015 13:02:20 -0700 Subject: [PATCH 2/3] spinner margin --- main.css | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.css b/main.css index 70d1a7e..7b907ad 100644 --- a/main.css +++ b/main.css @@ -165,6 +165,9 @@ clear: both; font-size: 13px; line-height: 16px; } +.fa-spinner{ + margin-left: 0.5em +} .likes-smile { float: left; From adc2edf86e5f63bb0a965881e2dd98f28d916caa Mon Sep 17 00:00:00 2001 From: Alexey Date: Wed, 3 Jun 2015 15:50:03 -0700 Subject: [PATCH 3/3] Neat likes + # of like to fold goes to config! --- config.json | 7 ++++--- main.css | 9 ++++++++- parser.js | 28 +++++++++++++++++----------- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/config.json b/config.json index cb6779c..67beee2 100644 --- a/config.json +++ b/config.json @@ -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 +, } diff --git a/main.css b/main.css index 7b907ad..3c287a4 100644 --- a/main.css +++ b/main.css @@ -131,7 +131,7 @@ display: inline-block; .likes ul{ float: left; - list-style: outside none none; +list-style: outside none none; margin: 0 4px 4px 2em; padding: 0; } @@ -144,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; diff --git a/parser.js b/parser.js index 30dd151..f4a34e9 100755 --- a/parser.js +++ b/parser.js @@ -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); @@ -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)); @@ -64,19 +68,21 @@ function genLikes(post, postNBody){ } var nodeLike = document.createElement('li'); nodeLike.className = "p-timeline-user-like"; - for (var idx = 0; idx < (40) l += post.omittedLikes; - if ( l > 4) - suffix.innerHTML = 'and '+ (l - 4) +' other people' ; + if ( l > gConfig.likesFold) + suffix.innerHTML = 'and '+ (l - gConfig.likesFold) +' other people' ; 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];