Make post and clone file parsing are consistent.

This commit is contained in:
ccd0 2015-03-25 02:20:12 -07:00
parent b9c440de4a
commit 4c9c386429
2 changed files with 3 additions and 2 deletions

View File

@ -58,6 +58,7 @@ class Clone extends Post
@file[key] = val
file = $ '.file', post
@file.text = file.firstElementChild
@file.link = $ '.fileText > a, .original-file-info > a', file
@file.thumb = $ '.fileThumb > [data-md5]', file
@file.fullImage = $ '.full-image', file
@file.videoControls = $ '.video-controls', @file.text

View File

@ -164,7 +164,7 @@ class Post
parseFile: ->
return unless fileEl = $ '.file', @nodes.post
return unless link = $ '.fileText > a', fileEl
return unless link = $ '.fileText > a, .original-file-info > a', fileEl
return unless info = link.nextSibling?.textContent.match /\(([\d.]+ [KMG]?B).*\)/
fileText = fileEl.firstElementChild
@file =
@ -180,7 +180,7 @@ class Post
unit = ['B', 'KB', 'MB', 'GB'].indexOf @file.size.match(/\w+$/)[0]
size *= 1024 while unit-- > 0
@file.sizeInBytes = size
if (thumb = $ 'img[data-md5]', fileEl)
if (thumb = $ '.fileThumb > [data-md5]', fileEl)
$.extend @file,
thumb: thumb
thumbURL: "#{location.protocol}//i.4cdn.org/#{@board}/#{link.href.match(/(\d+)\./)[1]}s.jpg"