Skip to content
Browse files

Fixed issue 8 on print element

  • Loading branch information...
1 parent 785818d commit 0521f3a7d9006f116ec38a66fcd10909ba4c3ccc @erikzaadi committed Jul 7, 2010
View
1 Docs/SUBPROJECTS
@@ -1 +0,0 @@
-{"subprojects":[{"name":"jQuery.Console","src" : "jQuery.Console"},{"name":"jQuery.GitHubBadge","src":"jQuery.GitHubBadge"},{"name":"JQuery.LateLoader","src":"JQuery.LateLoader"},{"name":"jQuery.printElement","src":"jQuery.printElement"}]}
View
1 jQuery.Console/Docs/SAMPLE
@@ -1 +0,0 @@
-{"Includes":[{"Name":"Sample","URL":"Docs/sample.html","ContentType":"text/html","IsBinary":false},{"Name":"MinScriptInclude","URL":"jQuery.Console.min.js","ContentType":"text/javascript","IsBinary":false},{"Name":"SampleScriptInclude","URL":"Docs/sample.js","ContentType":"text/javascript","IsBinary":false}]}
View
1 jQuery.Console/Docs/SUBPROJECT
@@ -1 +0,0 @@
-{"Download":"jQuery.Console.js","DownloadText":"source","AlternateDownload":"jQuery.Console.min.js","AlternateDownloadText":"minified"}
View
13 jQuery.Console/Docs/sample.html
@@ -1,13 +0,0 @@
-<div>
- <div>
- <label>
- Enter a jQuery Selector </label> <input type="text" id="selector" value="Enter your selector" />
- <input type="button" class="ui-state-default" id="testCustomSelector" value="Test" />
- </div>
- <div>
- <label>
- Custom Logging sample
- </label>
- <input type="button" class="ui-state-default" id="testCustomData" value="Test" />
- </div>
-</div>
View
23 jQuery.Console/Docs/sample.js
@@ -1,23 +0,0 @@
-function InitConsoleSample(){
- $("#testCustomSelector").click(function(){
- var selector = $("#selector").val();
- var $selection = $(selector);
- if ($selection.length)
- $selection.Console();
- else
- $("<div>'" + selector + "' selector did not match any elements..</div>").dialog({
- modal :true,
- buttons : {
- 'OK': function(){
- $(this).dialog('destroy').remove();
- }}
- });
- });
- $("#testCustomData").click(function(){
- $.Console.Info('message',['dsad','dasdas'],{orJSON:'312'});
- });
-}
-
-$(document).ready(function(){
-InitConsoleSample();
-});
View
2 jQuery.printElement/jquery.printElement.js
@@ -1,6 +1,6 @@
/// <reference path="http://code.jquery.com/jquery-1.4.1-vsdoc.js" />
/*
-* Print Element Plugin 1.1a
+* Print Element Plugin 1.2
*
* Copyright (c) 2010 Erik Zaadi
*
View
43 jQuery.printElement/jquery.printElement.min.js
@@ -1,27 +1,28 @@
-/*
-* Print Element Plugin 1.1a
-*
-* Copyright (c) 2010 Erik Zaadi
-*
-* Inspired by PrintArea (http://plugins.jquery.com/project/PrintArea) and
-* http://stackoverflow.com/questions/472951/how-do-i-print-an-iframe-from-javascript-in-safari-chrome
-*
-* Home Page : http://projects.erikzaadi/jQueryPlugins/jQuery.printElement
-* Issues (bug reporting) : http://github.com/erikzaadi/jQueryPlugins/issues/labels/printElement
-* jQuery plugin page : http://plugins.jquery.com/project/printElement
-*
-* Thanks to David B (http://github.com/ungenio) and icgJohn (http://www.blogger.com/profile/11881116857076484100)
-* For their great contributions!
-*
-* Dual licensed under the MIT and GPL licenses:
-* http://www.opensource.org/licenses/mit-license.php
-* http://www.gnu.org/licenses/gpl.html
-*
-* Note, Iframe Printing is not supported in Opera and Chrome 3.0, a popup window will be shown instead
+/// <reference path="http://code.jquery.com/jquery-1.4.1-vsdoc.js" />
+/*
+* Print Element Plugin 1.2
+*
+* Copyright (c) 2010 Erik Zaadi
+*
+* Inspired by PrintArea (http://plugins.jquery.com/project/PrintArea) and
+* http://stackoverflow.com/questions/472951/how-do-i-print-an-iframe-from-javascript-in-safari-chrome
+*
+* Home Page : http://projects.erikzaadi/jQueryPlugins/jQuery.printElement
+* Issues (bug reporting) : http://github.com/erikzaadi/jQueryPlugins/issues/labels/printElement
+* jQuery plugin page : http://plugins.jquery.com/project/printElement
+*
+* Thanks to David B (http://github.com/ungenio) and icgJohn (http://www.blogger.com/profile/11881116857076484100)
+* For their great contributions!
+*
+* Dual licensed under the MIT and GPL licenses:
+* http://www.opensource.org/licenses/mit-license.php
+* http://www.gnu.org/licenses/gpl.html
+*
+* Note, Iframe Printing is not supported in Opera and Chrome 3.0, a popup window will be shown instead
*/
;(function(g){function k(c){c&&c.printPage?c.printPage():setTimeout(function(){k(c)},50)}function l(c){c=a(c);a(":checked",c).each(function(){this.setAttribute("checked","checked")});a("input[type='text']",c).each(function(){this.setAttribute("value",a(this).val())});a("select",c).each(function(){var b=a(this);a("option",b).each(function(){b.val()==a(this).val()&&this.setAttribute("selected","selected")})});a("textarea",c).each(function(){var b=a(this).attr("value");if(a.browser.b&&this.firstChild)this.firstChild.textContent=
b;else this.innerHTML=b});return a("<div></div>").append(c.clone()).html()}function m(c,b){var i=a(c);c=l(c);var d=[];d.push("<html><head><title>"+b.pageTitle+"</title>");if(b.overrideElementCSS){if(b.overrideElementCSS.length>0)for(var f=0;f<b.overrideElementCSS.length;f++){var e=b.overrideElementCSS[f];typeof e=="string"?d.push('<link type="text/css" rel="stylesheet" href="'+e+'" >'):d.push('<link type="text/css" rel="stylesheet" href="'+e.href+'" media="'+e.media+'" >')}}else a("link",j).filter(function(){return a(this).attr("rel").toLowerCase()==
-"stylesheet"}).each(function(){d.push('<link type="text/css" rel="stylesheet" href="'+a(this).attr("href")+'" media="'+a(this).attr("media")+'" >')});d.push('<base href="'+(g.location.protocol+"//"+g.location.hostname+(g.location.port?":"+ +g.location.port:"")+g.location.pathname)+'" />');d.push('</head><body style="'+b.printBodyOptions.styleToAdd+'" class="'+b.printBodyOptions.classNameToAdd+'">');d.push('<div class="'+i.attr("class")+'">'+c+"</div>");d.push('<script type="text/javascript">function printPage(){focus();print();'+
+"stylesheet"}).each(function(){d.push('<link type="text/css" rel="stylesheet" href="'+a(this).attr("href")+'" media="'+a(this).attr("media")+'" >')});d.push('<base href="'+(g.location.protocol+"//"+g.location.hostname+(g.location.port?":"+g.location.port:"")+g.location.pathname)+'" />');d.push('</head><body style="'+b.printBodyOptions.styleToAdd+'" class="'+b.printBodyOptions.classNameToAdd+'">');d.push('<div class="'+i.attr("class")+'">'+c+"</div>");d.push('<script type="text/javascript">function printPage(){focus();print();'+
(!a.browser.opera&&!b.leaveOpen&&b.printMode.toLowerCase()=="popup"?"close();":"")+"}<\/script>");d.push("</body></html>");return d.join("")}var j=g.document,a=g.jQuery;a.fn.printElement=function(c){var b=a.extend({},a.fn.printElement.defaults,c);if(b.printMode=="iframe")if(a.browser.opera||/chrome/.test(navigator.userAgent.toLowerCase()))b.printMode="popup";a("[id^='printElement_']").remove();return this.each(function(){var i=a.a?a.extend({},b,a(this).data()):b,d=a(this);d=m(d,i);var f=null,e=null;
if(i.printMode.toLowerCase()=="popup"){f=g.open("about:blank","printElementWindow","width=650,height=440,scrollbars=yes");e=f.document}else{f="printElement_"+Math.round(Math.random()*99999).toString();var h=j.createElement("IFRAME");a(h).attr({style:i.iframeElementOptions.styleToAdd,id:f,className:i.iframeElementOptions.classNameToAdd,frameBorder:0,scrolling:"no",src:"about:blank"});j.body.appendChild(h);e=h.contentWindow||h.contentDocument;if(e.document)e=e.document;h=j.frames?j.frames[f]:j.getElementById(f);
f=h.contentWindow||h}focus();e.open();e.write(d);e.close();k(f)})};a.fn.printElement.defaults={printMode:"iframe",pageTitle:"",overrideElementCSS:null,printBodyOptions:{styleToAdd:"padding:10px;margin:10px;",classNameToAdd:""},leaveOpen:false,iframeElementOptions:{styleToAdd:"border:none;position:absolute;width:0px;height:0px;bottom:0px;left:0px;",classNameToAdd:""}};a.fn.printElement.cssElement={href:"",media:""}})(window);

0 comments on commit 0521f3a

Please sign in to comment.
Something went wrong with that request. Please try again.