diff options
| author | tim b <timb@camcompu.home> | 2010-04-03 20:59:40 -0700 |
|---|---|---|
| committer | tim b <timb@camcompu.home> | 2010-04-03 20:59:40 -0700 |
| commit | dccf497aca0ea62b7931976103c89e3b01ab1860 (patch) | |
| tree | 2f855c11deee5ee95c3bb5bf68daef1c4d5f7915 /static | |
| parent | 1239bda75594f1338482f71054dbb6aa84538c86 (diff) | |
committing stuff so i can merge pulled repo
Diffstat (limited to 'static')
| -rw-r--r-- | static/css/log.css | 2 | ||||
| -rw-r--r--[-rwxr-xr-x] | static/js/pichat.js | 90 |
2 files changed, 91 insertions, 1 deletions
diff --git a/static/css/log.css b/static/css/log.css index 79096e1..ea052a9 100644 --- a/static/css/log.css +++ b/static/css/log.css @@ -228,7 +228,7 @@ color:000; max-width:500px; width:500px; text-overflow: ellipsis-word; - padding: 18px; + padding: 18px 18px 6px 18px; font-family: Arial, Helvetica, sans-serif; font-size: 12px; text-transform: uppercase; diff --git a/static/js/pichat.js b/static/js/pichat.js index 4d4ed17..ce27ebd 100755..100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -378,8 +378,55 @@ function initLog() { var t = $(this); t.html(buildMsgContent(t.text())); }); + initAnimThumb(); } +// jesus this logic is ugly +function initAnimThumb(){ + $(".buttons .thumb").bind('mouseover mouseout', + function(e) { + var favorited = $(this).hasClass("favorite") ? true : false; + if (e.type == "mouseover") { + if (favorited) { + $(this).attr("src", "/static/thumbup.gif"); +/* $(this).stop().animate({ + "width": "14px", + "height": "15px", + "marginLeft": "0px", + "marginTop": "0px" + }, 'fast'); */ + } else { + $(this).attr("src", "/static/thumbup.colored.4x.gif"); + $(this).stop().animate({ + "width": "56px", + "height": "60px", + "marginLeft": "-44px", + "marginTop": "-27px" + }, 'fast'); + } + } else { // mouseout + if (favorited) { + $(this).attr("src", "/static/thumbup.colored.gif"); + $(this).stop().animate({ + "width": "14px", + "height": "15px", + "marginLeft": "0px", + "marginTop": "0px" + }, 'fast'); + } else { + $(this).attr("src", "/static/thumbup.gif"); + $(this).stop().animate({ + "width": "14px", + "height": "15px", + "marginLeft": "0px", + "marginTop": "0px" + }, 'fast'); + } + } + }) +} + + // TODO function favoriteImage() {}; @@ -591,6 +638,49 @@ Share = { } } +Tag = { + // todo: get rid of all the duplicated code here and in share + "getMessage": function(button){ + var message = $(button).parents(".logged-dump") + var id = message.attr("id").substr(8) // cut "message-001" to "001" + var nick = message.attr("nick") // cut "/u/timb" to "timb" + var link = "http://dump.fm/p/" + nick + "/" + id + var content = message.find(".linkify") + if (!content.length) content = message.find(".content") + var rawContent = content.html() + var img = content.find("img").attr("src") + var via = "via " + nick + " on dump.fm" + return {"nick": nick, "id": id, "link": encodeURIComponent(link), "content": content, "img": encodeURIComponent(img), "via": encodeURIComponent(via)} + }, + "favorite": function(button){ + var message = Share.getMessage(button) + var favorited = ($(button).hasClass("favorite")) ? true : false + if (favorited) { + Tag.rm(message.id, "favorite") + $(button).removeClass("favorite") + } else { + Tag.add(message.id, "favorite") + $(button).addClass("favorite") + } + }, + "add": function(message_id, tag){ + Tag.ajax("/cmd/tag/add", {"message_id": message_id, "tag": tag}) + }, + "rm": function(message_id, tag){ + Tag.ajax("/cmd/tag/rm", {"message_id": message_id, "tag": tag}) + }, + "ajax": function(url, data) { + $.ajax({ + "type": 'POST', + "timeout": 5000, + "url": url, + "data": data, + "cache": false + }); + } +} + + // uhhh todo: move preload stuff into js: // var nextImage = new Image(); // nextImage.src = "your-url/newImage.gif"; |
