JavaScript extended functionality for jQuery printThis plugin
This modification is an example of how to extend plugin's functionality, by adding 'importJS' and 'loadJS' options. This will let the user to chose whether to load parent page's .js files and whether to execute custom JavaScript code.
Can you set up a jsfiddle with a potential use case? I have concerns with whether this will work in IE; specifically, IE8.
Jason, I have checked and it worked in IE11 and most likely will work in version 9 and 10. I can't setup jsFiddle for you with the particuar example as it takes to much time but can tell you when I needed it.
We use printThis to print certain part of pages. When you use dynamic libraries to arrange content (like Masonry or Isotope), for example to force all tables with different height, to be positioned right below each other, you need to reload those for print version, because you change the font's size, and other formatting for print version almost everytime. When you do it, the content's height is also changing and you need to reload js to make it look correct on the print verstion.
Simplest way to check it is just to add alert to the code and run accros all browsers:
$("#mySelector").printThis({ loadJS: 'alert("JS has been loaded");' });
Try it it should work everywhere, if not, tell me where it's not working and I will try to debug to make it work!
Hi rostovstev, I'd like to merge this pull request, however I am requiring that the author/reporter provide a demo of any changes (or bugs) in jsfiddle.net or jsbin.com for review & browser testing.
Jason, as the code uses document.write, it's disallowed on jsFiddle.net and returns an error:
document.write is disallowed in JSFiddle envioriment and might break your fiddle.
Can you try jsbin.com?
On 1/28/2014 5:43 AM, Ilia wrote:
Jason, as the code uses document.write, it's disallowed on jsFiddle.net and returns an error:
|document.write is disallowed in JSFiddle envioriment and might break your fiddle. |
— Reply to this email directly or view it on GitHub https://github.com/jasonday/printThis/pull/21#issuecomment-33467614.
No sure what you want, Jason! It will not work: http://jsbin.com/IkaYOFA/1 Do it on your local computer - it will work.