gallery thumbnail shouldn't clone contracted image/video

This commit is contained in:
ccd0 2014-04-07 13:30:12 -07:00
parent a35f547cdd
commit e69d6b2e7c
3 changed files with 35 additions and 29 deletions

View File

@ -7346,18 +7346,20 @@
return nodes.total.textContent = --i;
},
generateThumb: function(file) {
var double, post, thumb, title;
var post, thumb, thumbImg, title;
post = Get.postFromNode(file);
title = ($('.fileText a', file)).textContent;
thumb = post.file.thumb.parentNode.cloneNode(true);
if (double = $('img + img', thumb)) {
$.rm(double);
}
thumb.className = 'gal-thumb';
thumb.title = title;
thumb.dataset.id = Gallery.images.length;
thumb.dataset.post = $('a[title="Highlight this post"]', post.nodes.info).href;
thumb.firstElementChild.style.cssText = '';
thumb = $.el('a', {
className: 'gal-thumb',
href: post.file.URL,
target: '_blank'
}, title = title, {
'data-id': Gallery.images.length,
'data-post': $('a[title="Highlight this post"]', post.nodes.info).href
});
thumbImg = post.file.thumb.cloneNode(false);
thumbImg.style.cssText = '';
$.add(thumb, thumbImg);
$.on(thumb, 'click', Gallery.cb.open);
Gallery.images.push(thumb);
return $.add(Gallery.nodes.thumbs, thumb);

View File

@ -7365,18 +7365,20 @@
return nodes.total.textContent = --i;
},
generateThumb: function(file) {
var double, post, thumb, title;
var post, thumb, thumbImg, title;
post = Get.postFromNode(file);
title = ($('.fileText a', file)).textContent;
thumb = post.file.thumb.parentNode.cloneNode(true);
if (double = $('img + img', thumb)) {
$.rm(double);
}
thumb.className = 'gal-thumb';
thumb.title = title;
thumb.dataset.id = Gallery.images.length;
thumb.dataset.post = $('a[title="Highlight this post"]', post.nodes.info).href;
thumb.firstElementChild.style.cssText = '';
thumb = $.el('a', {
className: 'gal-thumb',
href: post.file.URL,
target: '_blank'
}, title = title, {
'data-id': Gallery.images.length,
'data-post': $('a[title="Highlight this post"]', post.nodes.info).href
});
thumbImg = post.file.thumb.cloneNode(false);
thumbImg.style.cssText = '';
$.add(thumb, thumbImg);
$.on(thumb, 'click', Gallery.cb.open);
Gallery.images.push(thumb);
return $.add(Gallery.nodes.thumbs, thumb);

View File

@ -106,16 +106,18 @@ Gallery =
generateThumb: (file) ->
post = Get.postFromNode file
title = ($ '.fileText a', file).textContent
thumb = post.file.thumb.parentNode.cloneNode true
if double = $ 'img + img', thumb
$.rm double
thumb.className = 'gal-thumb'
thumb.title = title
thumb.dataset.id = Gallery.images.length
thumb.dataset.post = $('a[title="Highlight this post"]', post.nodes.info).href
thumb.firstElementChild.style.cssText = ''
thumb = $.el 'a',
className: 'gal-thumb'
href: post.file.URL
target: '_blank'
title = title
'data-id': Gallery.images.length
'data-post': $('a[title="Highlight this post"]', post.nodes.info).href
thumbImg = post.file.thumb.cloneNode false
thumbImg.style.cssText = ''
$.add thumb, thumbImg
$.on thumb, 'click', Gallery.cb.open
Gallery.images.push thumb