We (Still) Hate Console Errors 3.0
This commit is contained in:
parent
505f2b9437
commit
5823da664d
@ -6413,8 +6413,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var ID, post, posts, _ref,
|
var ID, post, posts, _ref;
|
||||||
_this = this;
|
|
||||||
|
|
||||||
Unread.thread = this;
|
Unread.thread = this;
|
||||||
Unread.title = d.title;
|
Unread.title = d.title;
|
||||||
@ -6437,31 +6436,29 @@
|
|||||||
if (Conf['Unread Line']) {
|
if (Conf['Unread Line']) {
|
||||||
$.on(d, 'visibilitychange', Unread.setLine);
|
$.on(d, 'visibilitychange', Unread.setLine);
|
||||||
}
|
}
|
||||||
if (Conf['Scroll to Last Read Post']) {
|
if (!Conf['Scroll to Last Read Post']) {
|
||||||
return $.on(window, 'load', function(posts) {
|
|
||||||
return Unread.scroll.apply(_this, posts);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scroll: function(posts) {
|
|
||||||
var hash, root;
|
|
||||||
|
|
||||||
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Unread.posts.length) {
|
return $.on(window, 'load', function() {
|
||||||
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
|
var hash, root;
|
||||||
if (!(Get.postFromRoot(root)).isHidden) {
|
|
||||||
break;
|
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!root) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return root.scrollIntoView(false);
|
if (Unread.posts.length) {
|
||||||
} else if (posts.length) {
|
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
|
||||||
return Header.scrollToPost(posts[post.length - 1].nodes.root);
|
if (!(Get.postFromRoot(root)).isHidden) {
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!root) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return root.scrollIntoView(false);
|
||||||
|
} else if (posts.length) {
|
||||||
|
return Header.scrollToPost(posts[posts.length - 1].nodes.root);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
sync: function() {
|
sync: function() {
|
||||||
var lastReadPost;
|
var lastReadPost;
|
||||||
|
|||||||
@ -6404,8 +6404,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var ID, post, posts, _ref,
|
var ID, post, posts, _ref;
|
||||||
_this = this;
|
|
||||||
|
|
||||||
Unread.thread = this;
|
Unread.thread = this;
|
||||||
Unread.title = d.title;
|
Unread.title = d.title;
|
||||||
@ -6428,31 +6427,29 @@
|
|||||||
if (Conf['Unread Line']) {
|
if (Conf['Unread Line']) {
|
||||||
$.on(d, 'visibilitychange', Unread.setLine);
|
$.on(d, 'visibilitychange', Unread.setLine);
|
||||||
}
|
}
|
||||||
if (Conf['Scroll to Last Read Post']) {
|
if (!Conf['Scroll to Last Read Post']) {
|
||||||
return $.on(window, 'load', function(posts) {
|
|
||||||
return Unread.scroll.apply(_this, posts);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scroll: function(posts) {
|
|
||||||
var hash, root;
|
|
||||||
|
|
||||||
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Unread.posts.length) {
|
return $.on(window, 'load', function() {
|
||||||
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
|
var hash, root;
|
||||||
if (!(Get.postFromRoot(root)).isHidden) {
|
|
||||||
break;
|
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!root) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return root.scrollIntoView(false);
|
if (Unread.posts.length) {
|
||||||
} else if (posts.length) {
|
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
|
||||||
return Header.scrollToPost(posts[post.length - 1].nodes.root);
|
if (!(Get.postFromRoot(root)).isHidden) {
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!root) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return root.scrollIntoView(false);
|
||||||
|
} else if (posts.length) {
|
||||||
|
return Header.scrollToPost(posts[posts.length - 1].nodes.root);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
sync: function() {
|
sync: function() {
|
||||||
var lastReadPost;
|
var lastReadPost;
|
||||||
|
|||||||
@ -6327,8 +6327,7 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
node: function() {
|
node: function() {
|
||||||
var ID, post, posts, _ref,
|
var ID, post, posts, _ref;
|
||||||
_this = this;
|
|
||||||
|
|
||||||
Unread.thread = this;
|
Unread.thread = this;
|
||||||
Unread.title = d.title;
|
Unread.title = d.title;
|
||||||
@ -6351,31 +6350,29 @@
|
|||||||
if (Conf['Unread Line']) {
|
if (Conf['Unread Line']) {
|
||||||
$.on(d, 'visibilitychange', Unread.setLine);
|
$.on(d, 'visibilitychange', Unread.setLine);
|
||||||
}
|
}
|
||||||
if (Conf['Scroll to Last Read Post']) {
|
if (!Conf['Scroll to Last Read Post']) {
|
||||||
return $.on(window, 'load', function(posts) {
|
|
||||||
return Unread.scroll.apply(_this, posts);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
},
|
|
||||||
scroll: function(posts) {
|
|
||||||
var hash, root;
|
|
||||||
|
|
||||||
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Unread.posts.length) {
|
return $.on(window, 'load', function() {
|
||||||
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
|
var hash, root;
|
||||||
if (!(Get.postFromRoot(root)).isHidden) {
|
|
||||||
break;
|
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!root) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return root.scrollIntoView(false);
|
if (Unread.posts.length) {
|
||||||
} else if (posts.length) {
|
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
|
||||||
return Header.scrollToPost(posts[post.length - 1].nodes.root);
|
if (!(Get.postFromRoot(root)).isHidden) {
|
||||||
}
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!root) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return root.scrollIntoView(false);
|
||||||
|
} else if (posts.length) {
|
||||||
|
return Header.scrollToPost(posts[posts.length - 1].nodes.root);
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
sync: function() {
|
sync: function() {
|
||||||
var lastReadPost;
|
var lastReadPost;
|
||||||
|
|||||||
@ -26,22 +26,21 @@ Unread =
|
|||||||
$.on d, 'ThreadUpdate', Unread.onUpdate
|
$.on d, 'ThreadUpdate', Unread.onUpdate
|
||||||
$.on d, 'scroll visibilitychange', Unread.read
|
$.on d, 'scroll visibilitychange', Unread.read
|
||||||
$.on d, 'visibilitychange', Unread.setLine if Conf['Unread Line']
|
$.on d, 'visibilitychange', Unread.setLine if Conf['Unread Line']
|
||||||
if Conf['Scroll to Last Read Post']
|
|
||||||
$.on window, 'load', (posts) =>
|
|
||||||
Unread.scroll.apply @, posts
|
|
||||||
|
|
||||||
scroll: (posts) ->
|
return unless Conf['Scroll to Last Read Post']
|
||||||
# Let the header's onload callback handle it.
|
|
||||||
return if (hash = location.hash.match /\d+/) and hash[0] of @posts
|
$.on window, 'load', ->
|
||||||
if Unread.posts.length
|
# Let the header's onload callback handle it.
|
||||||
# Scroll to before the first unread post.
|
return if (hash = location.hash.match /\d+/) and hash[0] of @posts
|
||||||
while root = $.x 'preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root
|
if Unread.posts.length
|
||||||
break unless (Get.postFromRoot root).isHidden
|
# Scroll to before the first unread post.
|
||||||
return unless root
|
while root = $.x 'preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root
|
||||||
root.scrollIntoView false
|
break unless (Get.postFromRoot root).isHidden
|
||||||
else if posts.length
|
return unless root
|
||||||
# Scroll to the last read post.
|
root.scrollIntoView false
|
||||||
Header.scrollToPost (posts[post.length - 1]).nodes.root
|
else if posts.length
|
||||||
|
# Scroll to the last read post.
|
||||||
|
Header.scrollToPost (posts[posts.length - 1]).nodes.root
|
||||||
|
|
||||||
sync: ->
|
sync: ->
|
||||||
lastReadPost = Unread.db.get
|
lastReadPost = Unread.db.get
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user