Revert Mayhem's unread scrolling changes

Too buggy. Threads often don't scroll at all.
This commit is contained in:
Jordan Bates 2013-05-15 02:43:35 -07:00
parent 514450be9b
commit 68678e671a
5 changed files with 31 additions and 57 deletions

View File

@ -1,5 +1,5 @@
/*
* 4chan X - Version 1.2.4 - 2013-05-14
* 4chan X - Version 1.2.4 - 2013-05-15
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.2.4 - 2013-05-14
* 4chan X - Version 1.2.4 - 2013-05-15
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -7574,13 +7574,12 @@
}
}
Unread.addPosts(posts);
if (!Conf['Scroll to Last Read Post']) {
return;
if (Conf['Scroll to Last Read Post']) {
return Unread.scroll();
}
return Unread.scroll();
},
scroll: function() {
var hash, onload, post, posts, prevID, root;
var hash, post, posts, prevID, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
return;
@ -7597,17 +7596,11 @@
break;
}
}
onload = function() {
return root.scrollIntoView(false);
};
} else {
posts = Object.keys(Unread.thread.posts);
post = Unread.thread.posts[posts[posts.length - 1]];
onload = function() {
return Header.scrollToPost(post.nodes.root);
};
root.scrollIntoView(false);
return;
}
return $.on(window, 'load', onload);
posts = Object.keys(Unread.thread.posts);
return Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
},
sync: function() {
var lastReadPost;

View File

@ -19,7 +19,7 @@
// @icon data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAgMAAAAqbBEUAAAACVBMVEUAAGcAAABmzDNZt9VtAAAAAXRSTlMAQObYZgAAAHFJREFUKFOt0LENACEIBdBv4Qju4wgWanEj3D6OcIVMKaitYHEU/jwTCQj8W75kiVCSBvdQ5/AvfVHBin11BgdRq3ysBgfwBDRrj3MCIA+oAQaku/Q1cNctrAmyDl577tOThYt/Y1RBM4DgOHzM0HFTAyLukH/cmRnqAAAAAElFTkSuQmCC
// ==/UserScript==
/*
* 4chan X - Version 1.2.4 - 2013-05-14
* 4chan X - Version 1.2.4 - 2013-05-15
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -7583,13 +7583,12 @@
}
}
Unread.addPosts(posts);
if (!Conf['Scroll to Last Read Post']) {
return;
if (Conf['Scroll to Last Read Post']) {
return Unread.scroll();
}
return Unread.scroll();
},
scroll: function() {
var hash, onload, post, posts, prevID, root;
var hash, post, posts, prevID, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
return;
@ -7606,17 +7605,11 @@
break;
}
}
onload = function() {
return root.scrollIntoView(false);
};
} else {
posts = Object.keys(Unread.thread.posts);
post = Unread.thread.posts[posts[posts.length - 1]];
onload = function() {
return Header.scrollToPost(post.nodes.root);
};
root.scrollIntoView(false);
return;
}
return $.on(window, 'load', onload);
posts = Object.keys(Unread.thread.posts);
return Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
},
sync: function() {
var lastReadPost;

View File

@ -1,6 +1,6 @@
// Generated by CoffeeScript
/*
* 4chan X - Version 1.2.4 - 2013-05-14
* 4chan X - Version 1.2.4 - 2013-05-15
*
* Licensed under the MIT license.
* https://github.com/seaweedchan/4chan-x/blob/master/LICENSE
@ -7561,13 +7561,12 @@
}
}
Unread.addPosts(posts);
if (!Conf['Scroll to Last Read Post']) {
return;
if (Conf['Scroll to Last Read Post']) {
return Unread.scroll();
}
return Unread.scroll();
},
scroll: function() {
var hash, onload, post, posts, prevID, root;
var hash, post, posts, prevID, root;
if ((hash = location.hash.match(/\d+/)) && hash[0] in Unread.thread.posts) {
return;
@ -7584,17 +7583,11 @@
break;
}
}
onload = function() {
return root.scrollIntoView(false);
};
} else {
posts = Object.keys(Unread.thread.posts);
post = Unread.thread.posts[posts[posts.length - 1]];
onload = function() {
return Header.scrollToPost(post.nodes.root);
};
root.scrollIntoView(false);
return;
}
return $.on(window, 'load', onload);
posts = Object.keys(Unread.thread.posts);
return Header.scrollToPost(Unread.thread.posts[posts[posts.length - 1]].nodes.root);
},
sync: function() {
var lastReadPost;

View File

@ -30,8 +30,7 @@ Unread =
for ID, post of Unread.thread.posts
posts.push post if post.isReply
Unread.addPosts posts
return unless Conf['Scroll to Last Read Post']
Unread.scroll()
Unread.scroll() if Conf['Scroll to Last Read Post']
scroll: ->
# Let the header's onload callback handle it.
@ -44,15 +43,11 @@ Unread =
break if prevID is post.ID
prevID = post.ID
break unless post.isHidden
onload = -> root.scrollIntoView false
else
# Scroll to the last read post.
posts = Object.keys Unread.thread.posts
post = Unread.thread.posts[posts[posts.length - 1]]
onload = -> Header.scrollToPost post.nodes.root
# Prevent the browser to scroll back to
# the previous scroll location on page load.
$.on window, 'load', onload
root.scrollIntoView false
return
# Scroll to the last read post.
posts = Object.keys Unread.thread.posts
Header.scrollToPost Unread.thread.posts[posts[posts.length - 1]].nodes.root
sync: ->
lastReadPost = Unread.db.get