From 4b2986ed19c4a57516fbbba71e525383a1f8b437 Mon Sep 17 00:00:00 2001 From: sostler Date: Fri, 28 May 2010 04:00:37 -0400 Subject: Added fav notification --- static/css/dump.css | 42 ++++++++++++++++++++++++++++++++++++++++++ static/js/pichat.js | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 75 insertions(+), 3 deletions(-) (limited to 'static') diff --git a/static/css/dump.css b/static/css/dump.css index 0d3538e..f6e4bce 100755 --- a/static/css/dump.css +++ b/static/css/dump.css @@ -360,6 +360,48 @@ border:1px solid blue; } +#favbox { + display: none; + overflow-x: hidden; + overflow-y:auto; + max-height: 300px; + margin: 0px; + position: absolute; + padding: 5px; + bottom:25px; + min-width: 210px; + width:11%; + float:right; + right: 4.5%; + font-family: Arial, Helvetica, sans-serif; + font-size: 14px; + font-weight:420; + border-top-left-radius:5px; + border-top-right-radius:5px; + -webkit-border-top-left-radius:5px; + background-color:#FFF; + -webkit-border-top-right-radius:5px; + -moz-border-radius-topleft:5px; + -moz-border-radius-topright:5px; + border-bottom-left-radius:5px; + border-bottom-right-radius:5px; + -webkit-border-bottom-left-radius:5px; + -webkit-border-bottom-right-radius:5px; + -moz-border-radius-bottomleft:5px; + -moz-border-radius-bottomright:5px; + border-right:2px solid #c8cbce; + border-bottom:2px solid #c8cbce; + + box-shadow: 3px 4px 4px #c8cbce; + -webkit-box-shadow: 3px 4px 4px #c8cbce; + -moz-box-shadow: 3px 3px 4px #c8cbce; + filter: progid:DXImageTransform.Microsoft.dropShadow(color=#c8cbce, offX=3, offY=4, positive=true); + text-overflow:ellipsis; + /* opacity:0.87; */ + z-index:18; + text-align: left; +} + #userList { overflow-x: hidden; overflow-y:auto; diff --git a/static/js/pichat.js b/static/js/pichat.js index 93e2f05..e884c15 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -202,6 +202,36 @@ function buildUserDiv(user) { } } +// Favs + +function buildFav(f) { + var h = '
' + + '' + + '' + f.from + '' + + ' just faved you!' + + '
'; + return $(h); +} + +function removeFavAndHideBox() { + $(this).remove(); + if ($('#favbox').children().length == 0) + $('#favbox').hide(); +} + +function showFav(f) { + $('#favbox').show(); + buildFav(f).appendTo('#favbox').fadeOut(3000, removeFavAndHideBox); +} + +function updateFavs(fs) { + if (fs.length == 0) + return; + $('#favbox').show(); + $(fs).each(function(i, f) { showFav(f) }); +} + + // Growl function buildGrowlDataAndPopDatShit(msg) { @@ -318,8 +348,7 @@ function flattenUserJson(users) { return s; } -function updateUI(msgs, users) { - +function updateUI(msgs, users, favs) { if (window['growlize'] && msgs && msgs.length > 0) { $.map(msgs, buildGrowlDataAndPopDatShit) } else if (msgs && msgs.length > 0) { @@ -332,6 +361,7 @@ function updateUI(msgs, users) { } cache.userlist = flattened } + updateFavs(favs); } function sortUsersByAlpha(a, b){ @@ -365,7 +395,7 @@ function refresh() { var messages = $.grep( json.messages, function(m) { return !isDuplicateMessage(m) }); - updateUI(messages, json.users); + updateUI(messages, json.users, json.favs); if (typeof UnseenMsgCounter !== 'undefined' && !HasFocus) { UnseenMsgCounter += messages.length; } -- cgit v1.2.3-70-g09d2