From f0be015897f38e9c73d44b0c5b764d15bff12058 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Sun, 22 Mar 2015 23:00:45 -0700 Subject: [PATCH] Third attempt: Fix conflict with 4chan imgur thumbnail script. #363 --- src/General/lib/post.class | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 45e2a2c93..5932cc30e 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -164,18 +164,18 @@ class Post parseFile: -> return unless fileEl = $ '.file', @nodes.post - return unless link = $ '.fileText > a:first-child', fileEl + return unless link = $ '.fileText > a', fileEl + return unless info = link.nextSibling?.textContent.match /\(([\d.]+ [KMG]?B).*\)/ fileText = fileEl.firstElementChild - info = link.nextSibling.textContent @file = text: fileText link: link URL: link.href name: fileText.title or link.title or link.textContent - size: info.match(/[\d.]+\s\w+/)[0] + size: info[1] isImage: /(jpg|png|gif)$/i.test link.href isVideo: /webm$/i.test link.href - dimensions: info.match(/\d+x\d+/)?[0] + dimensions: info[0].match(/\d+x\d+/)?[0] size = +@file.size.match(/[\d.]+/)[0] unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0] size *= 1024 while unit-- > 0