1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-01 05:55:02 +03:00

Доработка пагинации

This commit is contained in:
Denis Shakhov 2014-06-17 16:52:43 +07:00
parent 99711f4ef6
commit b451330a50
2 changed files with 30 additions and 10 deletions

View file

@ -44,27 +44,47 @@
* @private
*/
_create: function () {
this.document = $(document);
this.elements = {
document: $(document),
next: this.element.find(this.options.selectors.next),
prev: this.element.find(this.options.selectors.prev)
};
this.next = this.element.find(this.options.selectors.next);
this.prev = this.element.find(this.options.selectors.prev);
this.elements.document.bind( 'keydown', this.options.keys.next, this.next.bind(this, false) );
this.elements.document.bind( 'keydown', this.options.keys.prev, this.prev.bind(this, false) );
},
this.document.bind('keydown', this.options.keys.next, this.goNext.bind(this));
this.document.bind('keydown', this.options.keys.prev, this.goPrev.bind(this));
/**
* Переход на страницу
*
* @param {String} name Название функции
*/
_go: function ( name ) {
return function( useHash ) {
if ( this.elements[ name ].length ) {
window.location = this.elements[ name ].attr('href') + ( this.options.hash[ name ] && useHash ? '#' + this.options.hash[ name ] : '' );
} else {
ls.msg.error( null, name == 'next' ? ls.lang.get('pagination.notices.last') : ls.lang.get('pagination.notices.first') );
}
}
},
/**
* Переход на следующую страницу
*
* @param {Boolean} useHash Добавлять параметр gotopic в хэш или нет
*/
goNext: function () {
if ( this.next.length ) window.location = this.next.attr('href') + ( this.options.hash.next ? '#' + this.options.hash.next : '' );
next: function ( useHash ) {
return this._go( 'next' ).apply(this, arguments);
},
/**
* Переход на предыдущую страницу
*
* @param {Boolean} useHash Добавлять параметр gotopic в хэш или нет
*/
goPrev: function () {
if ( this.prev.length ) window.location = this.prev.attr('href') + ( this.options.hash.prev ? '#' + this.options.hash.prev : '' );
prev: function ( useHash ) {
return this._go( 'prev' ).apply(this, arguments);
}
});
})(jQuery);

View file

@ -11,7 +11,7 @@
{block 'layout_head' append}
<script>
ls.lang.load({json var = $aLangJs});
ls.lang.load({lang_load name="comments.comments_declension, comments.unsubscribe, comments.subscribe, comments.folding.unfold, comments.folding.fold, comments.folding.unfold_all, comments.folding.fold_all, poll.notices.error_answers_max, blog.blog, favourite.add, favourite.remove, geo_select_city, geo_select_region, blog.add.fields.type.note_open, blog.add.fields.type.note_close, common.success.add, common.success.remove"});
ls.lang.load({lang_load name="comments.comments_declension, comments.unsubscribe, comments.subscribe, comments.folding.unfold, comments.folding.fold, comments.folding.unfold_all, comments.folding.fold_all, poll.notices.error_answers_max, blog.blog, favourite.add, favourite.remove, geo_select_city, geo_select_region, blog.add.fields.type.note_open, blog.add.fields.type.note_close, common.success.add, common.success.remove, pagination.notices.first, pagination.notices.last"});
ls.registry.set('comment_max_tree', {json var=Config::Get('module.comment.max_tree')});
ls.registry.set('block_stream_show_tip', {json var=Config::Get('block.stream.show_tip')});