$(document).ready(function(){ $(".js-page-prev").click(function(){ if($(this).hasClass('disabled')) return; View.changeParam('pageNo',parseInt($(".js-pageNo").val()) - 1); View.refresh(); }); $(".js-page-next").click(function(){ if($(this).hasClass('disabled')) return; View.changeParam('pageNo',parseInt($(".js-pageNo").val()) + 1); View.refresh(); }); $(".js-page").click(function(){ View.changeParam('pageNo',$(this).html()); View.refresh(); }); $(".js-search").click(function(){ View.changeParam('filterKey',$(".js-filterKey").val()); View.changeParam('filterKey2',$(".js-filterKey2").val()); View.changeParam('cid',$(".js-category").val()); View.changeParam('pageNo',1); View.refresh(); }); $(".js-filterCity").change(function(){ View.changeParam('city',$(this).val()); View.refresh(); }); $(".js-filterCategory").change(function(){ View.changeParam('cid',$(this).val()); View.refresh(); }); $('.js-scroll').bind('inview', function(event, visible) { if (visible) { var pgNo = parseInt(View.getParamValue('pageNo')) + 1; if(pgNo <= parseInt(pages)){ $(".js-loading").show(); $('.js-scroll').hide(); View.changeParam('pageNo',pgNo); $.ajax({ 'url' : View.getUrl()+"&ajax=1", "type" : "POST", "data" : { 'lastGroup' : $(".js-group:last").html() }, "success" : function(response){ $(".js-events-content").append(response); $(".js-loading").hide(); $('.js-scroll').show(); $(".dotdotdot").trigger("destroy").dotdotdot({ wrap: 'letter'}); History.pushState({pageNo: pgNo}, '', '?'+$.param(View.getParams())); } }); } } }); });