From 4c9c386429137b4c43a4013accb6f9468ec333f9 Mon Sep 17 00:00:00 2001 From: ccd0 Date: Wed, 25 Mar 2015 02:20:12 -0700 Subject: [PATCH 1/2] Make post and clone file parsing are consistent. --- src/General/lib/clone.class | 1 + src/General/lib/post.class | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/General/lib/clone.class b/src/General/lib/clone.class index f0c42ecbf..288580e1f 100755 --- a/src/General/lib/clone.class +++ b/src/General/lib/clone.class @@ -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 diff --git a/src/General/lib/post.class b/src/General/lib/post.class index 5932cc30e..62fe25bff 100755 --- a/src/General/lib/post.class +++ b/src/General/lib/post.class @@ -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" From cd88f81230cee02d148b7240968c4275710a6c0f Mon Sep 17 00:00:00 2001 From: ccd0 Date: Wed, 25 Mar 2015 23:31:27 -0700 Subject: [PATCH 2/2] More accurate test for dumping to a thread from the index. --- src/Posting/QR.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index fae04f21a..0835e5d9e 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -748,6 +748,8 @@ QR = postsCount = QR.posts.length - 1 QR.cooldown.auto = postsCount and isReply + lastPostToThread = not (do -> return true for p in QR.posts[1..] when p.thread is post.thread) + unless Conf['Persistent QR'] or postsCount QR.close() else @@ -758,7 +760,7 @@ QR = URL = if threadID is postID # new thread "#{window.location.origin}/#{g.BOARD}/thread/#{threadID}" - else if g.VIEW is 'index' and !QR.cooldown.auto and Conf['Open Post in New Tab'] # replying from the index + else if g.VIEW is 'index' and lastPostToThread and Conf['Open Post in New Tab'] # replying from the index "#{window.location.origin}/#{g.BOARD}/thread/#{threadID}#p#{postID}" if URL