We (Still) Hate Console Errors 3.0

This commit is contained in:
Jordan Bates 2013-04-22 22:10:45 -07:00
parent 505f2b9437
commit 5823da664d
4 changed files with 74 additions and 84 deletions

View File

@ -6413,8 +6413,7 @@
});
},
node: function() {
var ID, post, posts, _ref,
_this = this;
var ID, post, posts, _ref;
Unread.thread = this;
Unread.title = d.title;
@ -6437,31 +6436,29 @@
if (Conf['Unread Line']) {
$.on(d, 'visibilitychange', Unread.setLine);
}
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) {
if (!Conf['Scroll to Last Read Post']) {
return;
}
if (Unread.posts.length) {
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
if (!(Get.postFromRoot(root)).isHidden) {
break;
}
}
if (!root) {
return $.on(window, 'load', function() {
var hash, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
return;
}
return root.scrollIntoView(false);
} else if (posts.length) {
return Header.scrollToPost(posts[post.length - 1].nodes.root);
}
if (Unread.posts.length) {
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].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() {
var lastReadPost;

View File

@ -6404,8 +6404,7 @@
});
},
node: function() {
var ID, post, posts, _ref,
_this = this;
var ID, post, posts, _ref;
Unread.thread = this;
Unread.title = d.title;
@ -6428,31 +6427,29 @@
if (Conf['Unread Line']) {
$.on(d, 'visibilitychange', Unread.setLine);
}
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) {
if (!Conf['Scroll to Last Read Post']) {
return;
}
if (Unread.posts.length) {
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
if (!(Get.postFromRoot(root)).isHidden) {
break;
}
}
if (!root) {
return $.on(window, 'load', function() {
var hash, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
return;
}
return root.scrollIntoView(false);
} else if (posts.length) {
return Header.scrollToPost(posts[post.length - 1].nodes.root);
}
if (Unread.posts.length) {
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].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() {
var lastReadPost;

View File

@ -6327,8 +6327,7 @@
});
},
node: function() {
var ID, post, posts, _ref,
_this = this;
var ID, post, posts, _ref;
Unread.thread = this;
Unread.title = d.title;
@ -6351,31 +6350,29 @@
if (Conf['Unread Line']) {
$.on(d, 'visibilitychange', Unread.setLine);
}
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) {
if (!Conf['Scroll to Last Read Post']) {
return;
}
if (Unread.posts.length) {
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root)) {
if (!(Get.postFromRoot(root)).isHidden) {
break;
}
}
if (!root) {
return $.on(window, 'load', function() {
var hash, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in this.posts) {
return;
}
return root.scrollIntoView(false);
} else if (posts.length) {
return Header.scrollToPost(posts[post.length - 1].nodes.root);
}
if (Unread.posts.length) {
while (root = $.x('preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].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() {
var lastReadPost;

View File

@ -26,22 +26,21 @@ Unread =
$.on d, 'ThreadUpdate', Unread.onUpdate
$.on d, 'scroll visibilitychange', Unread.read
$.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) ->
# Let the header's onload callback handle it.
return if (hash = location.hash.match /\d+/) and hash[0] of @posts
if Unread.posts.length
# Scroll to before the first unread post.
while root = $.x 'preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root
break unless (Get.postFromRoot root).isHidden
return unless root
root.scrollIntoView false
else if posts.length
# Scroll to the last read post.
Header.scrollToPost (posts[post.length - 1]).nodes.root
return unless Conf['Scroll to Last Read Post']
$.on window, 'load', ->
# Let the header's onload callback handle it.
return if (hash = location.hash.match /\d+/) and hash[0] of @posts
if Unread.posts.length
# Scroll to before the first unread post.
while root = $.x 'preceding-sibling::div[contains(@class,"postContainer")][1]', Unread.posts[0].nodes.root
break unless (Get.postFromRoot root).isHidden
return unless root
root.scrollIntoView false
else if posts.length
# Scroll to the last read post.
Header.scrollToPost (posts[posts.length - 1]).nodes.root
sync: ->
lastReadPost = Unread.db.get