From bf42907ef673391ee79e16f92fab8c32ccd27c31 Mon Sep 17 00:00:00 2001 From: Christoph Burgmer Date: Thu, 12 Dec 2013 14:12:50 +0100 Subject: [PATCH] Bump version --- bower.json | 2 +- dist/rasterizeHTML.allinone.js | 2 +- dist/rasterizeHTML.js | 2 +- dist/rasterizeHTML.min.js | 2 +- package.json | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bower.json b/bower.json index 501d45c1..85cdcd12 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "rasterizeHTML.js", - "version": "0.6.0", + "version": "0.7.0", "main": [ "./dist/rasterizeHTML.js", "./dist/rasterizeHTML.allinone.js" diff --git a/dist/rasterizeHTML.allinone.js b/dist/rasterizeHTML.allinone.js index 29c4e49b..55df0db2 100644 --- a/dist/rasterizeHTML.allinone.js +++ b/dist/rasterizeHTML.allinone.js @@ -1,4 +1,4 @@ -/*! rasterizeHTML.js - v0.6.0 - 2013-12-12 +/*! rasterizeHTML.js - v0.7.0 - 2013-12-12 * http://www.github.com/cburgmer/rasterizeHTML.js * Copyright (c) 2013 Christoph Burgmer; Licensed MIT */ /* Integrated dependencies: diff --git a/dist/rasterizeHTML.js b/dist/rasterizeHTML.js index 385c7d4b..0b7761f0 100644 --- a/dist/rasterizeHTML.js +++ b/dist/rasterizeHTML.js @@ -1,4 +1,4 @@ -/*! rasterizeHTML.js - v0.6.0 - 2013-12-12 +/*! rasterizeHTML.js - v0.7.0 - 2013-12-12 * http://www.github.com/cburgmer/rasterizeHTML.js * Copyright (c) 2013 Christoph Burgmer; Licensed MIT */ window.rasterizeHTMLInline = (function (module) { diff --git a/dist/rasterizeHTML.min.js b/dist/rasterizeHTML.min.js index 18de30bd..86a34908 100644 --- a/dist/rasterizeHTML.min.js +++ b/dist/rasterizeHTML.min.js @@ -1,4 +1,4 @@ -/*! rasterizeHTML.js - v0.6.0 - 2013-12-12 +/*! rasterizeHTML.js - v0.7.0 - 2013-12-12 * http://www.github.com/cburgmer/rasterizeHTML.js * Copyright (c) 2013 Christoph Burgmer; Licensed MIT */ window.rasterizeHTMLInline=function(a){"use strict";var b=function(b){return a.util.joinUrl(b,".")},c=function(a){var c=a.map(function(c,d){return d===a.length-1&&(c={baseUrl:b(c.baseUrl)}),JSON.stringify(c)});return c},d=function(b,d){return d.cache!==!1&&"none"!==d.cache&&d.cacheBucket?a.util.memoize(b,c,d.cacheBucket):b},e=function(b,c,d,e){var f=b.attributes.src?b.attributes.src.nodeValue:null,g=a.util.getDocumentBaseUrl(b.ownerDocument),h=a.util.clone(c);return null===f||a.util.isDataUri(f)?(d(),void 0):(!h.baseUrl&&g&&(h.baseUrl=g),a.util.getDataURIForImageURL(f,h,function(a){b.attributes.src.nodeValue=a,d()},function(){e(a.util.joinUrl(h.baseUrl,f))}),void 0)},f=function(a){return Array.prototype.filter.call(a,function(a){return"image"===a.type})};a.loadAndInlineImages=function(b,c,d){var g=a.util.parseOptionalParameters(c,d),h=b.getElementsByTagName("img"),i=b.getElementsByTagName("input"),j=[],k=[];j=Array.prototype.slice.call(h),j=j.concat(f(i)),a.util.map(j,function(a,b){e(a,g.options,b,function(a){k.push({resourceType:"image",url:a,msg:"Unable to load image "+a}),b()})},function(){g.callback&&g.callback(k)})};var g=function(b,c,d,e){var f=a.css.rulesForCssText(b);a.css.loadCSSImportsForRules(f,c,d,function(c,g){a.css.loadAndInlineCSSResourcesForRules(f,d,function(d,h){var i=g.concat(h),j=c||d;j&&(b=a.css.cssRulesToText(f)),e(j,b,i)})})},h=function(b,c,e,f){var h=b.textContent,i=d(g,c);i(h,e,c,function(c,d,e){e=a.util.cloneArray(e),c&&(b.childNodes[0].nodeValue=d),f(e)})},i=function(a){var b=a.getElementsByTagName("style");return Array.prototype.filter.call(b,function(a){return!a.attributes.type||"text/css"===a.attributes.type.nodeValue})};a.loadAndInlineStyles=function(b,c,d){var e,f=a.util.parseOptionalParameters(c,d),g=i(b),j=[],k=[];e=a.util.clone(f.options),e.baseUrl=e.baseUrl||a.util.getDocumentBaseUrl(b),a.util.map(g,function(a,b){h(a,e,k,function(a){j=j.concat(a),b()})},function(){f.callback(j)})};var j=function(a,b){var c,d=a.parentNode;b=b.trim(),b&&(c=a.ownerDocument.createElement("style"),c.type="text/css",c.appendChild(a.ownerDocument.createTextNode(b)),d.insertBefore(c,a)),d.removeChild(a)},k=function(b,c,d,e){a.util.ajax(b,c,function(e){var f,g=a.css.rulesForCssText(e);f=a.css.adjustPathsOfCssResources(b,g),a.css.loadCSSImportsForRules(g,[],c,function(b,h){a.css.loadAndInlineCSSResourcesForRules(g,c,function(c,i){var j=h.concat(i);(f||b||c)&&(e=a.css.cssRulesToText(g)),d(e,j)})})},e)},l=function(b,c,e,f){var g=b.attributes.href.nodeValue,h=a.util.getDocumentBaseUrl(b.ownerDocument),i=a.util.clone(c);!i.baseUrl&&h&&(i.baseUrl=h);var j=d(k,c);j(g,i,function(b,c){c=a.util.cloneArray(c),e(b,c)},function(){f(a.util.joinUrl(i.baseUrl,g))})},m=function(a){var b=a.getElementsByTagName("link");return Array.prototype.filter.call(b,function(a){return a.attributes.rel&&"stylesheet"===a.attributes.rel.nodeValue&&(!a.attributes.type||"text/css"===a.attributes.type.nodeValue)})};a.loadAndInlineCssLinks=function(b,c,d){var e=a.util.parseOptionalParameters(c,d),f=m(b),g=[];a.util.map(f,function(a,b){l(a,e.options,function(c,d){j(a,c+"\n"),g=g.concat(d),b()},function(a){g.push({resourceType:"stylesheet",url:a,msg:"Unable to load stylesheet "+a}),b()})},function(){e.callback&&e.callback(g)})};var n=function(b,c,d,e){var f=b.attributes.src.nodeValue,g=a.util.getDocumentBaseUrl(b.ownerDocument),h=a.util.clone(c);!h.baseUrl&&g&&(h.baseUrl=g),a.util.ajax(f,h,d,function(){e(a.util.joinUrl(h.baseUrl,f))})},o=function(a){return a.replace(/<\//g,"<\\/")},p=function(a,b){a.attributes.removeNamedItem("src"),a.textContent=o(b)},q=function(a){var b=a.getElementsByTagName("script");return Array.prototype.filter.call(b,function(a){return!!a.attributes.src})};return a.loadAndInlineScript=function(b,c,d){var e=a.util.parseOptionalParameters(c,d),f=q(b),g=[];a.util.map(f,function(a,b){n(a,e.options,function(c){p(a,c),b()},function(a){g.push({resourceType:"script",url:a,msg:"Unable to load script "+a}),b()})},function(){e.callback&&e.callback(g)})},a.inlineReferences=function(b,c,d){var e=[];a.loadAndInlineImages(b,c,function(f){e=e.concat(f),a.loadAndInlineStyles(b,c,function(f){e=e.concat(f),a.loadAndInlineCssLinks(b,c,function(f){e=e.concat(f),c.inlineScripts===!1?d(e):a.loadAndInlineScript(b,c,function(a){e=e.concat(a),d(e)})})})})},a}(window.rasterizeHTMLInline||{}),window.rasterizeHTMLInline=function(a,b,c){"use strict";a.css={};var d=function(a){var b,c=document.implementation.createHTMLDocument(""),d=document.createElement("style");return d.textContent=a,c.body.appendChild(d),b=d.sheet.cssRules,Array.prototype.slice.call(b)},e=function(){var a=d("a{background:url(i)}");return!a.length||a[0].cssText.indexOf("url()")>=0}();a.css.rulesForCssText=function(a){return e&&c.parse?c.parse(a).cssRules:d(a)};var f=function(a){return a.filter(function(a){return a.type===b.CSSRule.STYLE_RULE&&(a.style.getPropertyValue("background-image")||a.style.getPropertyValue("background"))})},g=function(a){return a.filter(function(a){return a.type===b.CSSRule.FONT_FACE_RULE&&a.style.getPropertyValue("src")})};a.css.cssRulesToText=function(a){return a.reduce(function(a,b){return a+b.cssText},"")};var h=function(a){var b=/^"(.*)"$/,c=/^'(.*)'$/;return b.test(a)?a.replace(b,"$1"):c.test(a)?a.replace(c,"$1"):a},i=function(a){var b=/^[\t\r\f\n ]*(.+?)[\t\r\f\n ]*$/;return a.replace(b,"$1")};a.css.extractCssUrl=function(a){var b,c=/^url\(([^\)]+)\)/;if(!c.test(a))throw new Error("Invalid url");return b=c.exec(a)[1],h(i(b))};var j=function(a){var b,c=/^format\(([^\)]+)\)/;return c.test(a)?(b=c.exec(a)[1],h(b)):null},k=function(b){var c,d=null;try{return c=a.css.extractCssUrl(b[0]),b[1]&&(d=j(b[1])),{url:c,format:d}}catch(e){}},l=function(a,b,c){var d="@font-face { font-family: "+b.style.getPropertyValue("font-family")+"; ";b.style.getPropertyValue("font-style")&&(d+="font-style: "+b.style.getPropertyValue("font-style")+"; "),b.style.getPropertyValue("font-weight")&&(d+="font-weight: "+b.style.getPropertyValue("font-weight")+"; "),d+="src: "+c+"}",m(a,b,d)},m=function(a,b,c){var d=a.indexOf(b),e=b.parentStyleSheet;e.insertRule(c,d+1),e.deleteRule(d),a[d]=e.cssRules[d]};a.css.adjustPathsOfCssResources=function(b,c){var d,e=!1;return f(c).forEach(function(c){var f=c.style.getPropertyValue("background-image")||c.style.getPropertyValue("background"),g=r(f),h=!1;g.forEach(function(c){var d,e=s(c);e&&!a.util.isDataUri(e.url)&&(d=a.util.joinUrl(b,e.url),c[e.idx]='url("'+d+'")',h=!0)}),d=t(g),c.style.getPropertyValue("background-image")?c.style.setProperty("background-image",d):c.style.setProperty("background",d),e=e||h}),g(c).forEach(function(d){var f=w(d.style.getPropertyValue("src")),g=!1;f.forEach(function(c){var d,e=k(c);e&&!a.util.isDataUri(e.url)&&(d=a.util.joinUrl(b,e.url),c[0]='url("'+d+'")',g=!0)}),g&&l(c,d,x(f)),e=e||g}),n(c).forEach(function(d){var f=d.href,g=a.util.joinUrl(b,f);m(c,d,"@import url("+g+");"),e=!0}),e};var n=function(a){return a.filter(function(a){return a.type===b.CSSRule.IMPORT_RULE&&a.href})},o=function(a,b,c){var d=a.indexOf(b);a.splice(d,1),c.forEach(function(b,c){a.splice(d+c,0,b)})},p=function(a){var b=/^"(.*)"$/,c=/^'(.*)'$/;return b.test(a)||c.test(a)},q=function(b,c,d,e,f,g){var i,j=c.href;return p(j)&&(j=h(j)),i=a.util.joinUrl(e.baseUrl,j),d.indexOf(i)>=0?(o(b,c,[]),f([]),void 0):(d.push(i),a.util.ajax(j,e,function(g){var h=a.css.rulesForCssText(g);a.css.loadCSSImportsForRules(h,d,e,function(d,e){a.css.adjustPathsOfCssResources(j,h),o(b,c,h),f(e)})},function(){g(i)}),void 0)};a.css.loadCSSImportsForRules=function(b,c,d,e){var f,g=[];f=n(b),a.util.map(f,function(a,e){q(b,a,c,d,function(a){g=g.concat(a),e(!0)},function(a){g.push({resourceType:"stylesheet",url:a,msg:"Unable to load stylesheet "+a}),e(!1)})},function(a){var b=a.indexOf(!0)>=0;e(b,g)})};var r=function(a){var b,c="\\s*(?:\"[^\"]*\"|'[^']*'|[^\\(]+)\\s*",d="(url\\("+c+"\\)|[^,\\s]+)",e="(?:\\s*"+d+")+",f="^\\s*("+e+")(?:\\s*,\\s*("+e+"))*\\s*$",g=new RegExp(e,"g"),h=[],i=function(a){var b,c=new RegExp(d,"g"),e=[];for(b=c.exec(a);b;)e.push(b[1]),b=c.exec(a);return e};if(a.match(new RegExp(f))){for(b=g.exec(a);b;)h.push(i(b[0])),b=g.exec(a);return h}return[]},s=function(b){var c,d;for(c=0;c=0;c&&(f=t(e),b.style.getPropertyValue("background-image")?b.style.setProperty("background-image",f):b.style.setProperty("background",f)),d(c,g)})},v=function(b,c,d){var e,g=f(b),h=[];a.util.map(g,function(a,b){u(a,c,function(a,c){c.forEach(function(a){h.push({resourceType:"backgroundImage",url:a,msg:"Unable to load background-image "+a})}),b(a)})},function(a){e=a.indexOf(!0)>=0,d(e,h)})},w=function(a){var b,c="\\s*(?:\"[^\"]*\"|'[^']*'|[^\\(]+)\\s*",d="(local\\("+c+"\\))|(url\\("+c+"\\))(?:\\s+(format\\("+c+"\\)))?",e="^\\s*("+d+")(?:\\s*,\\s*("+d+"))*\\s*$",f=new RegExp(d,"g"),g=[],h=function(a){var b=[];return a.slice(1).forEach(function(a){a&&b.push(a)}),b};if(a.match(new RegExp(e))){for(b=f.exec(a);b;)g.push(h(b)),b=f.exec(a);return g}return[]},x=function(a){var b=[];return a.forEach(function(a){b.push(a.join(" "))}),b.join(", ")},y=function(b,c,d,e){var f,g,h,i,j=[];f=w(c.style.getPropertyValue("src")),a.util.map(f,function(b,c){return g=k(b),!g||a.util.isDataUri(g.url)?(c(!1),void 0):(h=g.format||"woff",a.util.binaryAjax(g.url,d,function(a){i=btoa(a),b[0]='url("data:font/'+h+";base64,"+i+'")',c(!0)},function(){j.push(a.util.joinUrl(d.baseUrl,g.url)),c(!1)}),void 0)},function(a){var d=a.indexOf(!0)>=0;d&&l(b,c,x(f)),e(d,j)})},z=function(b,c,d){var e,f=g(b),h=[];a.util.map(f,function(a,d){y(b,a,c,function(a,b){b.forEach(function(a){h.push({resourceType:"fontFace",url:a,msg:"Unable to load font-face "+a})}),d(a)})},function(a){e=a.indexOf(!0)>=0,d(e,h)})};return a.css.loadAndInlineCSSResourcesForRules=function(a,b,c){v(a,b,function(d,e){z(a,b,function(a,b){var f=d||a;c(f,e.concat(b))})})},a}(window.rasterizeHTMLInline||{},window,window.CSSOM||{}),window.rasterizeHTMLInline=function(a,b,c){"use strict";a.util={},a.util.getDocumentBaseUrl=function(a){return"about:blank"!==a.baseURI?a.baseURI:null},a.util.clone=function(a){var b,c={};for(b in a)a.hasOwnProperty(b)&&(c[b]=a[b]);return c},a.util.cloneArray=function(a){return Array.prototype.slice.apply(a,[0])},a.util.joinUrl=function(a,b){return c.resolve(a,b)},a.util.isDataUri=function(a){return/^data:/.test(a)},a.util.map=function(b,c,d){var e,f=0,g=a.util.cloneArray(b),h=[];0===g.length&&d(h);var i=function(a){function b(b){f+=1,h[a]=b,f===g.length&&d(h)}c(g[a],b)};for(e=0;e2&&"function"==typeof f[f.length-2]?(e=f.pop(),d=f.pop()):d=f.pop();var g,i=b(f),j=h(a);c[j]&&c[j][i]?d.apply(null,c[j][i]):(g=f.concat(function(){c[j]=c[j]||{},c[j][i]=arguments,d.apply(null,arguments)}),e&&(g=g.concat(e)),a.apply(null,g))}};var i=function(a){var b,c={};for(b in a)a.hasOwnProperty(b)&&(c[b]=a[b]);return c},j=function(a){return"function"==typeof a};return a.util.parseOptionalParameters=function(){var a={options:{},callback:null};return j(arguments[0])?a.callback=arguments[0]:(a.options=i(arguments[0]),a.callback=arguments[1]||null),a},a}(window.rasterizeHTMLInline||{},window,url),window.rasterizeHTML=function(a,b,c){"use strict";var d={},e=[];d.util={},d.util.getConstantUniqueIdFor=function(a){return e.indexOf(a)<0&&e.push(a),e.indexOf(a)};var f=function(a){var b,c={};for(b in a)a.hasOwnProperty(b)&&(c[b]=a[b]);return c},g=function(a){return"object"==typeof a&&null!==a},h=function(a){return g(a)&&Object.prototype.toString.apply(a).match(/\[object (Canvas|HTMLCanvasElement)\]/i)},i=function(a){return"function"==typeof a};d.util.parseOptionalParameters=function(a){var b={canvas:null,options:{},callback:null};return i(a[0])?b.callback=a[0]:null==a[0]||h(a[0])?(b.canvas=a[0]||null,i(a[1])?b.callback=a[1]:(b.options=f(a[1]),b.callback=a[2]||null)):(b.options=f(a[0]),b.callback=a[1]||null),b};var j=function(b,c){return function(){var d=new b,e=d.open;return d.open=function(){var b=Array.prototype.slice.call(arguments),d=b.shift(),f=b.shift(),g=a.util.joinUrl(c,f);return e.apply(this,[d,g].concat(b))},d}};d.util.executeJavascript=function(a,b,d,e){var f=s(c.document,"iframe"),g=a.documentElement.outerHTML,h=[],i=function(){var a=f.contentDocument;c.document.getElementsByTagName("body")[0].removeChild(f),e(a,h)};f.onload=d>0?function(){setTimeout(i,d)}:i,f.contentDocument.open(),f.contentWindow.XMLHttpRequest=j(f.contentWindow.XMLHttpRequest,b),f.contentWindow.onerror=function(a){h.push({resourceType:"scriptExecution",msg:a})},f.contentDocument.write(g),f.contentDocument.close()};var k=function(a,b,c){var d=a.createElement("iframe");return d.style.width=b+"px",d.style.height=c+"px",d.style.visibility="hidden",d.style.position="absolute",d.style.top=-1e4-c+"px",d.style.left=-1e4-b+"px",d.sandbox="allow-same-origin",a.getElementsByTagName("body")[0].appendChild(d),d};d.util.calculateDocumentContentSize=function(a,b,d,e){var f=a.documentElement.outerHTML,g=k(c.document,b,d);g.onload=function(){var a=g.contentDocument,b=Math.max(a.documentElement.scrollWidth,a.body.clientWidth),d=Math.max(a.documentElement.scrollHeight,a.body.scrollHeight,a.body.clientHeight);c.document.getElementsByTagName("body")[0].removeChild(g),e(b,d)},g.contentDocument.open(),g.contentDocument.write(f),g.contentDocument.close()};var l=function(a,b){var d,e,f,g,h=/]*)?)>/im.exec(b),i=c.document.implementation.createHTMLDocument("");if(h)for(d="",i.documentElement.innerHTML=d,f=i.querySelector("div"),e=0;e","text/html")?b=(new DOMParser).parseFromString(a,"text/html"):(b=c.document.implementation.createHTMLDocument(""),b.documentElement.innerHTML=a,l(b,a)),b};var m=null,n=function(a,b){return b===!1||"none"===b||"repeated"===b?((null===m||"repeated"!==b)&&(m=Date.now()),a+"?_="+m):a};d.util.loadDocument=function(b,c,d,e){var f=new window.XMLHttpRequest,g=a.util.joinUrl(c.baseUrl,b),h=n(g,c.cache);f.addEventListener("load",function(){200===f.status||0===f.status?d(f.responseXML):e()},!1),f.addEventListener("error",function(){e()},!1);try{f.open("GET",h,!0),f.responseType="document",f.send(null)}catch(i){e()}};var o=function(){if(c.navigator.userAgent.indexOf("WebKit")>=0&&c.navigator.userAgent.indexOf("Chrome")<0)return!1;if(c.BlobBuilder||c.MozBlobBuilder||c.WebKitBlobBuilder)return!0;if(c.Blob)try{return new c.Blob([""],{type:"text/xml"}),!0}catch(a){return!1}return!1},p=function(a){var b,d="image/svg+xml;charset=utf-8",e=c.BlobBuilder||c.MozBlobBuilder||c.WebKitBlobBuilder;return e?(b=new e,b.append(a),b.getBlob(d)):new c.Blob([a],{type:d})},q=function(a){var b=c.URL||c.webkitURL||window;return o()?b.createObjectURL(p(a)):"data:image/svg+xml;charset=utf-8,"+encodeURIComponent(a)},r=function(a){var b=c.URL||c.webkitURL||window;o()&&b.revokeObjectURL(a)},s=function(a,b){var c=a.createElement(b);return c.style.visibility="hidden",c.style.width="0px",c.style.height="0px",c.style.position="absolute",c.style.top="-10000px",c.style.left="-10000px",a.getElementsByTagName("body")[0].appendChild(c),c},t=function(a,b){var c=a.getElementById(b);return c||(c=s(a,"div"),c.id=b),c},u="rasterizeHTML_js_FirefoxWorkaround",v=function(){var a=c.navigator.userAgent.match(/Firefox\/(\d+).0/);return!a||!a[1]||parseInt(a[1],10)<17},w=function(a,b){var e,f=d.util.getConstantUniqueIdFor(a),g=b?b.ownerDocument:c.document;v()&&(e=t(g,u+f),e.innerHTML=a,e.className=u)},x=function(a){window.navigator.userAgent.indexOf("WebKit")>=0&&Array.prototype.forEach.call(a.getElementsByTagName("style"),function(a){a.textContent="span {}\n"+a.textContent})},y=function(a,b){var e=d.util.getConstantUniqueIdFor(a),f=b?b.ownerDocument:c.document,g=f.getElementById(u+e);g&&g.parentNode.removeChild(g)};d.util.addClassNameRecursively=function(a,b){a.className+=" "+b,a.parentNode!==a.ownerDocument&&d.util.addClassNameRecursively(a.parentNode,b)};var z=function(a,b){var c=a.parentStyleSheet,d=Array.prototype.indexOf.call(c.cssRules,a);c.insertRule(b,d+1),c.deleteRule(d)},A=function(a,b){var c=a.cssText.replace(/^[^\{]+/,""),d=b+" "+c;z(a,d)},B=function(a){return Array.prototype.reduce.call(a,function(a,b){return a+b.cssText},"")},C=function(a){a.textContent=B(a.sheet.cssRules)};d.util.rewriteStyleRuleSelector=function(a,b,c){var d=b+"(?=\\W|$)";Array.prototype.forEach.call(a.querySelectorAll("style"),function(a){var b=Array.prototype.filter.call(a.sheet.cssRules,function(a){return a.selectorText&&new RegExp(d).test(a.selectorText)});b.length&&(b.forEach(function(a){var b=a.selectorText.replace(new RegExp(d,"g"),c);A(a,b)}),C(a))})},d.util.fakeHover=function(a,b){var c=a.querySelector(b),e="rasterizehtmlhover";c&&(d.util.addClassNameRecursively(c,e),d.util.rewriteStyleRuleSelector(a,":hover","."+e))},d.util.fakeActive=function(a,b){var c=a.querySelector(b),e="rasterizehtmlactive";c&&(d.util.addClassNameRecursively(c,e),d.util.rewriteStyleRuleSelector(a,":active","."+e))},d.util.persistInputValues=function(a){var b=Array.prototype.slice.call(a.querySelectorAll("input")),c=Array.prototype.slice.call(a.querySelectorAll("textarea")),d=function(a){return"checkbox"===a.type||"radio"===a.type};b.filter(d).forEach(function(a){a.checked?a.setAttribute("checked",""):a.removeAttribute("checked")}),b.filter(function(a){return!d(a)}).forEach(function(a){a.setAttribute("value",a.value)}),c.forEach(function(a){a.textContent=a.value})},d.getSvgForDocument=function(a,c,d){var e;return x(a),e=b.serializeToString(a),''+e+""},d.renderSvg=function(a,b,d,e){var f,g,h=function(){g.onload=null,g.onerror=null},i=function(){f&&r(f),y(a,b)};w(a,b),f=q(a),g=new c.Image,g.onload=function(){h(),i(),d(g)},g.onerror=function(){i(),e()},g.src=f},d.drawImageOnCanvas=function(a,b){try{b.getContext("2d").drawImage(a,0,0)}catch(c){return!1}return!0},d.drawDocumentImage=function(a,b,c,e,f){var g=E(b,c);c.hover&&d.util.fakeHover(a,c.hover),c.active&&d.util.fakeActive(a,c.active),d.util.calculateDocumentContentSize(a,g.width,g.height,function(c,g){var h=d.getSvgForDocument(a,c,g);d.renderSvg(h,b,function(a){e(a)},f)})};var D=function(a,b,c,e,f){var g=function(a){a.push({resourceType:"document",msg:"Error rendering page"})};d.drawDocumentImage(a,b,c,function(a){var c;b&&(c=d.drawImageOnCanvas(a,b),c||(g(f),a=null)),e&&e(a,f)},function(){g(f),e&&e(null,f)})},E=function(a,b){var c=300,d=200,e=a?a.width:c,f=a?a.height:d,g=void 0!==b.width?b.width:e,h=void 0!==b.height?b.height:f;return{width:g,height:h}},F=function(b,c,e,f){var g,h=e.executeJsTimeout||0;g=a.util.clone(e),g.inlineScripts=e.executeJs===!0,a.inlineReferences(b,g,function(a){e.executeJs?d.util.executeJavascript(b,e.baseUrl,h,function(b,g){d.util.persistInputValues(b),D(b,c,e,f,a.concat(g))}):D(b,c,e,f,a)})};d.drawDocument=function(){var a=arguments[0],b=Array.prototype.slice.call(arguments,1),c=d.util.parseOptionalParameters(b);F(a,c.canvas,c.options,c.callback)};var G=function(a,b,c,e){var f=d.util.parseHTML(a);d.drawDocument(f,b,c,e)};d.drawHTML=function(){var a=arguments[0],b=Array.prototype.slice.call(arguments,1),c=d.util.parseOptionalParameters(b);G(a,c.canvas,c.options,c.callback)};var H=function(a,b,c,e){d.util.loadDocument(a,c,function(a){d.drawDocument(a,b,c,e)},function(){e&&e(null,[{resourceType:"page",url:a,msg:"Unable to load page "+a}])})};return d.drawURL=function(){var a=arguments[0],b=Array.prototype.slice.call(arguments,1),c=d.util.parseOptionalParameters(b);H(a,c.canvas,c.options,c.callback)},d}(window.rasterizeHTMLInline,window.xmlserializer,window); \ No newline at end of file diff --git a/package.json b/package.json index 60f210a6..890254fe 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rasterizeHTML.js", "title": "rasterizeHTML.js", - "version": "0.6.0", + "version": "0.7.0", "description": "Renders HTML into the browser's canvas.", "keywords": [ "canvas",