diff options
Diffstat (limited to 'static/js/pichat.js')
| -rw-r--r-- | static/js/pichat.js | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/static/js/pichat.js b/static/js/pichat.js index 6945df9..7266beb 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -500,7 +500,7 @@ function initChat() { messageList = $("#messageList")[0] - initChatThumb() + initChatThumb(); scrollToEnd() scrollWatcher() @@ -582,14 +582,13 @@ function initLog() { var t = $(this); t.html(buildMsgContent(t.text())); }); - initLogThumb(); + initLogThumb(".logged-dump .thumb", '.dump'); } -// jesus this logic is ugly -function initLogThumb(){ - $(".logged-dump .thumb").bind('mouseover mouseout', +function initLogThumb(selector, parentSelector) { + $(selector).bind('mouseover mouseout', function(e) { - var favorited = $(this).parents(".dump").hasClass("favorite") ? true : false; + var favorited = $(this).parents(parentSelector).hasClass("favorite") ? true : false; if (e.type == "mouseover") { if (favorited) { $(this).attr("src", Imgs.logThumbOff); @@ -601,17 +600,16 @@ function initLogThumb(){ if (favorited) { $(this).attr("src", Imgs.logThumb); $(this).stop().animate(Anim.logThumb, 'fast'); - } else { + } else { $(this).attr("src", Imgs.logThumbOff); $(this).stop().animate(Anim.logThumb, 'fast'); } } }) -} + } -function initChatThumb(){ - - $(".chat-thumb").live('mouseover mouseout', +function initChatThumb() { + $(".chat-thumb").live('mouseover mouseout', function(e) { var favorited = $(this).parents(".dump").hasClass("favorite") ? true : false; if (e.type == "mouseover") { @@ -624,18 +622,27 @@ function initChatThumb(){ } else { // mouseout if (favorited) { $(this).attr("src", Imgs.chatThumb); + var favorited = $(this).parents(".dump").hasClass("favorite") ? true : false; + if (e.type == "mouseover") { + if (favorited) { + $(this).attr("src", Imgs.chatThumbOff); + } else { + $(this).attr("src", Imgs.chatThumbBig); + $(this).stop().animate(Anim.chatThumbBig, 'fast') + } + } else { // mouseout + if (favorited) { + $(this).attr("src", Imgs.chatThumb); $(this).stop().animate(Anim.chatThumb, 'fast'); - } else { - $(this).stop().animate(Anim.chatThumbTiny, 'fast', 'swing', + } else { + $(this).stop().animate(Anim.chatThumbTiny, 'fast', 'swing', function(){ $(this).attr("src", Imgs.chatThumbDot) - $(this).animate(Anim.chatThumb, 0) + $(this).animate(Anim.chatThumb, 0) }) + }} } - } - }) -} - + }})} function paletteToChat(img){ var chatText = $("#msgInput").val() @@ -985,7 +992,8 @@ function initDirectory() { var t = $(this); t.html(buildMsgContent(t.text())); }); - Search.init() + Search.init() + initLogThumb('.dlogged-dump .thumb', '.dlogged-dump'); } //big hand stuff |
