diff --git a/4chan_x.user.js b/4chan_x.user.js
index e5e2d61e2..ed337dab3 100644
--- a/4chan_x.user.js
+++ b/4chan_x.user.js
@@ -2181,7 +2181,7 @@
: \
Link: %l (lowercase L)\
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)\
- Resolution: %r (Displays PDF on /po/, for PDF\'s)\
+ Resolution: %r (Displays PDF on /po/, for PDFs)\
Reply File Info Formatting\
: \
All thread formatters also work for reply formatting.\
@@ -2941,7 +2941,7 @@
var fullname, link, node, regexp, resolution, shortname, size, type, unit, _, _ref;
if (root.className === 'inline' || !(node = $('.filesize', root))) return;
type = node.childElementCount === 2 ? 0 : 1;
- regexp = [/File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s([^<]+)/, /File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/][type];
+ regexp = type ? /^File: (<.+>)-\((?:Spoiler Image, )?([\d\.]+) (\w+), (\d+x\d+|PDF)/ : /^File: (<.+>)-\((?:Spoiler Image, )?([\d\.]+) (\w+), (\d+x\d+|PDF), ([^<]+)/;
_ref = node.innerHTML.match(regexp), _ = _ref[0], link = _ref[1], size = _ref[2], unit = _ref[3], resolution = _ref[4], fullname = _ref[5], shortname = _ref[6];
FileInfo.data = {
link: link,
@@ -2958,8 +2958,8 @@
var code, format, funks, i, param;
funks = [];
for (i = 0; i <= 1; i++) {
- format = conf[['fileInfoR', 'fileInfoT'][i]];
- param = [/%([BKlLMnNrs])/g, /%([BKlMrs])/g][i];
+ format = i ? conf['fileInfoT'] : conf['fileInfoR'];
+ param = i ? /%([BKlMrs])/g : /%([BKlLMnNrs])/g;
code = format.replace(param, function(s, c) {
if (c in FileInfo.formatters) {
return "' + f.formatters." + c + "() + '";
diff --git a/script.coffee b/script.coffee
index 70a48ac68..a3d0a2d6f 100644
--- a/script.coffee
+++ b/script.coffee
@@ -1778,7 +1778,7 @@ options =
:
Link: %l (lowercase L)
Size: %B (Bytes), %K (KB), %M (MB), %s (4chan default)
- Resolution: %r (Displays PDF on /po/, for PDF\'s)
+ Resolution: %r (Displays PDF on /po/, for PDFs)
Reply File Info Formatting
:
All thread formatters also work for reply formatting.
@@ -2405,10 +2405,11 @@ FileInfo =
node: (root) ->
return if root.className is 'inline' or not node = $ '.filesize', root
type = if node.childElementCount is 2 then 0 else 1
- regexp = [
- /File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF),\s([^<]+)/
- /File:\s()-\((?:Spoiler Image,\s)?([\d\.]+)\s([BKM]{1,2}),\s(\d+x\d+|PDF)\)/
- ][type]
+ regexp =
+ if type
+ /^File: (<.+>)-\((?:Spoiler Image, )?([\d\.]+) (\w+), (\d+x\d+|PDF)/
+ else
+ /^File: (<.+>)-\((?:Spoiler Image, )?([\d\.]+) (\w+), (\d+x\d+|PDF), ([^<]+)/
[_, link, size, unit, resolution, fullname, shortname] =
node.innerHTML.match regexp
FileInfo.data =
@@ -2423,8 +2424,8 @@ FileInfo =
setFormats: ->
funks = []
for i in [0..1]
- format = conf[['fileInfoR', 'fileInfoT'][i]]
- param = [/%([BKlLMnNrs])/g, /%([BKlMrs])/g][i]
+ format = if i then conf['fileInfoT'] else conf['fileInfoR']
+ param = if i then /%([BKlMrs])/g else /%([BKlLMnNrs])/g
code = format.replace param, (s, c) ->
if c of FileInfo.formatters
"' + f.formatters.#{c}() + '"