HEX
Server: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.30
System: Linux iZj6c1151k3ad370bosnmsZ 3.10.0-1160.76.1.el7.x86_64 #1 SMP Wed Aug 10 16:21:17 UTC 2022 x86_64
User: root (0)
PHP: 7.4.30
Disabled: NONE
Upload Files
File: /var/www/html/breadsecret.com/wp-content/plugins/woocommerce-delivery-notes/js/jquery.print-link.js
(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));