From 206ea599084d289b9e6b251fd813202f1d84eff5 Mon Sep 17 00:00:00 2001 From: Denis Ryabov Date: Thu, 27 Mar 2014 13:09:13 +0400 Subject: [PATCH] improve profile popup (hide empty fields, fix scrollbar issue) --- css/profile.css | 30 +++++++++++++++++++++++++----- home.html | 6 +++--- js/interface_common.js | 14 +++++++++++--- js/twister_io.js | 16 +++++++--------- 4 files changed, 46 insertions(+), 20 deletions(-) diff --git a/css/profile.css b/css/profile.css index d4c432d..5e2a94e 100644 --- a/css/profile.css +++ b/css/profile.css @@ -231,6 +231,9 @@ margin-left: -300px; } +.profile-modal .modal-header, .profile-modal .profile-card { + z-index: 1; +} .profile-modal .modal-content { padding: 3px; @@ -250,9 +253,10 @@ text-align: center; } #msngrswr { - position: absolute; - left: 10px; + display: none; + margin-left: 10px; margin-top: 10px; + height: 40px; } #toxbtnwr, #bmbtnwr { float: left; @@ -315,7 +319,6 @@ { display: inline-block; margin-left: -4px; - margin-top: 40px; border-bottom: 0; } button.follow:hover { @@ -349,9 +352,13 @@ button.follow:hover { } .profile-modal .postboard-posts { - display: block; - height: 90%; + position: absolute; + top: 0; + height: 100%; + box-sizing: border-box; + border-top: 292px solid transparent; overflow: auto; + z-index: 0; } .profile-modal .profile-card-main { @@ -401,4 +408,17 @@ h2.profile-screen-name { .profile-modal .modal-buttons { display: none; +} + +.profile-modal h1.profile-name, +.profile-modal h2.profile-screen-name, +.profile-modal span.profile-location, +.profile-modal a.profile-url { + display: block; +} + +.profile-modal span.profile-location:empty, +.profile-modal a.profile-url:empty, +.profile-modal a.profile-bio:empty { + display: none; } \ No newline at end of file diff --git a/home.html b/home.html index f952c76..f136eeb 100644 --- a/home.html +++ b/home.html @@ -433,9 +433,9 @@ style="background: url(img/imgBack.png) no-repeat center center;"-->
-


-

@


-
+

+

@

+
diff --git a/js/interface_common.js b/js/interface_common.js index 6fbe3b8..621eeb6 100644 --- a/js/interface_common.js +++ b/js/interface_common.js @@ -120,9 +120,17 @@ function openProfileModal(e) }); }; $mc = $('.modal-content'); - $mch = parseInt($('.modal-content').css('height'));// - $pch = parseInt($('.profile-card').css('height'));// - $mc.css('height', $mch - ($pch + Math.floor($mch/50)));//hed//fix .modal-content height +// $mch = parseInt($('.modal-content').css('height'));// +// $pch = parseInt($('.profile-card').css('height'));// +// $mc.css('height', $mch - ($pch + Math.floor($mch/50)));//hed//fix .modal-content height + + $mc.off('profileloaded'); + $mc.on('profileloaded', function() { + var viewHeader = $mc.find(".postboard > h2"); + var h = viewHeader.offset().top + viewHeader.outerHeight() - $mc.parent().offset().top + 5; + $mc.find(".postboard-posts").css('border-top', parseInt(h, 10) + "px solid transparent"); + }); + $mc.trigger('profileloaded'); } function newHashtagModal(hashtag) { diff --git a/js/twister_io.js b/js/twister_io.js index 62c27ef..923487c 100644 --- a/js/twister_io.js +++ b/js/twister_io.js @@ -196,6 +196,9 @@ function getProfileResource( username, resource, item, cbFunc, cbArg ){ if( args.cbFunc ) args.cbFunc(args.cbArg, null); } + if (item) { + item.trigger('profileloaded'); + } }, {username:username,item:item,cbFunc:cbFunc,cbArg:cbArg}); } } @@ -225,11 +228,8 @@ function getTox( username, item ){ item.empty(); if(text) { item.attr('href', 'tox:'+text); - - setTimeout(function(){ - $('#toxbtnwr').show() - $('.tox-ctc').attr('data', text); - }, 0); + item.next().attr('data', text); + item.parent().show().parent().show(); } }, item); } @@ -240,10 +240,8 @@ function getBitmessage( username, item ){ item.empty(); if(text) { item.attr('href', 'bitmsg:'+text+'?action=add&label='+username); - setTimeout(function(){ - $('#bmbtnwr').show(); - $('.bitmessage-ctc').attr('data', text); - }, 0); + item.next().attr('data', text); + item.parent().show().parent().show(); } }, item); }