PageSourceSearch

https://www.weingut-stachel.de/wp-content/themes/pxwpshop/js/functions.js

js weingut-stachel.de collected 2026-09-26 19:59:57 UTC 15,893 bytes, 433 lines download raw bytes

1 /* To use jQuery in a proper way -
2  * using $ instead of jQuery -
3  * wrap the script into a function($)
4  */
5
6// Launch SlimMenu
7jQuery(document).ready(function($) {
8     $('#mainmenu').slimmenu(
9         {
10             resizeWidth: '1024',
11             collapserTitle: pxwpshop_vars.menuTitle,
12             animSpeed:'slow',
13             indentChildren: true,
14             /*childrenIndenter: '»'*/
15             expandIcon:'<i>&#711;</i>',
16             collapseIcon:'<i>&#710;</i>'
17         });
18});
19
20
21/* Fancy Box Settings -
22 * add .fancybox to all images with an a-tag
23 * and all gallery images
24 */
25
26// Function adds .fancybox to all immages with an a-tag / all gallery images
27jQuery.noConflict();
28jQuery(function () {
29    var addClassSelector = "a[href$='.jpg'], a[href$='.png'], a[href$='.jpeg'], a[href$='.gif']";
30    jQuery(addClassSelector).each(function () {
31        if (!jQuery(this).hasClass('envira-gallery-link') && !jQuery(this).hasClass('yith_magnifier_thumbnail') ) {
32            jQuery(this).addClass('fancybox');
33            jQuery(this).attr("rel", "fancybox");
34        }
35    });
36});
37
38// Start fancyBox
39jQuery(document).ready(function () {
40    jQuery(".fancybox").fancybox({
41        // Use this settings for normal images
42        autoSize: true,
43        /*        minWidth: '80%',
44         minHeight: '80%',
45         maxHeight: '90%',*/
46        // Use this settings for responsive videos
47        // width: 1080,
48        // height: 608,
49        // aspectRatio: true, // <== this keep your vimeo aspect ratio after resize
50        // scrolling: 'no',
51        helpers: {
52            overlay: {
53                css: {'background': 'rgba(119, 119, 119, 0.9)'}
54            }
55        }
56    });
57});
58
59// Handle go-top button
60jQuery(document).ready(function($) {
61  $('.gotop').click(function(){
62    $('html, body').animate({scrollTop : 0},800);
63    return false;
64  });
65});
66
67// Init jQuery form validation for comments
68 jQuery(document).ready(function($) {
69     $('#commentform').validate({
70
71         onfocusout: function(element) {
72             this.element(element);
73         },
74
75         rules: {
76             author: {
77                 required: true,
78                 minlength: 2
79             },
80
81             email: {
82                 required: true,
83                 email: true
84             },
85
86             'wp-comment-cookies-consent': {
87                 required: true
88             }
89         },
90
91         messages: {
92             author: FunctionsStrings.author,
93             email: FunctionsStrings.email,
94             comment: FunctionsStrings.comment,
95             'wp-comment-cookies-consent': FunctionsStrings.wp_comment_cookies_consent
96         },
97
98         errorElement: "div",
99         errorPlacement: function(error, element) {
100             element.before(error);
101         }
102
103     });
104
105     $("#comment").rules("add", {required:true, minlength: 20, messages: {required: FunctionsStrings.comment, minlength: FunctionsStrings.commentMinLength}});
106 });
107
108// Login Box
109jQuery(document).ready(function($) {
110    $('.px_myaccount').click(function(e) {
111        // Check User Login
112        if($('.logged-in').length) {
113            // Show LogOut Modal
114            var element = $('#myModalLogout');
115            $( this).children('a').removeAttr('href');
116            $( this).children('a').parent().append(element);
117            element.fadeIn();
118            e.stopPropagation();
119
120        } else {
121            // Show Login Modal
122            var element = $('#myModal');
123            $( this).children('a').removeAttr('href');
124            $( this).children('a').append(element);
125            element.fadeIn();
126            e.stopPropagation();
127        }
128    });
129    // Check on Click outside the Login Form and FadeOut
130    $("#myModal").click(function(e){
131        e.stopPropagation();
132    });
133    $('body').click(function(){
134        $("#myModal").fadeOut();
135    });
136    // Check on Click outside the Login Form and FadeOut
137    $("#myModalLogout").click(function(e){
138        e.stopPropagation();
139    });
140    $('body').click(function(){
141        $("#myModalLogout").fadeOut();
142    });
143});
144
145// Filter Show/Hide
146jQuery(document).ready(function($) {
147    // First Filter Show in page load
148    $('#secondary aside').each(function () {
149        if($(this).hasClass('widget_product_categories')) {
150            $(this).addClass('checked');
151            $(this).children('.catFilter').children('i').addClass('fa-angle-up');
152            $(this).children('.catFilter').children('i').removeClass('fa-angle-down');
153        }
154    });
155    $('.catFilter').siblings('ul').children('li.chosen').each(function() {
156        $(this).parent('ul').parent().addClass('checked');
157        $( this).parent('ul').siblings('.catFilter').children('i').addClass('fa-angle-up');
158        $( this ).parent('ul').siblings('.catFilter').children('i').removeClass('fa-angle-down');
159    });
160
161    $('.catFilter').click(function(e) {
162        if( $( this ).parent().hasClass('checked')){
163            if($(this).parent().hasClass('widget_price_filter')) {
164                $(this).siblings('form').slideUp(400, function () {
165                    $( this ).parent().removeClass('checked');
166                });
167            } else {
168                $(this).siblings('ul').slideUp(400, function () {
169                    $( this ).parent().removeClass('checked');
170                });
171            }
172            $( this).children('i').addClass('fa-angle-down');
173            $( this ).children('i').removeClass('fa-angle-up');
174        } else {
175            if($(this).parent().hasClass('widget_price_filter')) {
176                $(this).siblings('form').slideDown(400, function () {
177                    $( this ).parent().addClass('checked');
178                });
179            } else {
180                $(this).siblings('ul').slideDown(400, function () {
181                    $( this ).parent().addClass('checked');
182                });
183            }
184            $( this).children('i').addClass('fa-angle-up');
185            $( this ).children('i').removeClass('fa-angle-down');
186        }
187    })
188});
189
190 // Filter Checkboxen Select one
191jQuery(document).ready(function($) {
192    $('.filterPriceLabel').click(function(e) {
193        var $input =  $(this).siblings('input');
194        var $fields = $(this).parents('.pFilter').siblings('.pFilter').children('input');
195
196        // if($(this).siblings('.filterHidden').attr('checked') === 'checked') {
197        //     var currentURL = window.location.href.split('?')[0];
198        //     window.location.href = currentURL;
199        // }
200        $input.prop('checked', true);
201        $fields.prop('checked', false);
202
203        $input.each(function(){
204            var $name = $(this).attr('id');
205            $(this).attr('name', $name);
206        });
207        $fields.each(function(){
208            $(this).attr('name', '');
209        });
210    });
211    $('.pFilter').children('input').click(function(e) {
212        $(this).prop('checked', true);
213        var otherCheckboxes = $( this).parent('.pFilter').siblings();
214        var otherCheckboxesInner = $( this).siblings().prop('checked', true);
215        otherCheckboxes.each(function(){
216            $(this).children('input').prop('checked', false);
217        });
218    });
219
220    // Trigger Click on a tag by checkbox
221    $('.filterLabel').click(function() {
222        $(this).children('input[type="checkbox"]').prop('checked', true);
223        var href = $(this).children('.filterLink').attr('href');
224        window.location.href = href;
225    });
226    // Multi Select Filter on Checkbox status
227    $('.woocommerce.widget_layered_nav ul').children('li.chosen').each(function() {
228        $(this).parent('ul').css('display', 'block');
229        $(this).children('label').children('input[type="checkbox"]').prop('checked', true);
230    });
231
232    // Callback after cart Updatet
233    jQuery( document ).on( 'updated_wc_div', function() {
234        //Quanti Input
235        $('.minus').each(function(){
236            $(this).click(function() {
237                quantity_minus($(this))
238            });
239        });
240        $('.plus').each(function() {
241            $(this).click(function () {
242                quantity_plus($(this))
243            });
244        });
245    });
246    // + / - function for the cart updatet
247    function quantity_plus(thisObj){
248        var value = thisObj.parent('.quantity').children('.input-text.quantity').val();
249        value++;
250        thisObj.parent('.quantity').children('.input-text.quantity').attr('value', value);
251        $('button[name="update_cart"]').prop('disabled', false);
252    }
253    function quantity_minus(thisObj){
254        var value =  thisObj.parent('.quantity').children('.input-text.quantity').val();
255        if(value < 1) {
256        } else {
257            value--;
258            thisObj.parent('.quantity').children('.input-text.quantity').attr('value', value);
259            $('button[name="update_cart"]').prop('disabled', false);
260        }
261    }
262    //Quanti Input call the functions
263    $('.minus').each(function(){
264        $(this).click(function() {
265            quantity_minus($(this))
266        });
267    });
268    $('.plus').each(function() {
269        $(this).click(function () {
270            quantity_plus($(this))
271        });
272    });
273
274    $('.btnFilter').appendTo($('div.menu-collapser'));
275    $('.btnFilter').click(function () {
276        $('#secondary').slideToggle( "slow" );
277        $(this).toggleClass('open');
278    });
279
280    /** Checkboxen Fix **/
281    $('#ship-to-different-address-checkbox').click(function () {
282        $(this).parents('label').toggleClass('checked');
283    });
284
285    $('.woocommerce-form__input.woocommerce-form__input-checkbox').click(function () {
286        if( !$(this).parents('#ship-to-different-address-checkbox')) {
287            $(this).parents('label').toggleClass('checked');
288        }
289    });
290
291    $('label.checkbox').click(function () {
292        $(this).toggleClass('checked');
293    });
294
295    $('#customer_login').children('.u-column1').children('.login').children('p.form-row').not('.woocommerce-form-row').children('label').children('.woocommerce-form__input-checkbox').click(function () {
296        $(this).parents('label.woocommerce-form__label-for-checkbox').toggleClass('checked');
297    });
298
299    $('.remembermeModal').click(function () {
300        $(this).parents('label').toggleClass('checked');
301    });
302
303    $('.form-row .checkbox .input-checkbox').click(function () {
304        $(this).parents('label').toggleClass('checked');
305    });
306
307    $('.kasse').find('.woocommerce-form__label.woocommerce-form__label-for-checkbox.inline').children('.woocommerce-form__input-checkbox').click(function () {
308        $(this).parents('label').toggleClass('checked');
309    });
310    /** New Customer*/
311    $('.kasse').find('.woocommerce-form__label.woocommerce-form__label-for-checkbox.woocommerce-form-login__rememberme').children('.woocommerce-form__input-checkbox').click(function () {
312        $(this).parents('label').toggleClass('checked');
313    });
314
315    $('.woocommerce-Tabs-panel--additional_information h2').remove();
316});
317
318 // Navigation Fix
319 jQuery(document).ready(function($) {
320     navifix();
321     $( window ).resize(function() {
322         navifix();
323     });
324     function navifix() {
325         if($( document ).width() > 1024) {
326             $('.woosidebar').fadeIn();
327         } else {
328             $('.woosidebar').fadeOut();
329             $('.btnFilter').removeClass('open');
330         }
331         if($( document ).width() > 1024) {
332             $('#mainmenu li.menu-item-has-children').each(function () {
333                 $(this).children('span.sub-toggle').css('z-index', '1');
334                 $(this).children('a').css('z-index', '10');
335             });
336         } else {
337             $('#mainmenu li.menu-item-has-children').each(function () {
338                 $(this).children('span.sub-toggle').css('z-index', '10');
339                 $(this).children('a').css('z-index', '1');
340             });
341         }
342         if($('#mainmenu').not('.collapsed').length == 1){
343             $('#mainmenu li.menu-item-has-children').each(function () {
344                 $(this).children('a').css('position', 'relative');
345             });
346         }
347     }
348 });
349
350 // Login & Register Modal Hide & Show
351 jQuery(document).ready(function($) {
352     var register = $('.modal-body').children('.woocommerce').children('.registerModal');
353     var login = $('.modal-body').children('.woocommerce').children('.loginModal');
354     register.hide();
355     $.ajaxSetup({cache:false});
356     $(".px_wooregister").click(function (event) {
357         register.fadeIn();
358         login.hide();
359     });
360     $('.px_woorlogin').click(function (event) {
361         register.hide();
362         login.fadeIn();
363     });
364     $('.wpml-ls-menu-item .sub-menu').parents('li').prepend('<div class="arrow-up"></div>');
365 });
366
367 // After Translation
368 jQuery(document).ready(function ($) {
369     // Cart Page
370     $('.remove').attr('data-before', pxwpshop_vars.cart_product_remove);
371     $('.product-name').attr('data-before', pxwpshop_vars.cart_product);
372     $('.woocommerce-Price-amount.amount').attr('data-before', pxwpshop_vars.cart_product_price);
373     $('.quantity').attr('data-before', pxwpshop_vars.cart_product_quantity);
374     $('.woocommerce-Price-amount.amount').attr('data-before', pxwpshop_vars.cart_product_subtotal);
375     // Order Page
376     $('.order-number').attr('data-before', pxwpshop_vars.order_number_title);
377     $('.order-date').attr('data-before', pxwpshop_vars.order_date_title);
378     $('.order-status').attr('data-before', pxwpshop_vars.order_status_title);
379     $('.order-total').attr('data-before', pxwpshop_vars.order_total_title);
380 });
381
382 // Modal out of Fokus fix
383 jQuery(document).ready(function($){
384     $( ".px_myaccount" ).mouseenter(function() {
385         $( ".px_myaccount" ).click();
386     }).mouseleave(function() {
387         if( $( this ).find( 'input[name=username]' ).is( ':focus' ) ) {return false;}
388         if( $( this ).find( 'input[name=password]' ).is( ':focus' ) ) {return false;}
389         if( $( this ).find( 'input[name=email]' ).is( ':focus' ) ) {return false;}
390         if( $( this ).find( 'select' ).is( ':focus' ) ) {return false;}
391         $('#myModal').fadeOut();
392         $('#myModalLogout').fadeOut();
393     });
394 });
395
396 // Add Sticky Class to header
397 jQuery(document).ready(function($){
398     $(window).scroll(function() {
399         if ($(this).scrollTop() > 150){
400             $("#masthead").addClass("sticky");
401         } else {
402             $("#masthead").removeClass("sticky");
403         }
404     });
405 });
406
407 // Remove Tab extendet information table from woo
408 jQuery(document).ready(function($){
409     $('.woocommerce-product-attributes.shop_attributes').remove();
410 });
411
412 // Show Scroll to Top Button
413jQuery(document).ready(function($){
414  //Check to see if the window is top if not then display button
415  $(window).scroll(function(){
416      if ($(this).scrollTop() > 350) {
417          $('.scrollToTop').fadeIn();
418      } else {
419          $('.scrollToTop').fadeOut();
420      }
421  });
422  //Click event to scroll to top
423  $('.scrollToTop').click(function(){
424      $('html, body').animate({scrollTop : 0},800);
425      return false;
426  });
427});
428
429// positioning search form
430 jQuery(document).ready(function ($) {
431     $('.aws-search-result').appendTo( ".aws-search-form" );
432     //$('#terms').parent().html('<input type="checkbox" class="input-checkbox " name="terms" id="terms" value="1"> Ich habe die <a href="/agb" title="AGB">AGB</a> gelesen, verstanden und akzeptiere sie <abbr class="required" title="erforderlich">*</abbr>');
433 });

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.