Third attempt: Fix conflict with 4chan imgur thumbnail script. #363
This commit is contained in:
parent
06c64fe02d
commit
f0be015897
@ -164,18 +164,18 @@ class Post
|
|||||||
|
|
||||||
parseFile: ->
|
parseFile: ->
|
||||||
return unless fileEl = $ '.file', @nodes.post
|
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
|
fileText = fileEl.firstElementChild
|
||||||
info = link.nextSibling.textContent
|
|
||||||
@file =
|
@file =
|
||||||
text: fileText
|
text: fileText
|
||||||
link: link
|
link: link
|
||||||
URL: link.href
|
URL: link.href
|
||||||
name: fileText.title or link.title or link.textContent
|
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
|
isImage: /(jpg|png|gif)$/i.test link.href
|
||||||
isVideo: /webm$/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]
|
size = +@file.size.match(/[\d.]+/)[0]
|
||||||
unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0]
|
unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0]
|
||||||
size *= 1024 while unit-- > 0
|
size *= 1024 while unit-- > 0
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user