diff --git a/builds/4chan-X.user.js b/builds/4chan-X.user.js index 790422594..b458f233c 100644 --- a/builds/4chan-X.user.js +++ b/builds/4chan-X.user.js @@ -3240,10 +3240,15 @@ } Navigate.title(); try { + pageNum || (pageNum = 0); if (req.status === 200) { Index.parse(req.response, pageNum); } else if (req.status === 304) { - Index.pageNav(pageNum || 0); + if (Index.currentPage === pageNum) { + Index.buildIndex(); + } else { + Index.pageNav(pageNum); + } } } catch (_error) { err = _error; @@ -3266,7 +3271,7 @@ Index.parseThreadList(pages); Index.buildThreads(); Index.sort(); - if (pageNum != null) { + if ((pageNum != null) && Index.currentPage !== pageNum) { Index.pageNav(pageNum); return; } @@ -4016,6 +4021,7 @@ $.cache(url, function() { return Get.archivedPost(this, boardID, postID, root, context); }, { + responseType: 'json', withCredentials: url.archive.withCredentials }); } else { @@ -6775,6 +6781,9 @@ } QR.status(); QR.error(err); + if (QR.captcha.isEnabled) { + QR.captcha.setup(); + } return; } h1 = $('h1', resDoc); @@ -6805,6 +6814,9 @@ }); postsCount = QR.posts.length - 1; QR.cooldown.auto = postsCount && isReply; + if (QR.captcha.isEnabled && QR.cooldown.auto) { + QR.captcha.setup(); + } if (!(Conf['Persistent QR'] || QR.cooldown.auto)) { QR.close(); } else { @@ -8294,8 +8306,8 @@ return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover); }, catalogNode: function() { - var _ref, _ref1; - if (!(((_ref = this.thread.OP.file) != null ? _ref.isImage : void 0) || ((_ref1 = this.thread.OP.file) != null ? _ref1.isVideo : void 0))) { + var file; + if (!((file = this.thread.OP.file) && (file.isImage || file.isVideo))) { return; } return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover); diff --git a/builds/crx/script.js b/builds/crx/script.js index c09e4e100..79be81f36 100644 --- a/builds/crx/script.js +++ b/builds/crx/script.js @@ -3301,10 +3301,15 @@ } Navigate.title(); try { + pageNum || (pageNum = 0); if (req.status === 200) { Index.parse(req.response, pageNum); } else if (req.status === 304) { - Index.pageNav(pageNum || 0); + if (Index.currentPage === pageNum) { + Index.buildIndex(); + } else { + Index.pageNav(pageNum); + } } } catch (_error) { err = _error; @@ -3327,7 +3332,7 @@ Index.parseThreadList(pages); Index.buildThreads(); Index.sort(); - if (pageNum != null) { + if ((pageNum != null) && Index.currentPage !== pageNum) { Index.pageNav(pageNum); return; } @@ -4077,6 +4082,7 @@ $.cache(url, function() { return Get.archivedPost(this, boardID, postID, root, context); }, { + responseType: 'json', withCredentials: url.archive.withCredentials }); } else { @@ -6820,6 +6826,9 @@ } QR.status(); QR.error(err); + if (QR.captcha.isEnabled) { + QR.captcha.setup(); + } return; } h1 = $('h1', resDoc); @@ -6850,6 +6859,9 @@ }); postsCount = QR.posts.length - 1; QR.cooldown.auto = postsCount && isReply; + if (QR.captcha.isEnabled && QR.cooldown.auto) { + QR.captcha.setup(); + } if (!(Conf['Persistent QR'] || QR.cooldown.auto)) { QR.close(); } else { @@ -8322,8 +8334,8 @@ return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover); }, catalogNode: function() { - var _ref, _ref1; - if (!(((_ref = this.thread.OP.file) != null ? _ref.isImage : void 0) || ((_ref1 = this.thread.OP.file) != null ? _ref1.isVideo : void 0))) { + var file; + if (!((file = this.thread.OP.file) && (file.isImage || file.isVideo))) { return; } return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover); diff --git a/src/General/Get.coffee b/src/General/Get.coffee index 3e7367753..15d285552 100755 --- a/src/General/Get.coffee +++ b/src/General/Get.coffee @@ -104,6 +104,7 @@ Get = $.cache url, -> Get.archivedPost @, boardID, postID, root, context , + responseType: 'json' withCredentials: url.archive.withCredentials else $.addClass root, 'warning' diff --git a/src/General/Index.coffee b/src/General/Index.coffee index b48016e69..fac4f7bab 100644 --- a/src/General/Index.coffee +++ b/src/General/Index.coffee @@ -544,10 +544,14 @@ Index = Navigate.title() try + pageNum or= 0 if req.status is 200 Index.parse req.response, pageNum else if req.status is 304 - Index.pageNav pageNum or 0 + if Index.currentPage is pageNum + Index.buildIndex() + else + Index.pageNav pageNum catch err c.error "Index failure: #{err.message}", err.stack # network error or non-JSON content for example. @@ -568,7 +572,7 @@ Index = Index.parseThreadList pages Index.buildThreads() Index.sort() - if pageNum? + if pageNum? and Index.currentPage isnt pageNum Index.pageNav pageNum return Index.buildIndex() diff --git a/src/Images/ImageHover.coffee b/src/Images/ImageHover.coffee index b06b72f7a..15ba073b5 100755 --- a/src/Images/ImageHover.coffee +++ b/src/Images/ImageHover.coffee @@ -12,7 +12,7 @@ ImageHover = return unless @file?.isImage or @file?.isVideo $.on @file.thumb, 'mouseover', ImageHover.mouseover catalogNode: -> - return unless @thread.OP.file?.isImage or @thread.OP.file?.isVideo + return unless (file = @thread.OP.file) and (file.isImage or file.isVideo) $.on @nodes.thumb, 'mouseover', ImageHover.mouseover mouseover: (e) -> post = if $.hasClass @, 'thumb' diff --git a/src/Posting/QR.coffee b/src/Posting/QR.coffee index f21ffb0fe..66977c6ef 100644 --- a/src/Posting/QR.coffee +++ b/src/Posting/QR.coffee @@ -755,6 +755,7 @@ QR = QR.cooldown.auto = false QR.status() QR.error err + QR.captcha.setup() if QR.captcha.isEnabled return h1 = $ 'h1', resDoc @@ -789,6 +790,7 @@ QR = # Enable auto-posting if we have stuff left to post, disable it otherwise. postsCount = QR.posts.length - 1 QR.cooldown.auto = postsCount and isReply + QR.captcha.setup() if QR.captcha.isEnabled and QR.cooldown.auto unless Conf['Persistent QR'] or QR.cooldown.auto QR.close()