From f2a673eef1624acd96a491936d9e7f0c7ba8220e Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 12 Feb 2012 19:12:53 +0100 Subject: [PATCH] We most likely will only use the anchor of the thumbnail, not the thumbnail itself. This should be quite faster. --- 4chan_x.user.js | 8 ++++---- script.coffee | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index cc9a75803..8750895d2 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -2652,11 +2652,11 @@ href = link.replace(/(\$\d)/, function(fragment) { switch (fragment) { case '$1': - return "http://thumbs.4chan.org' + img.parentNode.pathname.replace(/src(\\/\\d+).+$/, 'thumb$1s.jpg') + '"; + return "http://thumbs.4chan.org' + img.pathname.replace(/src(\\/\\d+).+$/, 'thumb$1s.jpg') + '"; case '$2': - return "' + img.parentNode.href + '"; + return "' + img.href + '"; case '$3': - return "' + img.getAttribute('md5').replace(/\=*$/, '') + '"; + return "' + img.firstChild.getAttribute('md5').replace(/\=*$/, '') + '"; } }); href = Function('img', "return '" + href + "'"); @@ -2671,7 +2671,7 @@ node: function(root) { var img, link, span, _i, _len, _ref; if (root.className === 'inline' || !(span = $('.filesize', root))) return; - img = $('img', root); + img = span.nextElementSibling.nextElementSibling; _ref = sauce.links; for (_i = 0, _len = _ref.length; _i < _len; _i++) { link = _ref[_i]; diff --git a/script.coffee b/script.coffee index a2a5dd09a..280717d8f 100644 --- a/script.coffee +++ b/script.coffee @@ -2102,11 +2102,11 @@ sauce = href = link.replace /(\$\d)/, (fragment) -> switch fragment when '$1' - "http://thumbs.4chan.org' + img.parentNode.pathname.replace(/src(\\/\\d+).+$/, 'thumb$1s.jpg') + '" + "http://thumbs.4chan.org' + img.pathname.replace(/src(\\/\\d+).+$/, 'thumb$1s.jpg') + '" when '$2' - "' + img.parentNode.href + '" + "' + img.href + '" when '$3' - "' + img.getAttribute('md5').replace(/\=*$/, '') + '" + "' + img.firstChild.getAttribute('md5').replace(/\=*$/, '') + '" href = Function 'img', "return '#{href}'" (img) -> $.el 'a', @@ -2116,7 +2116,7 @@ sauce = node: (root) -> return if root.className is 'inline' or not span = $ '.filesize', root - img = $ 'img', root + img = span.nextElementSibling.nextElementSibling for link in sauce.links $.add span, $.tn(' '), link img return