1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
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
|
/*!
* jQuery UI Touch Punch 0.2.3
*
* Copyright 2011–2014, Dave Furfero
* Dual licensed under the MIT or GPL Version 2 licenses.
*
* Depends:
* jquery.ui.widget.js
* jquery.ui.mouse.js
*/
!function(a){function f(a,b){if(!(a.originalEvent.touches.length>1)){a.preventDefault();var c=a.originalEvent.changedTouches[0],d=document.createEvent("MouseEvents");d.initMouseEvent(b,!0,!0,window,1,c.screenX,c.screenY,c.clientX,c.clientY,!1,!1,!1,!1,0,null),a.target.dispatchEvent(d)}}if(a.support.touch="ontouchend"in document,a.support.touch){var e,b=a.ui.mouse.prototype,c=b._mouseInit,d=b._mouseDestroy;b._touchStart=function(a){var b=this;!e&&b._mouseCapture(a.originalEvent.changedTouches[0])&&(e=!0,b._touchMoved=!1,f(a,"mouseover"),f(a,"mousemove"),f(a,"mousedown"))},b._touchMove=function(a){e&&(this._touchMoved=!0,f(a,"mousemove"))},b._touchEnd=function(a){e&&(f(a,"mouseup"),f(a,"mouseout"),this._touchMoved||f(a,"click"),e=!1)},b._mouseInit=function(){var b=this;b.element.bind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),c.call(b)},b._mouseDestroy=function(){var b=this;b.element.unbind({touchstart:a.proxy(b,"_touchStart"),touchmove:a.proxy(b,"_touchMove"),touchend:a.proxy(b,"_touchEnd")}),d.call(b)}}}(jQuery);
function wpsg_switchProductview(index, page, order, mode)
{
var atts = jQuery.parseJSON(jQuery('#wpsg_productview_' + index + ' input[name="wpsg_atts"]').val());
atts.page = page;
if (typeof order !== "undefined") atts.order = order;
if (typeof mode !== "undefined") atts.mode = mode;
else
{
if (jQuery('#wpsg_productview_' + index + ' .wpsg_mod_productview_modeswitch > a').length > 0)
{
if (jQuery('#wpsg_productview_' + index + ' .wpsg_mod_productview_modeswitch > a.fa-th').hasClass('active')) atts.mode = 'grid';
else atts.mode = 'list';
}
}
if (jQuery('#wpsg_mod_productview_filter').length > 0)
{
atts.filter = jQuery('#wpsg_mod_productview_filter input').serialize();
}
jQuery('#wpsg_productview_' + index).append('<div class="wpsg_mod_productview_loading"></div>');
jQuery.ajax( {
'url': wpsg_ajax.ajaxurl,
'data': {
'wpsg_mod': 'wpsg_mod_productview',
'wpsg_action': 'refresh',
'wpsg_atts': atts
},
'success': function(data) {
jQuery('#wpsg_productview_' + index).replaceWith(data);
wpsg_correctProductview(index);
}
} );
return false;
}
function wpsg_correctProductview(index)
{
var max_height = 0; jQuery('#wpsg_productview_' + index + ' .wpsg_productview_product_grid .wpsg_mod_productview_name').each(function() { if (jQuery(this).outerHeight() > max_height) max_height = jQuery(this).outerHeight(); } ).outerHeight(max_height);
var max_height = 0; jQuery('#wpsg_productview_' + index + ' .wpsg_productview_product_grid .wpsg_mod_productview_description').each(function() { if (jQuery(this).outerHeight() > max_height) max_height = jQuery(this).outerHeight(); } ).outerHeight(max_height);
// Sortierungslayer
jQuery('.wpsg_mod_productview-order').bind('click', function(event) {
if (jQuery(this).find('.wpsg_mod_productview-order-layer').is(':visible'))
{
jQuery(this).find('.wpsg_mod_productview-order-layer').slideUp();
}
else
{
jQuery(this).find('.wpsg_mod_productview-order-layer').slideDown();
}
event.stopPropagation();
} ).disableSelection();
// Sortierung
jQuery('.wpsg_mod_productview-order-layer a').bind('click', function() {
var productview_index = jQuery(this).attr("data-productview-index");
var order = jQuery(this).attr("data-order");
wpsg_switchProductview(productview_index, 1, order);
return false;
} ).disableSelection();
// Umschalten der List/Grid Ansichten
jQuery('.wpsg_mod_productview_modeswitch > a').bind('click', function() {
if (jQuery(this).hasClass('fa-th') &&!jQuery(this).hasClass('active'))
{
jQuery('.wpsg_productview_product_list').hide(250);
jQuery('.wpsg_productview_product_grid').show(250);
}
else if (jQuery(this).hasClass('fa-list') && !jQuery(this).hasClass('active'))
{
jQuery('.wpsg_productview_product_grid').hide(250);
jQuery('.wpsg_productview_product_list').show(250);
}
jQuery('.wpsg_mod_productview_modeswitch a').removeClass('active');
jQuery(this).addClass('active');
return false;
} );
}
function wpsg_filter_insert(values, set)
{
var arValues = [];
if (jQuery.trim(values) != '') arValues = jQuery.trim(values).split(',');
if (jQuery.inArray(set, arValues) >= 0) arValues = jQuery.grep(arValues, function(value) { return value != set; } );
else arValues.push(set);
return jQuery.unique(arValues).join(',');
}
jQuery(document).ready(function() {
// Preisfilter
var filter_min = parseFloat(jQuery('#wpsg_mod_productview_filter_price_info input[name="price_min"]').val());
var filter_max = parseFloat(jQuery('#wpsg_mod_productview_filter_price_info input[name="price_max"]').val());
jQuery("#wpsg_mod_productview_filter_price-range").slider( {
range: true,
min: filter_min,
max: filter_max,
values: [filter_min, filter_max],
slide: function(event, ui) {
jQuery('#wpsg_mod_productview_filter_price_info input[name="price_min"]').val(ui.values[0]);
jQuery('#wpsg_mod_productview_filter_price_info input[name="price_max"]').val(ui.values[1]);
jQuery('#wpsg_mod_productview_filter_price_info .min').html(wpsg_numberformat(ui.values[0], 2));
jQuery('#wpsg_mod_productview_filter_price_info .max').html(wpsg_numberformat(ui.values[1], 2));
},
stop: function(event, ui) {
wpsg_switchProductview(1, 1);
}
} );
// Variantenfilter Small
jQuery('.wpsg_mod_productview_filter_item a.switch').bind('click', function() {
var input = jQuery(this).parents('.wpsg_mod_productview_filter_item').find('input.val');
input.val(wpsg_filter_insert(input.val(), jQuery(this).attr('data-value')));
jQuery(this).toggleClass('active');
wpsg_switchProductview(1, 1);
return false;
} );
jQuery('.wpsg_productview').each(function() {
var x = jQuery(this).attr("id").substr(17);
wpsg_correctProductview(x);
} );
jQuery('body, html').bind('click', function() {
jQuery('.wpsg_mod_productview-order-layer:visible').each(function() { jQuery(this).parent().click(); } );
} );
} );
|