Fix image expanding fitness with an inlined backlink on Firefox, close #26

This commit is contained in:
Nicolas Stepien 2011-12-04 17:51:58 +01:00
parent ce1daf656e
commit 688cf8aa13
3 changed files with 8 additions and 7 deletions

View File

@ -2873,15 +2873,15 @@
return $.rm(thumb.nextSibling); return $.rm(thumb.nextSibling);
}, },
expand: function(thumb) { expand: function(thumb) {
var a, filesize, img, max, _, _ref; var a, filesize, img, max;
a = thumb.parentNode; a = thumb.parentNode;
img = $.el('img', { img = $.el('img', {
src: a.href src: a.href
}); });
if (engine === 'gecko' && a.parentNode.className !== 'op') { if (engine === 'gecko' && a.parentNode.className !== 'op') {
filesize = $('.filesize', a.parentNode); filesize = $.x('preceding-sibling::span[@class="filesize"]', a).textContent;
_ref = filesize.textContent.match(/(\d+)x/), _ = _ref[0], max = _ref[1]; max = filesize.match(/(\d+)x/);
img.style.maxWidth = "" + max + "px"; img.style.maxWidth = "" + max[1] + "px";
} }
$.on(img, 'error', imgExpand.error); $.on(img, 'error', imgExpand.error);
thumb.hidden = true; thumb.hidden = true;

View File

@ -1,6 +1,7 @@
master master
- mayhem - mayhem
change 'Duckroll' for 'Cross-thread' change 'Duckroll' for 'Cross-thread'
fix image expanding fitness with an inlined backlink on Firefox
2.22.0 2.22.0
- mayhem - mayhem

View File

@ -2208,9 +2208,9 @@ imgExpand =
img = $.el 'img', img = $.el 'img',
src: a.href src: a.href
if engine is 'gecko' and a.parentNode.className isnt 'op' if engine is 'gecko' and a.parentNode.className isnt 'op'
filesize = $ '.filesize', a.parentNode filesize = $.x('preceding-sibling::span[@class="filesize"]', a).textContent
[_, max] = filesize.textContent.match /(\d+)x/ max = filesize.match /(\d+)x/
img.style.maxWidth = "#{max}px" img.style.maxWidth = "#{max[1]}px"
$.on img, 'error', imgExpand.error $.on img, 'error', imgExpand.error
thumb.hidden = true thumb.hidden = true
$.add a, img $.add a, img