• Installed plugin. Get this script at top of my page. When I deactivate plugin goes back to normal.

    Practised on staging site. Worked great! Site speed was awesome!

    post( 'https://www.serendipitygifts.co.za/wp-admin/admin-ajax.php', { action: 'ign_wishlist_get_popup_template', 'product_id' : 14252, 'n' : '5e928779f7' }, function( data ) { try { var parts = $.parseJSON( data ); // Check if there is an add to cart form in the page, usually exists if product is in stock if ( $( 'form.cart:first' ).length > 0 ) { $( 'form.cart:first' ).after( parts.button ); // No add to cart, is there an out of stock indictor? If so add button/link after that } else if ( $( '.product .out-of-stock' ).length > 0 ) { $( '.product .out-of-stock' ).after( parts.button ); } $( 'body' ).append( parts.popup ); // If this is a variable product hide the button until options selected var $variation_form = $('form.variations_form'); if ( 'undefined' !== $variation_form ) { $variation_form.parent().find('.wishlist_variation_wrap').hide(); } $( '.qty' ).on( 'change', function() { var qty = $( this ).val(); $( '#wishslist_entry_form' ).find( '.item_qty' ).val( qty ); }); $( '.cart .qty' ).trigger( 'change' ); } catch(e) { console.log( 'ERROR LOADING BUTTON AND POPUP FOR ADDING TO A LIST', e.message ); return; } // Hook to close the popup if ESC key is pressed $( document ).keyup(function (e) { if ( 27 == e.keyCode ) { if ( 'function' == typeof $('#wishlist-pop').modal ) { $('#wishlist-pop').modal( 'hide' ); } } }); //var temp_modal = $( 'div#wishlist-pop' ).clone(true).remove(); //temp_modal.appendTo( 'body' ); // Backdrop click closes modal $( '.ign-wl-modal-backdrop' ).on( 'click', function() { $('#wishlist-pop').modal( 'hide' ); }); $( 'input.wishlist_radio_toggle' ).on( 'click', function() { if ( 1 == $( this ).val() ) { jQuery( '.wishlist_new_wrap' ).hide() jQuery( '.wishlist_existing_ul' ).show(); } if ( 2 == $( this ).val() ) { jQuery( '.wishlist_existing_ul' ).hide(); jQuery( '.wishlist_new_wrap' ).show(); } }); $( 'input.wishlist_radio_toggle' ).on( 'change', function() { if ( 2 == $( this ).val() ) $( '.wishlist_new_wrap' ).show(); else $( '.wishlist_new_wrap' ).hide(); }); $( '.wishlist_radio_toggle:first()' ).trigger('click'); $( '.qty' ).on( 'change', function() { var qty = $( this ).val(); $( '#wishslist_entry_form' ).find( '.item_qty' ).val( qty ); }); $( '.qty' ).trigger( 'change' ); $( 'button#wishlist_close_button' ).on( 'click', function() { $( '#wishlist-pop' ).modal( 'hide' ); $( '.wl_form_wrap' ).show(); $( '.wl_result_wrap' ).html( '' ).hide(); $( '#wishlist_add_button' ).show(); $( '.wishslist_entry_form' ).trigger( 'reset' ); $( '.wishlist_radio_toggle[value="1"]' ).click(); }); $( 'button#wishlist_add_button' ).on( 'click', function() { $( '.wl_form_wrap' ).show(); $( '.wl_result_wrap' ).html( '' ).hide(); $( '#wishlist_add_button' ).show(); $( '.ign-wl-modal-dialog' ).block({ message: null, overlayCSS: { background: '#fff', opacity: 0.6 } }); var args = jQuery('form#wishslist_entry_form').serialize(); jQuery.ajax({ type : 'POST', cache : false, url : 'https://www.serendipitygifts.co.za/wp-admin/admin-ajax.php', data : args, success: function( data ) { try { var res = $.parseJSON( data ); if ( 'success' == res.result ) { $( '.wl_form_wrap' ).hide(); $( '.wl_result_wrap' ).html( res.message ).show(); $( '#wishlist_add_button' ).hide(); } else { $( '.wl_result_wrap' ).html( res.message ).show(); } } catch( e ) { $( '.wl_result_wrap' ).html( 'An error occurred parsing the response' ).show(); } $( '.ign-wl-modal-dialog' ).unblock(); }, error: function( data ) { $( '.ign-wl-modal-dialog' ).unblock(); } }); return false; }); // Close when clicking outside the modal $( document ).on( 'click', function( e ) { if ( !$( e.target ).hasClass( 'wishlist_button' ) && $( 'body' ).hasClass( 'modal-open' ) ) { if ( $( e.target ).closest( '.ign-wl-modal' ).length > 0 ) return; $( '#wishlist-pop' ).removeClass( 'show' ).modal( 'hide' ); } }); }); hook_wishlist_button(); }); function hook_wishlist_button() { jQuery( document ).on( 'click', '.wishlist_button', function() { // Just to be sure, in case a swatch plugin etc is being used which may not update quick enough, // do this right when the button is clicked var $form = jQuery('form.variations_form'); if ( 'undefined' !== typeof $form && $form.length > 0 ) { var var_id = jQuery('form.variations_form').find( '.variation_id' ).val(); if ( 'undefined' !== typeof var_id && null !== var_id && parseFloat( var_id ) > 0 ) { jQuery( '#wishslist_entry_form' ).find( '.vid' ).val( var_id ); } else { jQuery('form.variations_form').parent().find('.wishlist_variation_wrap').hide(); return; } } else { var pid = jQuery( this ).data( 'product_id' ); if ( '' !== pid ) { jQuery( '#wishslist_entry_form' ).find( '.prod' ).val( pid ); var qty = jQuery( 'form.cart' ).find( '.qty' ).val(); jQuery( '#wishslist_entry_form' ).find( '.item_qty' ).val( qty ); } } jQuery( '#wishlist-pop' ).addClass( 'show' ).modal( 'show' ); }); }

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Optimizing Matters

    (@optimizingmatters)

    Just had a look and although Autoptimize is not active I still see that code bermand. Based on the HTML source this is because of a stray <a between two blocks of javascript, see screenshot below;

    hope this helps,
    frank

    Thread Starter bermand

    (@bermand)

    Thanks for response.

    Not being a developer I have no idea where to find this scrip on my plesk dashboard.

    Can you direct me?

    Plugin Author Optimizing Matters

    (@optimizingmatters)

    I’m afraid I have no idea what/ how/ where that extra tag is being added bermand, but I would forget about Plesk in this case and focus on theme/ plugins; try disabling plugins one at a time to see to see if that fixes the problem and/or temporarily switch themes?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Breaking site’ is closed to new replies.