Skip to content

Conversation

@Zae
Copy link

@Zae Zae commented Feb 1, 2012

Not all changes were needed, but I did them anyway to get the code a bit cleaner and easier to understand.

Basic changes:

  • Use $prefix on all jQuery variables
  • Use var print_frame_ref = $print_frame.get(0).contentDocument; to get contentDocument of iframe.
  • Use $print_frame.height($print_frame.contents().height()); to get/set height of iframe contents
  • Also clone() scripts to the iframe, (I needed them for my layout)
  • Use
    $('img').on('load', print_frame_ref, function(){
    $print_frame.height($print_frame.contents().height());
    })
    To bind load events of images inside the iframe.
  • Rename distroyPrintPreview to destroyPrintPreview.
  • Rename resize..printPreview.mask to resize.printPreview.mask

NOTE: Uses the new on method so requires jQuery 1.7

Zae added 2 commits February 1, 2012 11:42
Basic changes:
+ Use $prefix on all jQuery variables
+ Use var print_frame_ref = $print_frame.get(0).contentDocument; to get contentDocument of iframe.
+ Use $print_frame.height($print_frame.contents().height()); to get/set height of iframe contents
+ Also clone() scripts to the iframe, (I needed them for my layout)
+ Use
$('img').on('load', print_frame_ref, function(){
	$print_frame.height($print_frame.contents().height());
})
To bind load events of images inside the iframe.
+ Rename distroyPrintPreview to destroyPrintPreview.
+ Rename resize..printPreview.mask to resize.printPreview.mask

NOTE: Uses the new on method so requires jQuery 1.7
…w it worked anyway. Oh well, also ran the code through JsLint.
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.

1 participant