mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-23 23:20:57 +01:00
Merge
This commit is contained in:
parent
633c223282
commit
129eb154b3
27
js/auto-scroll.js
Normal file
27
js/auto-scroll.js
Normal file
@ -0,0 +1,27 @@
|
||||
$('document').ready(function () {
|
||||
var autoScroll = localStorage['autoScroll'] ? true : false;
|
||||
if (window.Options && Options.get_tab('general')){
|
||||
Options.extend_tab('general','<label id=\'autoScroll\'><input type=\'checkbox\' />' + ' Scroll to new posts' + '</label>');
|
||||
$('#autoScroll').find('input').prop('checked', autoScroll);
|
||||
}
|
||||
$('#autoScroll').on('change', function() {
|
||||
if(autoScroll) {
|
||||
delete localStorage.autoScroll;
|
||||
} else {
|
||||
localStorage.autoScroll = true;
|
||||
}
|
||||
autoScroll =! autoScroll
|
||||
if(active_page == 'thread')
|
||||
$('input.auto-scroll').prop('checked', autoScroll);
|
||||
});
|
||||
if (active_page == 'thread') {
|
||||
$('span[id="updater"]').children('a').after(' (<input class="auto-scroll" type="checkbox"></input> Scroll to New posts)');
|
||||
$('input.auto-scroll').prop('checked', autoScroll);
|
||||
$(document).on('new_post', function (e, post) {
|
||||
if ($('input.auto-scroll').prop('checked'))
|
||||
{
|
||||
scrollTo(0, $(post).offset().top - window.innerHeight + $(post).outerHeight(true));
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Loading…
Reference in New Issue
Block a user