From 31ea04b8fe6f2c5b16e73b8ca5e75ae322f34616 Mon Sep 17 00:00:00 2001 From: James Campos Date: Wed, 24 Aug 2011 12:44:11 -0700 Subject: [PATCH] less fragile regex --- 4chan_x.user.js | 2 +- script.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/4chan_x.user.js b/4chan_x.user.js index edfec4277..c34143596 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -1232,7 +1232,7 @@ $.bind($('#recaptcha_challenge_field_holder'), 'DOMNodeInserted', qr.captchaNode); qr.captchaTime = Date.now(); qr.spoiler = $('.postarea label') ? '' : ''; - qr.acceptFiles = $('.rules').textContent.match(/: (.+) /)[1].replace(/[A-Z]{3}/g, function(type) { + qr.acceptFiles = $('.rules').textContent.match(/: (.+) /)[1].replace(/\w+/g, function(type) { switch (type) { case 'JPG': return 'image/JPEG'; diff --git a/script.coffee b/script.coffee index da08bf9f1..75e7e398f 100644 --- a/script.coffee +++ b/script.coffee @@ -976,7 +976,7 @@ qr = qr.captchaTime = Date.now() qr.spoiler = if $('.postarea label') then '' else '' - qr.acceptFiles = $('.rules').textContent.match(/: (.+) /)[1].replace /[A-Z]{3}/g, (type) -> + qr.acceptFiles = $('.rules').textContent.match(/: (.+) /)[1].replace /\w+/g, (type) -> switch type when 'JPG' 'image/JPEG'