| 10582 |
lgm |
1 |
function toggleListview(e){
|
|
|
2 |
|
|
|
3 |
var a = document.getElementsByClassName('pd-list-hldr')[0];
|
|
|
4 |
if(a.className == 'pd-list-hldr clearfix'){
|
|
|
5 |
a.className += ' grid';
|
|
|
6 |
e.currentTarget.className = 'list-icon';
|
|
|
7 |
}else{
|
|
|
8 |
a.className = 'pd-list-hldr clearfix';
|
|
|
9 |
e.currentTarget.className = '';
|
|
|
10 |
}
|
|
|
11 |
|
|
|
12 |
}
|
|
|
13 |
var showmore;
|
|
|
14 |
var nextpageload = true;
|
|
|
15 |
function showMoreProducts()
|
|
|
16 |
{
|
| 11325 |
lgm |
17 |
|
| 10582 |
lgm |
18 |
var cpage =document.getElementById('page').innerHTML;
|
|
|
19 |
var url = document.URL;
|
|
|
20 |
if(!cpage){cpage=2;} else {cpage = parseInt(cpage) +1;}
|
|
|
21 |
var data = spliturl(document.URL);
|
|
|
22 |
var cat = data[2].split('/');
|
|
|
23 |
cat = cat[cat.length-2];
|
|
|
24 |
var newUrl = base_url+'products/getSpecialProductList/'+cat+'/'+cpage;
|
|
|
25 |
microAjax(newUrl, function(res)
|
|
|
26 |
{
|
| 11325 |
lgm |
27 |
|
| 10582 |
lgm |
28 |
if(res!='')
|
|
|
29 |
{
|
|
|
30 |
var appenddata =document.getElementById("appendlist");
|
|
|
31 |
var total = document.getElementById('count').value;
|
|
|
32 |
appenddata.innerHTML= appenddata.innerHTML + res;
|
|
|
33 |
document.getElementById('page').innerHTML = cpage;
|
| 11710 |
lgm |
34 |
if(!isOperaMini){
|
|
|
35 |
if (cpage % 3 == 0) {
|
|
|
36 |
showmore = "block";
|
|
|
37 |
} else {
|
|
|
38 |
showmore = "none";
|
|
|
39 |
document.getElementById("showmorebutton").style.display = "none";
|
|
|
40 |
}
|
|
|
41 |
}
|
| 10582 |
lgm |
42 |
if (parseInt(total) <= parseInt(cpage)) {
|
|
|
43 |
showmore = 'none';
|
|
|
44 |
nextpageload = false;
|
|
|
45 |
document.getElementById("showmorebutton").style.display='none';
|
|
|
46 |
}
|
|
|
47 |
var str = document.URL;
|
|
|
48 |
nextpageload = true;
|
|
|
49 |
if(str.indexOf("page") !== -1){
|
| 11325 |
lgm |
50 |
|
| 10582 |
lgm |
51 |
data = spliturl(str);
|
|
|
52 |
newdata= data[1].split("&");
|
|
|
53 |
var a = newdata.length;
|
|
|
54 |
for(var i=0;i< a ;i++){
|
|
|
55 |
if(newdata[i].indexOf('page') != -1){
|
|
|
56 |
newdata[i]='page='+(parseInt(newdata[i].split('=')[1])+1);
|
|
|
57 |
}
|
|
|
58 |
}
|
|
|
59 |
var url = data[2]+'?'+newdata.join("&");
|
|
|
60 |
window.history.replaceState("",document.title, url);}
|
|
|
61 |
else{
|
|
|
62 |
if(str.indexOf('sortedBy') != -1 || str.indexOf('fq') != -1 || str.indexOf('minPrice') != -1){
|
|
|
63 |
window.history.replaceState("",document.title, window.location.href+"&page=2");
|
|
|
64 |
}
|
|
|
65 |
else{
|
|
|
66 |
window.history.replaceState("",document.title, window.location.href+"?page=2");
|
|
|
67 |
}
|
|
|
68 |
}
|
|
|
69 |
}
|
|
|
70 |
else
|
|
|
71 |
{
|
|
|
72 |
document.getElementById("showmorebutton").style.display='none';}
|
|
|
73 |
});
|
|
|
74 |
|
|
|
75 |
}
|
| 11710 |
lgm |
76 |
var isOperaMini = (navigator.userAgent.indexOf('Opera Mini') > -1);
|
|
|
77 |
if(isOperaMini){
|
| 11719 |
lgm |
78 |
total = document.getElementById('count').value;
|
|
|
79 |
cpage = document.getElementById('page').innerHTML;
|
|
|
80 |
if (parseInt(total) <= parseInt(cpage)) {
|
|
|
81 |
document.getElementById("showmorebutton").style.display = "none";
|
|
|
82 |
}else{
|
|
|
83 |
document.getElementById("showmorebutton").style.display = "block";
|
|
|
84 |
}
|
| 11710 |
lgm |
85 |
}
|
| 10582 |
lgm |
86 |
var startscroll = 0;
|
| 10785 |
lgm |
87 |
document.addEventListener("scroll", function (event) {
|
| 10582 |
lgm |
88 |
var x = document.body.scrollTop;
|
|
|
89 |
var maxY = document.documentElement.scrollHeight - document.documentElement.clientHeight;
|
|
|
90 |
// when user reaches end of the page
|
|
|
91 |
if(x>startscroll)
|
|
|
92 |
{
|
|
|
93 |
startscroll = x;
|
|
|
94 |
}
|
|
|
95 |
else if(maxY==x)
|
|
|
96 |
{
|
|
|
97 |
startscroll=0;
|
|
|
98 |
window.scrollTo(0,0);
|
|
|
99 |
return false;
|
|
|
100 |
}
|
|
|
101 |
else
|
|
|
102 |
{
|
|
|
103 |
|
|
|
104 |
return false;
|
|
|
105 |
}
|
|
|
106 |
if (getDocHeight() <= getScrollXY()[1] + window.innerHeight + 300) {
|
| 11325 |
lgm |
107 |
|
| 10582 |
lgm |
108 |
if(((document.getElementById('page').innerHTML%3) != 0) && nextpageload==true){
|
|
|
109 |
total = document.getElementById('count').value;
|
|
|
110 |
cpage = document.getElementById('page').innerHTML;
|
|
|
111 |
nextpageload=false;
|
|
|
112 |
if (parseInt(total) <= parseInt(cpage)) {
|
|
|
113 |
showmore = 'none';
|
|
|
114 |
nextpageload = false;
|
|
|
115 |
}else{
|
|
|
116 |
showMoreProducts();}
|
|
|
117 |
}
|
|
|
118 |
else{
|
|
|
119 |
if(showmore === 'block'){
|
|
|
120 |
document.getElementById('showmorebutton').style.display = 'block';
|
|
|
121 |
}
|
|
|
122 |
}
|
|
|
123 |
}
|
| 11938 |
anikendra |
124 |
});
|