We hate console errors.

This commit is contained in:
Zixaphir 2013-04-22 14:12:25 -07:00
parent 9e8e206157
commit 9cfc3cad05
5 changed files with 32 additions and 11 deletions

View File

@ -6351,7 +6351,8 @@
}); });
}, },
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;
@ -6375,7 +6376,9 @@
$.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', Unread.scroll); return $.on(window, 'load', function(posts) {
return Unread.scroll.apply(_this, posts);
});
} }
}, },
scroll: function() { scroll: function() {
@ -6390,9 +6393,12 @@
break; break;
} }
} }
if (!root) {
return;
}
return root.scrollIntoView(false); return root.scrollIntoView(false);
} else if (posts.length) { } else if (posts.length) {
return Header.scrollToPost(posts[posts.length - 1].nodes.root); return Header.scrollToPost(posts[post.length - 1].nodes.root);
} }
}, },
sync: function() { sync: function() {

View File

@ -6342,7 +6342,8 @@
}); });
}, },
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;
@ -6366,7 +6367,9 @@
$.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', Unread.scroll); return $.on(window, 'load', function(posts) {
return Unread.scroll.apply(_this, posts);
});
} }
}, },
scroll: function() { scroll: function() {
@ -6381,9 +6384,12 @@
break; break;
} }
} }
if (!root) {
return;
}
return root.scrollIntoView(false); return root.scrollIntoView(false);
} else if (posts.length) { } else if (posts.length) {
return Header.scrollToPost(posts[posts.length - 1].nodes.root); return Header.scrollToPost(posts[post.length - 1].nodes.root);
} }
}, },
sync: function() { sync: function() {

Binary file not shown.

View File

@ -6265,7 +6265,8 @@
}); });
}, },
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;
@ -6289,7 +6290,9 @@
$.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', Unread.scroll); return $.on(window, 'load', function(posts) {
return Unread.scroll.apply(_this, posts);
});
} }
}, },
scroll: function() { scroll: function() {
@ -6304,9 +6307,12 @@
break; break;
} }
} }
if (!root) {
return;
}
return root.scrollIntoView(false); return root.scrollIntoView(false);
} else if (posts.length) { } else if (posts.length) {
return Header.scrollToPost(posts[posts.length - 1].nodes.root); return Header.scrollToPost(posts[post.length - 1].nodes.root);
} }
}, },
sync: function() { sync: function() {

View File

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