diff options
author | Mottie <wowmotty@gmail.com> | 2015-08-23 02:22:14 +0300 |
---|---|---|
committer | Mottie <wowmotty@gmail.com> | 2015-08-24 19:05:21 +0300 |
commit | 499adbd59e8958c1596b7ae60d410a733de7650a (patch) | |
tree | 61c3b3564215d6db01ce6b013b6878dc343c2d45 /printliminator.min.js | |
parent | d12145f26c63d37fd029bdb80a2cf0a539c3c8df (diff) |
Add grunt build process:
1) The "src/bookmarklet.js" file contains the uncompressed bookmarklet code.
2) In the build process, that file is minified & added into the "src/index.html"
file in two places:
a) The actual link href (default link).
b) development bookmarklet link (inside js code which updates the link).
3) A new "index.html" and minified "printliminator.min.js" file are written
to the root folder.
4) When the "index.html" in the root folder is loaded in the browser, and the
js detects the origin is "file://", then the links in the "index.html" file
get changed and to point to local files to make it easier for development.
Diffstat (limited to 'printliminator.min.js')
-rw-r--r-- | printliminator.min.js | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/printliminator.min.js b/printliminator.min.js new file mode 100644 index 0000000..c9cb424 --- /dev/null +++ b/printliminator.min.js @@ -0,0 +1 @@ +function csstricksPrintliminator(a){var b=a.noConflict(),c=[],d={},e=!1,f=("file://"===window.location.origin?"":"//css-tricks.github.io/The-Printliminator/")+"printliminator.png",g="._print_controls { position: fixed; top: 25px; right: 25px; width: 162px; height: 182px; z-index: 10000;-moz-user-select: none; -webkit-user-select: none; -ms-user-select: none;background: url("+f+") no-repeat; }._print_controls_close { position: absolute; top: -20px; right: -20px; width: 33px; height: 33px;background: url("+f+") -222px -3px no-repeat; }._print_controls_close:hover { background-position: -222px -39px; }._print_controls_remove_graphics, ._print_controls_print, ._print_controls_undo, ._print_controls_stylize {position: absolute; height: 74px; width: 74px;background: url("+f+") no-repeat; }._print_controls_remove_graphics { top: 6px; left: 6px; background-position: 0px -182px; }._print_controls_remove_graphics:hover { background-position: 0 -256px; }._print_controls_remove_graphics.active { background-position: 0 -330px; }._print_controls_print { top: 83px; left: 83px; background-position: -74px -182px; }._print_controls_print:hover { background-position: -74px -256px; }._print_controls_print.active { background-position: -74px -330px; }._print_controls_undo { top: 83px; left: 6px; background-position: -148px -182px; }._print_controls_undo:hover { background-position: -148px -256px; }._print_controls_undo.active { background-position: -148px -330px; }._print_controls_stylize { top: 6px; left: 83px; background-position: -222px -182px; }._print_controls_stylize:hover { background-position: -222px -256px; }._print_controls_stylize.active { background-position: -222px -330px; }._print_removed { display: none !important; }._printliminator_highlight { outline: 3px solid red; }@media print{ ._print_controls { display: none; } }",h='@media print, screen {body { margin:0; padding:0; line-height: 1.4; word-spacing: 1.1pt; letter-spacing: 0.2pt;font-family: Garamond, "Times New Roman", serif; color: #000; background: none; font-size: 12pt; }h1, h2, h3, h4, h5, h6 { font-family: Helvetica, Arial, sans-serif; }h1 { font-size: 19pt; }h2 { font-size: 17pt; }h3 { font-size: 15pt; }h4, h5, h6 { font-size: 12pt; }code { font: 10pt Courier, monospace; }blockquote { margin: 1.3em; padding: 1em; font-size: 10pt; }hr { background-color: #ccc; }img { float: left; margin: 1em 1.5em 1.5em 0; }a img { border: none; }table { margin: 1px; text-align: left; border-collapse: collapse; }th { border: 1px solid #333; font-weight: bold; }td { border: 1px solid #333; }th, td { padding: 4px 10px; }tfoot { font-style: italic; }caption { background: #fff; margin-bottom: 20px; text-align: left; }thead {display: table-header-group; }tr { page-break-inside: avoid; }} @media screen { body { padding: 20px; } }';b('<style id="_print_controls_styles">').text(g).appendTo("head"),b("body *:not(._print_controls, ._print_controls *)").live("click",function(a){if(!e){a.preventDefault();var d,f=b(this);d=a.altKey?b("body *").not("._print_controls, ._print_controls *, style").not(f.parents().andSelf()).not(f.find("*")).addClass("_print_removed"):f,d.addClass("_print_removed"),c.push(d)}}).live("mouseover",function(){e||b(this).addClass("_printliminator_highlight")}).live("mouseout",function(){e||b(this).removeClass("_printliminator_highlight")});var i=b('<div class="_print_controls">').appendTo("body");"fixed"!==i.css("position")&&i.css("position","absolute"),b('<div class="_print_controls_remove_graphics">').click(function(){if(!d.removeGraphics){var a,e,f,g=[],h=b("img, iframe, object, embed, input[type=image], ins"),i=b("body *:not(._print_controls, ._print_controls *)"),j=i.length;for(a=0;j>a;a++)e=i.eq(a),f=e.css("background-image"),"none"!==f&&(g.push([e,f]),e.css("background-image","none"));h.addClass("_print_removed"),d.removeGraphics=!0,c.push(function(){d.removeGraphics=!1,h.removeClass("_print_removed");var b,c=g.length;for(a=0;c>a;a++)b=g[a][0],b.css("background-image",g[a][1])})}}).appendTo(i),b('<div class="_print_controls_stylize">').click(function(){window.print()}).appendTo(i),b('<div class="_print_controls_print">').click(function(){if(!d.stylize){var a=b('link[rel="stylesheet"], style:not(#_print_controls_styles)').remove(),e=b("body *:not(._print_controls, ._print_controls > *, ._print_removed)").map(function(){var a=b(this),c=a.attr("style");return a.attr("style",""),{el:this,style:c}}),f=b('<style id="_print_controls_printstylesheet">').text(h).appendTo("head");d.stylize=!0,c.push(function(){d.stylize=!1,f.remove(),a.appendTo("head"),e.each(function(){b(this.el).attr("style",this.style)})})}}).appendTo(i),b('<div class="_print_controls_close">').click(function(){b("._print_controls, #_print_controls_styles").remove()}).appendTo(i),b('<div class="_print_controls_undo">').click(function(){var a=c.pop();a&&("function"!=typeof a?a.removeClass("_print_removed"):a.call())}).appendTo(i),b("._print_controls_remove_graphics, ._print_controls_print, ._print_controls_undo, ._print_controls_stylize").bind("mousedown",function(){b(this).addClass("active")}).bind("mouseleave mouseup",function(){b(this).removeClass("active")})}
\ No newline at end of file |