From d9bf4e9e0580a92c408d24c324a62b8ba6f32f4f Mon Sep 17 00:00:00 2001 From: Scott Ostler Date: Mon, 21 Jun 2010 01:53:37 -0400 Subject: don't show zoom for smaller than 200x200 images --- static/js/pichat.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'static/js/pichat.js') diff --git a/static/js/pichat.js b/static/js/pichat.js index 2a994b0..5a7f956 100644 --- a/static/js/pichat.js +++ b/static/js/pichat.js @@ -1038,6 +1038,8 @@ $(function() { OrigTitle = $('title').text(); }); +var imgZoomThreshhold = [200, 200]; + function initChatMsgs() { $('.msgDiv .content').live('mouseenter', function(e) { $(this).addClass('msg-hover'); @@ -1048,13 +1050,17 @@ function initChatMsgs() { }); $('.msgDiv .content .img-wrapper').live('mouseenter', function(e) { - var imgurl = $(this).find('img').attr('src'); + var img = $(this).find('img'); + + if (img.width() < imgZoomThreshhold[0] || img.height() < imgZoomThreshhold[1]) + return; + var zoomlink = $('') - .attr({'href': imgurl }) + .attr({'href': img.attr('src') }) .addClass('msg-image-zoom') .append($('').attr('src', 'http://dump.fm/static/img/zoom.gif') .addClass('zoom-icon')) - .click(function() { window.open(imgurl); return false; }); + .click(function() { window.open(img.attr('src')); return false; }); $(this).append(zoomlink); }); -- cgit v1.2.3-70-g09d2