diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 706984be9..8b264a3f9 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -130,21 +130,21 @@ class Post thumb.src else "#{location.protocol}//t.4cdn.org/#{@board}/thumb/#{@file.URL.match(/(\d+)\./)[1]}s.jpg" + @file.isImage = /(jpg|png|gif)$/i.test @file.URL + @file.isVideo = /webm$/i.test @file.URL + if @file.isImage or @file.isVideo + @file.dimensions = fileText.childNodes[2].textContent.match(/\d+x\d+/)?[0] @file.name = fileText.title or do -> nameNode = $('span', fileText) or $('a', fileText) - nameNode.title or nameNode.textContent + nameNode?.title or nameNode?.textContent <% if (type === 'crx') { %> # replace %22 with quotes, see: # crbug.com/81193 # webk.it/62107 # https://www.w3.org/Bugs/Public/show_bug.cgi?id=16909 # http://www.whatwg.org/specs/web-apps/current-work/#multipart-form-data - @file.name = @file.name.replace /%22/g, '"' + @file.name = @file.name?.replace /%22/g, '"' <% } %> - @file.isImage = /(jpg|png|gif)$/i.test @file.URL - @file.isVideo = /webm$/i.test @file.URL - if @file.isImage or @file.isVideo - @file.dimensions = fileText.textContent.match(/\d+x\d+/)[0] cleanup: (root) -> for node in $$ '.mobile', root