Show More
@@ -97,8 +97,6 b' class PostImage(models.Model, Viewable):' | |||
|
97 | 97 | ' height="{}"' \ |
|
98 | 98 | ' data-width="{}"' \ |
|
99 | 99 | ' data-height="{}" />' \ |
|
100 | '<img class="post-image-full"' \ | |
|
101 | ' src="{full}" />' \ | |
|
102 | 100 | '</a>' \ |
|
103 | 101 | '</div>'\ |
|
104 | 102 | .format(CSS_CLASS_IMAGE, CSS_CLASS_THUMB, |
@@ -97,6 +97,5 b' textarea, input {' | |||
|
97 | 97 | } |
|
98 | 98 | |
|
99 | 99 | .post-image-full { |
|
100 | display: none; | |
|
101 | 100 | width: 100%; |
|
102 | 101 | } |
@@ -29,13 +29,28 b' var IMAGE_VIEWERS = [' | |||
|
29 | 29 | ['popup', new PopupImageViewer()] |
|
30 | 30 | ]; |
|
31 | 31 | |
|
32 | var FULL_IMG_CLASS = 'post-image-full'; | |
|
33 | ||
|
32 | 34 | |
|
33 | 35 | function ImageViewer() {} |
|
34 | 36 | ImageViewer.prototype.view = function (post) {}; |
|
35 | 37 | |
|
36 | 38 | function SimpleImageViewer() {} |
|
37 | 39 | SimpleImageViewer.prototype.view = function (post) { |
|
38 |
post.find('img') |
|
|
40 | var images = post.find('img'); | |
|
41 | images.toggle(); | |
|
42 | ||
|
43 | // When we first enlarge an image, a full image needs to be created | |
|
44 | if (images.length == 1) { | |
|
45 | var parent = images.first().parent(); | |
|
46 | var link = parent.attr('href'); | |
|
47 | ||
|
48 | var fullImg = $('<img />') | |
|
49 | .addClass(FULL_IMG_CLASS) | |
|
50 | .attr('src', link); | |
|
51 | ||
|
52 | parent.append(fullImg); | |
|
53 | } | |
|
39 | 54 | }; |
|
40 | 55 | |
|
41 | 56 | function PopupImageViewer() {} |
General Comments 0
You need to be logged in to leave comments.
Login now