Mercurial > public > sg101
changeset 645:99f7917702ca
Fix 081a88b3bfc8, javascript resize of forum images.
Commit 081a88b3bfc8 broke those pages that loaded forums.js but did not load
the imagesLoaded jQuery extension. Now we have arranged it so that only the
forums topic view loads imagesLoaded and put the resizing javascript inline.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 11 Mar 2013 15:30:25 -0500 |
parents | d63c8ccc29a7 |
children | 73eb098761a1 |
files | forums/static/js/forums.js sg101/templates/forums/topic.html |
diffstat | 2 files changed, 15 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/forums/static/js/forums.js Sun Mar 10 13:09:00 2013 -0500 +++ b/forums/static/js/forums.js Mon Mar 11 15:30:25 2013 -0500 @@ -287,14 +287,4 @@ } initAttachments(); - - $('div.forum-post-body img').imagesLoaded(function($images, $proper, $broken) { - $proper.each(function(index) { - var $pic = $(this); - if ($pic.width() > 660) { - $pic.css('width', '660px'); - $pic.wrap($('<a/>').attr('href', $pic.attr('src')).attr('title', 'Click to view full size')); - } - }); - }); });
--- a/sg101/templates/forums/topic.html Sun Mar 10 13:09:00 2013 -0500 +++ b/sg101/templates/forums/topic.html Mon Mar 11 15:30:25 2013 -0500 @@ -11,6 +11,21 @@ {% script_tags 'imagesloaded' %} {{ form.media }} {% include "forums/jump_box.js" %} +<script type="text/javascript"> +//<![CDATA[ +$(document).ready(function() { + $('div.forum-post-body img').imagesLoaded(function($images, $proper, $broken) { + $proper.each(function(index) { + var $pic = $(this); + if ($pic.width() > 660) { + $pic.css('width', '660px'); + $pic.wrap($('<a/>').attr('href', $pic.attr('src')).attr('title', 'Click to view full size')); + } + }); + }); +}); +//]]> +</script> {% endblock %} {% block content %} {% forum_navigation topic %}