summaryrefslogtreecommitdiff
path: root/js/util.js
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-05-26 17:28:12 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-05-26 17:28:12 -0400
commit0b53a820c2b4224b66b2a24f67302b4c5ca1deed (patch)
tree67086e31a9437327898920996bede11c1668f0e2 /js/util.js
parent40d4668c7c5cdd41d36b878ad87f7737117efc9c (diff)
parentc93031c2aa49b8a044e896ca1e07f5f4f429308e (diff)
Merge branch '0.8.x' of git@gitorious.org:laconica/dev into 0.8.x
Diffstat (limited to 'js/util.js')
-rw-r--r--js/util.js50
1 files changed, 34 insertions, 16 deletions
diff --git a/js/util.js b/js/util.js
index 31d9eb4f5..b1b6ec82b 100644
--- a/js/util.js
+++ b/js/util.js
@@ -17,9 +17,29 @@
*/
$(document).ready(function(){
- $('.attachments').click(function() {$().jOverlay({zIndex:999, success:function(html) {$('.attachment').click(function() {$().jOverlay({url:$(this).attr('href') + '/ajax'}); return false; });
- }, url:$(this).attr('href') + '/ajax'}); return false; });
- $('.attachment').click(function() {$().jOverlay({url:$(this).attr('href') + '/ajax'}); return false; });
+ $('a.attachment').click(function() {$().jOverlay({url: $('address .url')[0].href+'/attachment/' + ($(this).attr('id').substring('attachment'.length + 1)) + '/ajax'}); return false; });
+ $("a.thumbnail").hover(
+ function() {
+ var anchor = $(this);
+ $("a.thumbnail").children('img').remove();
+
+ setTimeout(function() {
+ anchor.closest(".entry-title").addClass('ov');
+ $.get($('address .url')[0].href+'/attachment/' + (anchor.attr('id').substring('attachment'.length + 1)) + '/thumbnail', null, function(data) {
+ anchor.append(data);
+ });
+ }, 250);
+
+ setTimeout(function() {
+ anchor.children('img').remove();
+ anchor.closest(".entry-title").removeClass('ov');
+ }, 3000);
+ },
+ function() {
+ $(this).children('img').remove();
+ $(this).closest(".entry-title").removeClass('ov');
+ }
+ );
// count character on keyup
function counter(event){
@@ -203,7 +223,6 @@ $(document).ready(function(){
$("#notices_primary .notices").prepend(document._importNode(li, true));
$("#notices_primary .notice:first").css({display:"none"});
$("#notices_primary .notice:first").fadeIn(2500);
- NoticeHover();
NoticeReply();
}
}
@@ -221,24 +240,23 @@ $(document).ready(function(){
NoticeReply();
});
+
function NoticeHover() {
- $("#content .notice").hover(
- function () {
- $(this).addClass('hover');
- },
- function () {
- $(this).removeClass('hover');
- }
- );
+ function mouseHandler(e) {
+ $(e.target).closest('li.hentry')[(e.type === 'mouseover') ? 'addClass' : 'removeClass']('hover');
+ };
+ $('#content .notices').mouseover(mouseHandler);
+ $('#content .notices').mouseout(mouseHandler);
}
+
function NoticeReply() {
if ($('#notice_data-text').length > 0) {
$('#content .notice').each(function() {
- var notice = $(this);
- $('.notice_reply', $(this)).click(function() {
- var nickname = ($('.author .nickname', notice).length > 0) ? $('.author .nickname', notice) : $('.author .nickname');
- NoticeReplySet(nickname.text(), $('.notice_id', notice).text());
+ var notice = $(this)[0];
+ $($('.notice_reply', notice)[0]).click(function() {
+ var nickname = ($('.author .nickname', notice).length > 0) ? $($('.author .nickname', notice)[0]) : $('.author .nickname');
+ NoticeReplySet(nickname.text(), $($('.notice_id', notice)[0]).text());
return false;
});
});