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

View File

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

View File

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