Rev 11719 | Blame | Compare with Previous | Last modification | View Log | RSS feed
function toggleListview(e){var a = document.getElementsByClassName('pd-list-hldr')[0];if(a.className == 'pd-list-hldr clearfix'){a.className += ' grid';e.currentTarget.className = 'list-icon';}else{a.className = 'pd-list-hldr clearfix';e.currentTarget.className = '';}}var showmore;var nextpageload = true;function showMoreProducts(){var cpage =document.getElementById('page').innerHTML;var url = document.URL;if(!cpage){cpage=2;} else {cpage = parseInt(cpage) +1;}var data = spliturl(document.URL);var cat = data[2].split('/');cat = cat[cat.length-2];var newUrl = base_url+'products/getSpecialProductList/'+cat+'/'+cpage;microAjax(newUrl, function(res){if(res!=''){var appenddata =document.getElementById("appendlist");var total = document.getElementById('count').value;appenddata.innerHTML= appenddata.innerHTML + res;document.getElementById('page').innerHTML = cpage;if(!isOperaMini){if (cpage % 3 == 0) {showmore = "block";} else {showmore = "none";document.getElementById("showmorebutton").style.display = "none";}}if (parseInt(total) <= parseInt(cpage)) {showmore = 'none';nextpageload = false;document.getElementById("showmorebutton").style.display='none';}var str = document.URL;nextpageload = true;if(str.indexOf("page") !== -1){data = spliturl(str);newdata= data[1].split("&");var a = newdata.length;for(var i=0;i< a ;i++){if(newdata[i].indexOf('page') != -1){newdata[i]='page='+(parseInt(newdata[i].split('=')[1])+1);}}var url = data[2]+'?'+newdata.join("&");window.history.replaceState("",document.title, url);}else{if(str.indexOf('sortedBy') != -1 || str.indexOf('fq') != -1 || str.indexOf('minPrice') != -1){window.history.replaceState("",document.title, window.location.href+"&page=2");}else{window.history.replaceState("",document.title, window.location.href+"?page=2");}}}else{document.getElementById("showmorebutton").style.display='none';}});}var isOperaMini = (navigator.userAgent.indexOf('Opera Mini') > -1);if(isOperaMini){total = document.getElementById('count').value;cpage = document.getElementById('page').innerHTML;if (parseInt(total) <= parseInt(cpage)) {document.getElementById("showmorebutton").style.display = "none";}else{document.getElementById("showmorebutton").style.display = "block";}}var startscroll = 0;document.addEventListener("scroll", function (event) {var x = document.body.scrollTop;var maxY = document.documentElement.scrollHeight - document.documentElement.clientHeight;// when user reaches end of the pageif(x>startscroll){startscroll = x;}else if(maxY==x){startscroll=0;window.scrollTo(0,0);return false;}else{return false;}if (getDocHeight() <= getScrollXY()[1] + window.innerHeight + 300) {if(((document.getElementById('page').innerHTML%3) != 0) && nextpageload==true){total = document.getElementById('count').value;cpage = document.getElementById('page').innerHTML;nextpageload=false;if (parseInt(total) <= parseInt(cpage)) {showmore = 'none';nextpageload = false;}else{showMoreProducts();}}else{if(showmore === 'block'){document.getElementById('showmorebutton').style.display = 'block';}}}});