##// END OF EJS Templates
Load full images only on click is simple image viewer is enabled
neko259 -
r1128:83db86e2 default
parent child Browse files
Show More
@@ -97,8 +97,6 b' class PostImage(models.Model, Viewable):'
97 ' height="{}"' \
97 ' height="{}"' \
98 ' data-width="{}"' \
98 ' data-width="{}"' \
99 ' data-height="{}" />' \
99 ' data-height="{}" />' \
100 '<img class="post-image-full"' \
101 ' src="{full}" />' \
102 '</a>' \
100 '</a>' \
103 '</div>'\
101 '</div>'\
104 .format(CSS_CLASS_IMAGE, CSS_CLASS_THUMB,
102 .format(CSS_CLASS_IMAGE, CSS_CLASS_THUMB,
@@ -97,6 +97,5 b' textarea, input {'
97 }
97 }
98
98
99 .post-image-full {
99 .post-image-full {
100 display: none;
101 width: 100%;
100 width: 100%;
102 }
101 }
@@ -29,13 +29,28 b' var IMAGE_VIEWERS = ['
29 ['popup', new PopupImageViewer()]
29 ['popup', new PopupImageViewer()]
30 ];
30 ];
31
31
32 var FULL_IMG_CLASS = 'post-image-full';
33
32
34
33 function ImageViewer() {}
35 function ImageViewer() {}
34 ImageViewer.prototype.view = function (post) {};
36 ImageViewer.prototype.view = function (post) {};
35
37
36 function SimpleImageViewer() {}
38 function SimpleImageViewer() {}
37 SimpleImageViewer.prototype.view = function (post) {
39 SimpleImageViewer.prototype.view = function (post) {
38 post.find('img').toggle();
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 function PopupImageViewer() {}
56 function PopupImageViewer() {}
General Comments 0
You need to be logged in to leave comments. Login now