Skip to content

Commit

Permalink
1.13.0
Browse files Browse the repository at this point in the history
Add removeInlineSelector
  • Loading branch information
oculus42 committed Jul 16, 2018
1 parent c6ba394 commit 00483f4
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 7 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Printing plug-in for jQuery
* Preserve page CSS/styling
** or add new CSS; the world is your oyster!
* Preserve form entries
* **Canvas support (experimental)**
* Canvas support


## Usage
Expand Down Expand Up @@ -59,8 +59,8 @@ Use a custom page title on the iframe. This may be reflected on the printed page
Eliminates any inline style attributes from the content. Off by default.

#### removeInlineSelector
Eliminates custom inline style attributes from the content. Off by default. Requires removeInline to be true.
Excepts custom jquery selectors. Default is "*"
Filter which inline style attributes to remove. Requires `removeInline` to be true.
Accepts custom CSS/jQuery selectors. Default is `"*"`

#### printDelay
The amount of time to wait before calling `print()` in the printThis iframe. Defaults to 333 milliseconds.
Expand Down Expand Up @@ -120,6 +120,7 @@ $("#mySelector").printThis({
loadCSS: "path/to/my.css", // path to additional css file - use an array [] for multiple
pageTitle: "", // add title to print page
removeInline: false, // remove all inline styles from print elements
removeInlineSelector: "*", // filter elements from which to remove inline styles
printDelay: 333, // variable print delay; depending on complexity a higher value may be necessary
header: null, // prefix to html
footer: null, // postfix to html
Expand Down
4 changes: 4 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
07/15/2018 Add removeInlineSelector to allow filtering which inline styles are removed
Remove "experimental" tag from Canvas support. We're pretty stable at this point.
Bump to 1.13.0

03/18/2018 Fixed importStyle
Bumped to 1.12.3

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "print-this",
"version": "1.12.3",
"version": "1.13.0",
"description": "Printing plug-in for jQuery",
"main": "printThis.js",
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion printThis.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "printThis",
"version": "1.12.3",
"version": "1.13.0",
"title": "printThis",
"description": "Printing plug-in for jQuery. Print specific page elements, add print options, maintain or add new styling using jQuery.",
"author": {
Expand Down
6 changes: 4 additions & 2 deletions printThis.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,11 +225,13 @@

// remove inline styles
if (opt.removeInline) {
// Ensure there is a selector, even if it's been mistakenly removed
var selector = opt.removeInlineSelector || '*';
// $.removeAttr available jQuery 1.7+
if ($.isFunction($.removeAttr)) {
$body.find(opt.removeInlineSelector).removeAttr("style");
$body.find(selector).removeAttr("style");
} else {
$body.find(opt.removeInlineSelector).attr("style", "");
$body.find(selector).attr("style", "");
}
}

Expand Down

0 comments on commit 00483f4

Please sign in to comment.