summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/shortcodes/js/recipes-printthis.js')
-rw-r--r--plugins/jetpack/modules/shortcodes/js/recipes-printthis.js39
1 files changed, 19 insertions, 20 deletions
diff --git a/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js b/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js
index f2a1937c..e1a6557c 100644
--- a/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js
+++ b/plugins/jetpack/modules/shortcodes/js/recipes-printthis.js
@@ -1,4 +1,4 @@
-/*
+/*!
* printThis v1.9.0
* @desc Printing plug-in for jQuery
* @author Jason Day
@@ -12,7 +12,8 @@
* http://www.opensource.org/licenses/mit-license.php
*
* (c) Jason Day 2015
- *
+ */
+/*
* Usage:
*
* $("#mySelector").printThis({
@@ -36,9 +37,9 @@
* - the loadCSS will load additional css (with or without @media print) into the iframe, adjusting layout
*
*/
-( function( $ ) {
+( function ( $ ) {
var opt;
- $.fn.printThis = function( options ) {
+ $.fn.printThis = function ( options ) {
opt = $.extend( {}, $.fn.printThis.defaults, options );
var $element = this instanceof jQuery ? this : $( this );
@@ -77,7 +78,7 @@
} );
// $iframe.ready() and $iframe.load were inconsistent between browsers
- setTimeout( function() {
+ setTimeout( function () {
// Add doctype to fix the style difference between printing and render
function setDocType( $iframe, doctype ) {
var win, doc;
@@ -114,7 +115,7 @@
// import page stylesheets
if ( opt.importCSS )
- $( 'link[rel=stylesheet]' ).each( function() {
+ $( 'link[rel=stylesheet]' ).each( function () {
var href = $( this ).attr( 'href' );
if ( href ) {
var media = $( this ).attr( 'media' ) || 'all';
@@ -126,10 +127,8 @@
// import style tags
if ( opt.importStyle )
- $( 'style' ).each( function() {
- $( this )
- .clone()
- .appendTo( $head );
+ $( 'style' ).each( function () {
+ $( this ).clone().appendTo( $head );
} );
// add title of the page
@@ -138,7 +137,7 @@
// import additional stylesheet(s)
if ( opt.loadCSS ) {
if ( $.isArray( opt.loadCSS ) ) {
- jQuery.each( opt.loadCSS, function( index, value ) {
+ jQuery.each( opt.loadCSS, function ( index, value ) {
$head.append( "<link type='text/css' rel='stylesheet' href='" + this + "'>" );
} );
} else {
@@ -152,7 +151,7 @@
if ( opt.canvas ) {
// add canvas data-ids for easy access after the cloning.
var canvasId = 0;
- $element.find( 'canvas' ).each( function() {
+ $element.find( 'canvas' ).each( function () {
$( this ).attr( 'data-printthis', canvasId++ );
} );
}
@@ -161,13 +160,13 @@
if ( opt.printContainer ) $body.append( $element.outer() );
// otherwise just print interior elements of container
else
- $element.each( function() {
+ $element.each( function () {
$body.append( $( this ).html() );
} );
if ( opt.canvas ) {
// Re-draw new canvases by referencing the originals
- $body.find( 'canvas' ).each( function() {
+ $body.find( 'canvas' ).each( function () {
var cid = $( this ).data( 'printthis' ),
$src = $( '[data-printthis="' + cid + '"]' );
@@ -183,7 +182,7 @@
// loop through inputs
var $input = $element.find( 'input' );
if ( $input.length ) {
- $input.each( function() {
+ $input.each( function () {
var $this = $( this ),
$name = $( this ).attr( 'name' ),
$checker = $this.is( ':checkbox' ) || $this.is( ':radio' ),
@@ -208,7 +207,7 @@
// loop through selects
var $select = $element.find( 'select' );
if ( $select.length ) {
- $select.each( function() {
+ $select.each( function () {
var $this = $( this ),
$name = $( this ).attr( 'name' ),
$value = $this.val();
@@ -219,7 +218,7 @@
// loop through textareas
var $textarea = $element.find( 'textarea' );
if ( $textarea.length ) {
- $textarea.each( function() {
+ $textarea.each( function () {
var $this = $( this ),
$name = $( this ).attr( 'name' ),
$value = $this.val();
@@ -241,7 +240,7 @@
// print "footer"
if ( opt.footer ) $body.append( opt.footer );
- setTimeout( function() {
+ setTimeout( function () {
if ( $iframe.hasClass( 'MSIE' ) ) {
// check if the iframe was created with the ugly hack
// and perform another ugly hack out of neccessity
@@ -259,7 +258,7 @@
// remove iframe after print
if ( ! opt.debug ) {
- setTimeout( function() {
+ setTimeout( function () {
$iframe.remove();
}, 1000 );
}
@@ -286,7 +285,7 @@
};
// $.selector container
- jQuery.fn.outer = function() {
+ jQuery.fn.outer = function () {
return $( $( '<div></div>' ).html( this.clone() ) ).html();
};
} )( jQuery );