Merge branch 'mayhem' into v3

Conflicts:
	CHANGELOG.md
	package.json
	src/General/Index.coffee
	src/Images/ImageHover.coffee
This commit is contained in:
Zixaphir 2014-04-06 11:43:35 -07:00
commit 7818dec073
6 changed files with 42 additions and 11 deletions

View File

@ -3240,10 +3240,15 @@
} }
Navigate.title(); Navigate.title();
try { try {
pageNum || (pageNum = 0);
if (req.status === 200) { if (req.status === 200) {
Index.parse(req.response, pageNum); Index.parse(req.response, pageNum);
} else if (req.status === 304) { } else if (req.status === 304) {
Index.pageNav(pageNum || 0); if (Index.currentPage === pageNum) {
Index.buildIndex();
} else {
Index.pageNav(pageNum);
}
} }
} catch (_error) { } catch (_error) {
err = _error; err = _error;
@ -3266,7 +3271,7 @@
Index.parseThreadList(pages); Index.parseThreadList(pages);
Index.buildThreads(); Index.buildThreads();
Index.sort(); Index.sort();
if (pageNum != null) { if ((pageNum != null) && Index.currentPage !== pageNum) {
Index.pageNav(pageNum); Index.pageNav(pageNum);
return; return;
} }
@ -4016,6 +4021,7 @@
$.cache(url, function() { $.cache(url, function() {
return Get.archivedPost(this, boardID, postID, root, context); return Get.archivedPost(this, boardID, postID, root, context);
}, { }, {
responseType: 'json',
withCredentials: url.archive.withCredentials withCredentials: url.archive.withCredentials
}); });
} else { } else {
@ -6775,6 +6781,9 @@
} }
QR.status(); QR.status();
QR.error(err); QR.error(err);
if (QR.captcha.isEnabled) {
QR.captcha.setup();
}
return; return;
} }
h1 = $('h1', resDoc); h1 = $('h1', resDoc);
@ -6805,6 +6814,9 @@
}); });
postsCount = QR.posts.length - 1; postsCount = QR.posts.length - 1;
QR.cooldown.auto = postsCount && isReply; QR.cooldown.auto = postsCount && isReply;
if (QR.captcha.isEnabled && QR.cooldown.auto) {
QR.captcha.setup();
}
if (!(Conf['Persistent QR'] || QR.cooldown.auto)) { if (!(Conf['Persistent QR'] || QR.cooldown.auto)) {
QR.close(); QR.close();
} else { } else {
@ -8294,8 +8306,8 @@
return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover); return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover);
}, },
catalogNode: function() { catalogNode: function() {
var _ref, _ref1; var file;
if (!(((_ref = this.thread.OP.file) != null ? _ref.isImage : void 0) || ((_ref1 = this.thread.OP.file) != null ? _ref1.isVideo : void 0))) { if (!((file = this.thread.OP.file) && (file.isImage || file.isVideo))) {
return; return;
} }
return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover); return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover);

View File

