From eefcf6b0969d7111e9784f2ba4a6597224f371b2 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Sun, 17 Jun 2012 21:40:39 +0200 Subject: [PATCH] Deal with unavailable images. --- 4chan_x.user.js | 5 +++-- script.coffee | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 955f028f8..736fc6444 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -3141,7 +3141,7 @@ } }, parseArchivedPost: function(req, board, postID, root, cb) { - var bq, br, capcode, data, email, file, filename, filesize, isOP, max, name, nameBlock, pc, pi, piM, span, subject, threadID, timestamp, trip; + var bq, br, capcode, data, email, file, filename, filesize, isOP, max, name, nameBlock, pc, pi, piM, span, subject, threadID, thumb_src, timestamp, trip; data = JSON.parse(req.response); $.addClass(root, 'archivedPost'); if (data.error) { @@ -3280,11 +3280,12 @@ span.title = filename; max = isOP ? 40 : 30; span.textContent = filename.replace(/\.\w+$/, '').length > max ? "" + filename.slice(0, max) + "(...)" + (filename.match(/\.\w+$/)) : filename; + thumb_src = data.media_status === 'available' ? "src=" + data.thumb_link : ''; $.add(file, $.el('a', { className: 'fileThumb', href: data.media_link || data.remote_media_link, target: '_blank', - innerHTML: "" + (data.spoiler === " + innerHTML: "" + (data.media_status !== " })); $.after((isOP ? piM : pi), file); } diff --git a/script.coffee b/script.coffee index ded82224a..31a202c1f 100644 --- a/script.coffee +++ b/script.coffee @@ -2568,11 +2568,12 @@ Get = "#{filename[...max]}(...)#{filename.match(/\.\w+$/)}" else filename + thumb_src = if data.media_status is 'available' then "src=#{data.thumb_link}" else '' $.add file, $.el 'a', className: 'fileThumb' href: data.media_link or data.remote_media_link target: '_blank' - innerHTML: "#{if data.spoiler is " + innerHTML: "#{if data.media_status isnt " $.after (if isOP then piM else pi), file $.replace root.firstChild, pc