From 823450400ba0ecfce13949d6cfc6902f21ad9a51 Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 25 Jun 2012 15:34:27 +0200 Subject: [PATCH 1/2] Add SWF files to the allowed mimetypes for /f/. --- 4chan_x.user.js | 4 +++- script.coffee | 8 +++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index 026839f3f..af4c43ba5 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1730,7 +1730,7 @@ if (QR.spoiler) { $('label', this.el).hidden = false; } - if (file.type === 'application/pdf') { + if (!/^image/.test(file.type)) { this.el.style.backgroundImage = null; return; } @@ -1997,6 +1997,8 @@ return 'image/jpeg'; case 'pdf': return 'application/pdf'; + case 'swf': + return 'application/x-shockwave-flash'; default: return "image/" + type; } diff --git a/script.coffee b/script.coffee index dda4f90c4..d46eb5d22 100644 --- a/script.coffee +++ b/script.coffee @@ -1284,7 +1284,7 @@ QR = setFile: (@file) -> @el.title = "#{file.name} (#{$.bytesToString file.size})" $('label', @el).hidden = false if QR.spoiler - if file.type is 'application/pdf' + unless /^image/.test file.type @el.style.backgroundImage = null return url = window.URL or window.webkitURL @@ -1408,8 +1408,8 @@ QR = $.after $('.captchaimg', QR.el), $.el 'div', className: 'captchainput' innerHTML: '' - @img = $ '.captchaimg > img', QR.el - @input = $ '.captchainput > input', QR.el + @img = $ '.captchaimg > img', QR.el + @input = $ '.captchainput > input', QR.el $.on @img.parentNode, 'click', @reload $.on @input, 'keydown', @keydown $.on @challenge, 'DOMNodeInserted', => @load() @@ -1489,6 +1489,8 @@ QR = 'image/jpeg' when 'pdf' 'application/pdf' + when 'swf' + 'application/x-shockwave-flash' else "image/#{type}" QR.mimeTypes = mimeTypes.split ', ' From 9dfec946315c5f20d246969c18fcfff3f14e5fab Mon Sep 17 00:00:00 2001 From: Nicolas Stepien Date: Mon, 25 Jun 2012 16:15:14 +0200 Subject: [PATCH 2/2] rm comment --- script.coffee | 1 - 1 file changed, 1 deletion(-) diff --git a/script.coffee b/script.coffee index d46eb5d22..faf99c37e 100644 --- a/script.coffee +++ b/script.coffee @@ -2482,7 +2482,6 @@ Get = ] {capcode} = data if capcode isnt 'N' # 'A'dmin or 'M'od - # XXX not sure if this is correct for mods $.addClass br.parentNode, if capcode is 'A' then 'capcodeAdmin' else 'capcodeMod' $.before br, [ $.tn(' '),