Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript extended functionality for jQuery printThis plugin #21

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

iliajie
Copy link

@iliajie iliajie commented Dec 10, 2013

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.

…d JavaScript to child (print) iframe

This modification is an example of how to extend plugin's functionality, by adding 'importJS' and 'loadJS' options.
@jasonday
Copy link
Owner

Can you set up a jsfiddle with a potential use case?
I have concerns with whether this will work in IE; specifically, IE8.

@iliajie
Copy link
Author

iliajie commented Dec 11, 2013

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!

@jasonday
Copy link
Owner

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.

@iliajie
Copy link
Author

iliajie commented Jan 28, 2014

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.

@jasonday
Copy link
Owner

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
#21 (comment).

@iliajie
Copy link
Author

iliajie commented Jan 29, 2014

No sure what you want, Jason! It will not work: http://jsbin.com/IkaYOFA/1
Do it on your local computer - it will work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants