' +'' +''); } }); $(document).on('click', '.closeMv', function(ev){ var $_this = $(this); $_this.closest('.img-preview').remove(); if($('.img-preview').length == 0){ $('#media-preview').hide(); } return false; }); $(document).on('click', '#btnClick', function(ev){ var $_this = $(this); if($.trim($('#contentInput').val())==''){ $('#editableDiv').focus(); return false; } if($.trim($('input[name=rates]').val())==''){ $('input[name=rates]').focus(); return false; } $_this.closest('form.simple_form').ajaxSubmit({ type: "POST", url: path_ajax_script+'/index.php?mod=home&act=ajSaveReviews', beforeSend: function(xhr){ $('button[id^=btnClick]').text(process); }, dataType: "html", success: function(html){ $('button[id^=btnClick]') .text(Completed) .delay(2000) .text(Publish_Review); $_this.closest('form.simple_form').resetForm(); $_this.closest('form.simple_form').clearForm(); if(html.indexOf("_ERROR") >= 0) { $('#message_box').html(msg_insert_error).show(); return false; }else if(html.indexOf('_SUCCESS') >=0){ alert(msg_insert_success); $('#media-preview').empty().hide(); // $(".rate_row .rate_star").removeClass('checked'); // $("#rates").val(''); $("#message").val(''); $('#commentCrx li:first').fadeIn().delay(10000).fadeOut(); } } }); return false; }); var $number_per_page = 5; var $page = 1; $page_aj = 0; var timer = ''; /*loadPage();*/ $('#show-more').click(function(e) { var $totalRecord = $('#commentCrx .box').size(); if($page_aj){ $page = $page_aj + 1; $page_aj=0; } else $page = $page + 1; e.preventDefault(); var $this = $(this); clearTimeout(timer); $('.loader').show(); timer = setTimeout(function(){ var $start = ($page-1) * $number_per_page; var $end = $start + $number_per_page; for(var i = $start; i < $end; i++) { $('.box').eq(i).show(); } $('.loader').hide(); if($end>=$totalRecord) $('#show-more').hide(); }, 500); }); });