1
0
mirror of https://github.com/vichan-devel/vichan.git synced 2024-11-24 23:50:11 +01:00
This commit is contained in:
8chan 2015-02-26 02:07:22 +00:00
parent 4b8eddbaf6
commit 652497ad57
2 changed files with 28 additions and 0 deletions

View File

@ -144,6 +144,7 @@
$config['additional_javascript'][] = 'js/flag-previews.js';
$config['additional_javascript'][] = 'js/post-filter.js';
$config['additional_javascript'][] = 'js/image-hover.js';
$config['additional_javascript'][] = 'js/auto-scroll.js';
//$config['font_awesome_css'] = '/netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css';

27
js/auto-scroll.js Normal file
View 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));
}
});
}
});