From 7bedef46d702e43212466125d63fdad7dd4f0699 Mon Sep 17 00:00:00 2001 From: Sathvik P Date: Tue, 17 Jul 2012 13:12:43 +0530 Subject: [PATCH] $.setupPrintLink - Making it work even witout the to-print class --- jQuery.print.js | 63 +++++++++++++++++++++++++++---------------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/jQuery.print.js b/jQuery.print.js index c5b6bf4..4a4a565 100644 --- a/jQuery.print.js +++ b/jQuery.print.js @@ -6,6 +6,8 @@ (function($) { // A nice closure for our definitions + console.log($, $.fn); + $.fn.print = function() { // Print a given set of elements @@ -93,6 +95,7 @@ w.print(); w.close(); } + return this; } $.fn.setupPrintLink = function() { @@ -177,34 +180,38 @@ copy.prepend(options.prepend); var content = copy.html(); copy.remove(); - $(this).find(options.printLinkSelector).on("click select", - function() { - // Set the elements matching printLinkSelector - // to print on click/select - var w; - if (options.iframe) { - // Use an iframe for printing - $iframe = $(options.iframe); - iframeCount = $iframe.length; - if (iframeCount === 0) { - // Create a new iFrame if none is given - $iframe = $('