// source --> https://shop.ducatibarcelona.com/wp-includes/js/zxcvbn-async.min.js?ver=1.0 
/*! This file is auto-generated */
!function(){function t(){var t,e=document.createElement("script");return e.src=_zxcvbnSettings.src,e.type="text/javascript",e.async=!0,(t=document.getElementsByTagName("script")[0]).parentNode.insertBefore(e,t)}null!=window.attachEvent?window.attachEvent("onload",t):window.addEventListener("load",t,!1)}.call(this);
// source --> https://shop.ducatibarcelona.com/wp-content/plugins/woocommerce-delivery-notes/js/jquery.print-link.js?ver=4.8.1 
(function($) {
		
	$.fn.printLink = function(options) {
		var iframe = null;
        var settings = $.extend({
            url: null
        }, options);
        
        // Apply to all elements
        return this.each(function() {
			
			// Click handler on the link
			$(this).on('click', function(event) {
				event.preventDefault();
	
				// Target element
				var element = $(this);

				// Get the url from the anchor or overwrite it
				var url = element.attr('href');
				if(settings.url) {
					url = settings.url;
				}
				
				// Open the url directly when an iframe printing is not supported.
				if(navigator.userAgent.match(/opera/i) || navigator.userAgent.match(/trident/i) || (navigator.userAgent.match(/msie/i) && window.addEventListener)) {				
					element.trigger('printLinkError');
					return false;
				}
				
				// Trigger load
				element.trigger('printLinkInit');
				
				// Print the url with a hidden iframe
				if(!$('#printLinkIframe')[0]) {
					// Create a new iframe
					var iframe = '<iframe id="printLinkIframe" name="printLinkIframe" src=' + url + ' style="position:absolute;top:-9999px;left:-9999px;border:0px;overfow:none; z-index:-1"></iframe>';
					$('body').append(iframe);
		
					// Start the printing when the url is loaded
					$('#printLinkIframe').on('load',function() {  
						element.trigger('printLinkComplete');
						frames['printLinkIframe'].focus();
						frames['printLinkIframe'].print();
					});
				} else {
					// Change the iframe src in case the iframe already exists
					$('#printLinkIframe').attr('src', url);
				}
			});
			
		});
        
        return this;
    };
 
}(jQuery));
// source --> https://shop.ducatibarcelona.com/wp-content/plugins/woocommerce-delivery-notes/js/theme.js?ver=4.8.1 
jQuery(document).ready(function($) {
		
	/*
	 * Print button
	 */	 
	$('.woocommerce .button.print').printLink();
	$('.woocommerce .button.print').on('printLinkError', function(event) {
		window.open(event.currentTarget.href);
	});
	
});