6c8e3423
Yarik
Fast buy
|
1
2
3
4
|
$(function() {
var basket = new ArtboxBasket({
'cartSelector': '#cart'
});
|
6c8e3423
Yarik
Fast buy
|
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/**
* Modal form submit code
*/
$(document)
.on('beforeSubmit', '#feedback-form', function(e) {
var f = this;
var form = $(this);
var formData = form.serialize();
$.ajax({
url: form.attr("action"),
type: form.attr("method"),
data: formData,
success: function(data) {
f.reset();
$('#feedback-modal')
.modal('hide');
$('#success-modal')
.modal('show');
},
error: function() {
$('#feedback-modal')
.modal('hide');
|
6748c345
Alexey Boroda
-Forms almost ready
|
27
|
}
|
6c8e3423
Yarik
Fast buy
|
28
29
30
31
32
|
});
})
.on('submit', '#feedback-form', function(e) {
e.preventDefault();
});
|
657a0f05
Alexey Boroda
-Button up
|
33
|
|
6c8e3423
Yarik
Fast buy
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/**
* Contact form submitting
*/
$(document)
.on('beforeSubmit', '#contact-form', function(e) {
var f = this;
var form = $(this);
var formData = form.serialize();
$.ajax({
url: form.attr("action"),
type: form.attr("method"),
data: formData,
success: function(data) {
f.reset();
form.replaceWith(data.alert);
},
error: function() {
|
83309611
Alexey Boroda
-Map in process
|
51
|
|
83309611
Alexey Boroda
-Map in process
|
52
|
}
|
6c8e3423
Yarik
Fast buy
|
53
54
55
56
57
|
});
})
.on('submit', '#contact-form', function(e) {
e.preventDefault();
});
|
4bf9edb7
Yarik
Order
|
58
|
|
6c8e3423
Yarik
Fast buy
|
59
60
61
62
63
64
65
66
67
68
69
|
/**
* Button UP code
*/
if ($('#back-to-top').length) {
var scrollTrigger = 100, // px
backToTop = function() {
var scrollTop = $(window)
.scrollTop();
if (scrollTop > scrollTrigger) {
$('#back-to-top')
.addClass('show');
|
7f57ad53
Eugeny Galkovskiy
уведомление о доб...
|
70
|
} else {
|
6c8e3423
Yarik
Fast buy
|
71
72
|
$('#back-to-top')
.removeClass('show');
|
7f57ad53
Eugeny Galkovskiy
уведомление о доб...
|
73
|
}
|
6c8e3423
Yarik
Fast buy
|
74
75
76
77
78
|
};
backToTop();
$(window)
.on('scroll', function() {
backToTop();
|
4bf9edb7
Yarik
Order
|
79
|
});
|
6c8e3423
Yarik
Fast buy
|
80
81
|
$('#back-to-top')
.on('click', function(e) {
|
4bf9edb7
Yarik
Order
|
82
|
e.preventDefault();
|
6c8e3423
Yarik
Fast buy
|
83
84
85
86
|
$('html,body')
.animate({
scrollTop: 0
}, 700);
|
4bf9edb7
Yarik
Order
|
87
|
});
|
6c8e3423
Yarik
Fast buy
|
88
89
90
91
92
93
94
|
}
$(document)
.on('click', '.add-to-basket', function(e) {
e.preventDefault();
var id = $(this)
.data('id');
|
fc66ded4
Yarik
Artbox great prep...
|
95
96
97
98
99
100
101
102
|
var xhr = basket.add(id, 1);
xhr.done(function() {
$.pjax.reload({
container: '#basket-modal',
fragment: '#basket-modal',
timeout: 5000
});
});
|
6c8e3423
Yarik
Fast buy
|
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
if ($('.alert-cart').length > 0) {
} else {
$('body')
.prepend($("<div class='alert-cart alert alert-success alert-dismissible'>Товар добавлен в корзину.</div>"));
setTimeout(function() {
$(".alert-cart")
.addClass("active");
}, 100);
setTimeout(function() {
$(".alert-cart")
.removeClass("active");
}, 3500);
setTimeout(function() {
$(".alert-cart")
.remove();
}, 3600);
}
});
|
4bf9edb7
Yarik
Order
|
121
|
|
6c8e3423
Yarik
Fast buy
|
122
123
124
125
126
127
128
|
$(document)
.on('click', '.remove-product-cart', function(e) {
e.preventDefault();
var id = $(this)
.parents('.product-row-basket')
.data('id');
showLoader('#basket');
|
7c514320
Yarik
Share basket
|
129
|
showLoader('#basket-modal');
|
6c8e3423
Yarik
Fast buy
|
130
131
|
var xhr = basket.remove(id);
xhr.done(function() {
|
7c514320
Yarik
Share basket
|
132
133
134
135
136
137
138
139
|
if ($('#basket').length) {
$.pjax.reload({
container: '#basket',
fragment: '#basket',
timeout: 5000,
async: false
});
}
|
6c8e3423
Yarik
Fast buy
|
140
|
$.pjax.reload({
|
7c514320
Yarik
Share basket
|
141
142
143
144
|
container: '#basket-modal',
fragment: '#basket-modal',
timeout: 5000,
async: false
|
4bf9edb7
Yarik
Order
|
145
|
});
|
6c8e3423
Yarik
Fast buy
|
146
147
|
})
});
|
4bf9edb7
Yarik
Order
|
148
|
|
6c8e3423
Yarik
Fast buy
|
149
150
151
152
153
154
|
$(document)
.on('change', '.increase-product-basket', function(e) {
var id = $(this)
.parents('.product-row-basket')
.data('id');
showLoader('#basket');
|
fc66ded4
Yarik
Artbox great prep...
|
155
|
showLoader('#basket-modal');
|
6c8e3423
Yarik
Fast buy
|
156
157
158
|
var xhr = basket.set(id, $(this)
.val());
xhr.done(function() {
|
fc66ded4
Yarik
Artbox great prep...
|
159
160
161
162
|
if ($('#basket').length) {
$.pjax.reload({
container: '#basket',
fragment: '#basket',
|
7c514320
Yarik
Share basket
|
163
164
|
timeout: 5000,
async: false
|
fc66ded4
Yarik
Artbox great prep...
|
165
166
|
});
}
|
6c8e3423
Yarik
Fast buy
|
167
|
$.pjax.reload({
|
fc66ded4
Yarik
Artbox great prep...
|
168
169
|
container: '#basket-modal',
fragment: '#basket-modal',
|
7c514320
Yarik
Share basket
|
170
171
|
timeout: 5000,
async: false
|
6c8e3423
Yarik
Fast buy
|
172
|
});
|
4bf9edb7
Yarik
Order
|
173
|
});
|
6c8e3423
Yarik
Fast buy
|
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
|
});
$(document)
.on('click', 'li.disabled a', function(e) {
e.preventDefault();
});
$(document)
.on('submit', '#fast-buy-form', function(e) {
e.preventDefault();
});
$(document)
.on('afterValidate', '#fast-buy-form', function(e, m, errors) {
if (!errors.length) {
var form = $(e.target);
var action = form.attr('action');
$.post(action, form.serialize(), function(data) {
if (data.success) {
$('#oneclick-modal')
.find('.modal-body')
.text(data.msg);
}
});
}
}.bind(this));
|
ac6e2c67
Alexey Boroda
-Cabinet ready
|
201
|
$(document)
|
7c514320
Yarik
Share basket
|
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
|
.on('click', '.wishlist-rm, .wishlist-add', function() {
var button = $(this);
$.ajax({
url: button.data('url'),
type: "POST",
data: {
'variant': button.data('variant'),
'product': button.data('product'),
'user': button.data('user')
},
success: function(data) {
button.replaceWith(data.button);
new PNotify({
title: 'Info',
text: data.message,
type: 'info',
styling: 'fontawesome'
});
|
ac6e2c67
Alexey Boroda
-Cabinet ready
|
220
|
|
7c514320
Yarik
Share basket
|
221
222
223
|
}
})
});
|
ac6e2c67
Alexey Boroda
-Cabinet ready
|
224
225
|
$(document)
|
7c514320
Yarik
Share basket
|
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
.on('click', '.wishlist-delete', function(e) {
e.preventDefault();
var button = $(this);
$.ajax({
url: button.data('url'),
type: "POST",
data: {
'product': button.data('product'),
'variant': button.data('variant'),
'user': button.data('user')
},
success: function(data) {
if (data.success) {
$.pjax.reload({container: '#wishlist-products'});
new PNotify({
title: 'Info',
text: data.message,
type: 'info',
styling: 'fontawesome'
});
|
ac6e2c67
Alexey Boroda
-Cabinet ready
|
246
|
}
|
7c514320
Yarik
Share basket
|
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
|
}
});
});
$(document)
.on('click', '.sort-cat>a', function(e) {
$(this)
.parent()
.toggleClass("active");
return false;
});
$(document)
.on('click', '.sorter li a', function(e) {
var sortclick = $(this)
.text();
parentsort = $(".sort-cat a span");
pstext = $(parentsort)
.text();
mainlink = $(".sort-cat a")
.attr('href');
newmainlink = $(this)
.attr('href');
|
b31541f7
Eugeny Galkovskiy
Сортировка
|
268
|
|
7c514320
Yarik
Share basket
|
269
270
271
272
273
274
275
276
277
278
|
$(parentsort)
.text(sortclick);
$(".sort-cat>a")
.attr('href', newmainlink);
$(this)
.text(pstext);
$(this)
.attr('href', mainlink);
$(".sort-cat>a")
.click();
|
b31541f7
Eugeny Galkovskiy
Сортировка
|
279
|
|
7c514320
Yarik
Share basket
|
280
281
282
283
|
$(location)
.attr('href', newmainlink);
return false;
});
|
ac6e2c67
Alexey Boroda
-Cabinet ready
|
284
|
|
de8261de
Yarik
Price filter
|
285
286
287
288
289
290
291
|
// Price slider
$('.price-inputs input')
.keypress(function(key) {
if (key.charCode < 48 || key.charCode > 57) {
return false;
}
});
|
5a24921e
Eugeny Galkovskiy
Бегунок цены
|
292
|
|
de8261de
Yarik
Price filter
|
293
294
295
296
297
298
299
300
301
|
var priceSlider = $(".price_slider input");
var pricemin = priceSlider.data("pricemin");
var pricemax = priceSlider.data("pricemax");
var currentMin = priceSlider.data("currentmin");
var currentMax = priceSlider.data("currentmax");
$(".price-inputs #price-min")
.val(currentMin);
$(".price-inputs #price-max")
.val(currentMax);
|
dc92126e
Eugeny Galkovskiy
Бегунок цены
|
302
|
|
de8261de
Yarik
Price filter
|
303
304
305
306
307
308
309
310
311
312
313
314
315
316
|
$("#price_interval")
.ionRangeSlider({
type: "double",
min: pricemin,
max: pricemax,
from: currentMin,
to: currentMax,
onChange: function(data) {
$(".price-inputs #price-min")
.val(data.from);
$(".price-inputs #price-max")
.val(data.to);
}
});
|
dc92126e
Eugeny Galkovskiy
Бегунок цены
|
317
|
|
de8261de
Yarik
Price filter
|
318
319
|
var slider = $("#price_interval")
.data("ionRangeSlider");
|
dc92126e
Eugeny Galkovskiy
Бегунок цены
|
320
|
|
de8261de
Yarik
Price filter
|
321
322
323
324
325
326
327
|
$(document)
.on('change', '.price-inputs #price-min', function() {
var newmin = $(this)
.val();
currentmax = $(".price-inputs #price-max")
.val();
if (newmin > currentmax) {
|
5a24921e
Eugeny Galkovskiy
Бегунок цены
|
328
|
newmin = currentmax;
|
de8261de
Yarik
Price filter
|
329
330
331
|
$('.price-inputs #price-min')
.val(currentmax);
} else if (newmin > pricemax) {
|
5a24921e
Eugeny Galkovskiy
Бегунок цены
|
332
|
newmin = pricemax;
|
de8261de
Yarik
Price filter
|
333
334
|
$('.price-inputs #price-min')
.val(pricemax);
|
5a24921e
Eugeny Galkovskiy
Бегунок цены
|
335
|
}
|
de8261de
Yarik
Price filter
|
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
|
slider.update({from: newmin});
});
$(document)
.on('change', '.price-inputs #price-max', function() {
var newmax = $(this)
.val();
currentmin = $(".price-inputs #price-min")
.val();
if (newmax < currentmin) {
newmax = currentmin;
$('.price-inputs #price-max')
.val(currentmin);
} else if (newmax > pricemax) {
newmax = pricemax;
$('.price-inputs #price-max')
.val(pricemax);
}
slider.update({to: newmax});
});
$(document)
.on('click', '.price-apply', function() {
var max = $('#price-max')
.val();
var min = $('#price-min')
.val();
console.log(max, min);
var href = window.location.href;
|
54f69b92
Yarik
Price filter fix
|
363
|
var question = href.indexOf('?');
|
040c92b7
Yarik
Price filter fix
|
364
|
var queryString = '';
|
54f69b92
Yarik
Price filter fix
|
365
|
if (question !== -1) {
|
040c92b7
Yarik
Price filter fix
|
366
|
queryString = href.substr(question);
|
54f69b92
Yarik
Price filter fix
|
367
368
|
href = href.substr(0, question);
}
|
de8261de
Yarik
Price filter
|
369
370
371
372
373
374
|
var count = 0;
var pos = -1;
while ((pos = href.indexOf('/', pos + 1)) !== -1) {
count++;
}
if (count === 5) {
|
54f69b92
Yarik
Price filter fix
|
375
|
window.location.href = href + '/price-' + min + '-' + max + queryString;
|
de8261de
Yarik
Price filter
|
376
|
} else {
|
54f69b92
Yarik
Price filter fix
|
377
|
var result = href.match(/\/[^\/]*price-(\d+)-(\d+)$/);
|
de8261de
Yarik
Price filter
|
378
|
if (result) {
|
54f69b92
Yarik
Price filter fix
|
379
|
window.location.href = href.replace(/(\/[^\/]*)price-\d+-\d+$/, '$1price-' + min + '-' + max) + queryString;
|
de8261de
Yarik
Price filter
|
380
381
382
383
384
385
386
387
|
}
}
});
// End of price slider
$('.vcovers')
.perfectScrollbar({wheelSpeed: 0.5});
|
7c514320
Yarik
Share basket
|
388
389
390
391
392
393
394
395
396
397
398
399
|
$(document)
.on('click', '.sidebar-menu .form-group .hiddens-button a.btn', function() {
$(this)
.parent()
.parent()
.find(".hiddens")
.toggleClass("active");
$(this)
.text(function(i, text) {
return text === "Ещё" ? "Скрыть" : "Ещё";
});
return false;
|
a227a1f0
Eugeny Galkovskiy
Скрытые фильтры в...
|
400
|
});
|
a227a1f0
Eugeny Galkovskiy
Скрытые фильтры в...
|
401
|
|
7c514320
Yarik
Share basket
|
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
$(document)
.on('beforeSubmit', '.share-basket-form', function(e) {
$.post($(this)
.attr('action'), $(this)
.serialize(), function(data) {
});
new PNotify({
title: $(this)
.data('title'),
text: $(this)
.data('msg'),
type: 'info',
styling: 'fontawesome'
});
this.reset();
return false;
});
$(document)
.on('submit', '.share-basket-form', function(e) {
$.post($(this)
.attr('action'), $(this)
.serialize(), function(data) {
});
new PNotify({
title: $(this)
.data('title'),
text: $(this)
.data('msg'),
type: 'info',
styling: 'fontawesome'
});
this.reset();
return false;
});
|
dc92126e
Eugeny Galkovskiy
Бегунок цены
|
436
|
});
|
de8261de
Yarik
Price filter
|
437
438
439
440
|
function showLoader(container) {
$(container)
.prepend('<div class="loader-wrapper"><div class="loader"></div></div>');
}
|