@ -3301,10 +3301,15 @@
} }
Navigate.title(); Navigate.title();
try { try {
pageNum || (pageNum = 0);
if (req.status === 200) { if (req.status === 200) {
Index.parse(req.response, pageNum); Index.parse(req.response, pageNum);
} else if (req.status === 304) { } else if (req.status === 304) {
Index.pageNav(pageNum || 0); if (Index.currentPage === pageNum) {
Index.buildIndex();
} else {
Index.pageNav(pageNum);
}
} }
} catch (_error) { } catch (_error) {
err = _error; err = _error;
@ -3327,7 +3332,7 @@
Index.parseThreadList(pages); Index.parseThreadList(pages);
Index.buildThreads(); Index.buildThreads();
Index.sort(); Index.sort();
if (pageNum != null) { if ((pageNum != null) && Index.currentPage !== pageNum) {
Index.pageNav(pageNum); Index.pageNav(pageNum);
return; return;
} }
@ -4077,6 +4082,7 @@
$.cache(url, function() { $.cache(url, function() {
return Get.archivedPost(this, boardID, postID, root, context); return Get.archivedPost(this, boardID, postID, root, context);
}, { }, {
responseType: 'json',
withCredentials: url.archive.withCredentials withCredentials: url.archive.withCredentials
}); });
} else { } else {
@ -6820,6 +6826,9 @@
} }
QR.status(); QR.status();
QR.error(err); QR.error(err);
if (QR.captcha.isEnabled) {
QR.captcha.setup();
}
return; return;
} }
h1 = $('h1', resDoc); h1 = $('h1', resDoc);
@ -6850,6 +6859,9 @@
}); });
postsCount = QR.posts.length - 1; postsCount = QR.posts.length - 1;
QR.cooldown.auto = postsCount && isReply; QR.cooldown.auto = postsCount && isReply;
if (QR.captcha.isEnabled && QR.cooldown.auto) {
QR.captcha.setup();
}
if (!(Conf['Persistent QR'] || QR.cooldown.auto)) { if (!(Conf['Persistent QR'] || QR.cooldown.auto)) {
QR.close(); QR.close();
} else { } else {
@ -8322,8 +8334,8 @@
return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover); return $.on(this.file.thumb, 'mouseover', ImageHover.mouseover);
}, },
catalogNode: function() { catalogNode: function() {
var _ref, _ref1; var file;
if (!(((_ref = this.thread.OP.file) != null ? _ref.isImage : void 0) || ((_ref1 = this.thread.OP.file) != null ? _ref1.isVideo : void 0))) { if (!((file = this.thread.OP.file) && (file.isImage || file.isVideo))) {
return; return;
} }
return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover); return $.on(this.nodes.thumb, 'mouseover', ImageHover.mouseover);

View File

@ -104,6 +104,7 @@ Get =
$.cache url, $.cache url,
-> Get.archivedPost @, boardID, postID, root, context -> Get.archivedPost @, boardID, postID, root, context
, ,
responseType: 'json'
withCredentials: url.archive.withCredentials withCredentials: url.archive.withCredentials
else else
$.addClass root, 'warning' $.addClass root, 'warning'

View File

@ -544,10 +544,14 @@ Index =
Navigate.title() Navigate.title()
try try
pageNum or= 0
if req.status is 200 if req.status is 200
Index.parse req.response, pageNum Index.parse req.response, pageNum
else if req.status is 304 else if req.status is 304
Index.pageNav pageNum or 0 if Index.currentPage is pageNum
Index.buildIndex()
else
Index.pageNav pageNum
catch err catch err
c.error "Index failure: #{err.message}", err.stack c.error "Index failure: #{err.message}", err.stack
# network error or non-JSON content for example. # network error or non-JSON content for example.
@ -568,7 +572,7 @@ Index =
Index.parseThreadList pages Index.parseThreadList pages
Index.buildThreads() Index.buildThreads()
Index.sort() Index.sort()
if pageNum? if pageNum? and Index.currentPage isnt pageNum
Index.pageNav pageNum Index.pageNav pageNum
return return
Index.buildIndex() Index.buildIndex()

View File

@ -12,7 +12,7 @@ ImageHover =
return unless @file?.isImage or @file?.isVideo return unless @file?.isImage or @file?.isVideo
$.on @file.thumb, 'mouseover', ImageHover.mouseover $.on @file.thumb, 'mouseover', ImageHover.mouseover
catalogNode: -> 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 $.on @nodes.thumb, 'mouseover', ImageHover.mouseover
mouseover: (e) -> mouseover: (e) ->
post = if $.hasClass @, 'thumb' post = if $.hasClass @, 'thumb'

View File

@ -755,6 +755,7 @@ QR =
QR.cooldown.auto = false QR.cooldown.auto = false
QR.status() QR.status()
QR.error err QR.error err
QR.captcha.setup() if QR.captcha.isEnabled
return return
h1 = $ 'h1', resDoc h1 = $ 'h1', resDoc
@ -789,6 +790,7 @@ QR =
# Enable auto-posting if we have stuff left to post, disable it otherwise. # Enable auto-posting if we have stuff left to post, disable it otherwise.
postsCount = QR.posts.length - 1 postsCount = QR.posts.length - 1
QR.cooldown.auto = postsCount and isReply 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 unless Conf['Persistent QR'] or QR.cooldown.auto
QR.close() QR.close()