diff --git a/.gitignore b/.gitignore
index edead75..b9aa072 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,8 +5,7 @@
/tests/cache/
/tests/flashcanvas.html
/lib/
-/dist/
-/build/*.js
+/build/
index.html
image.jpg
screenshots.html
diff --git a/build.xml b/build.xml
index 742b709..46a5505 100644
--- a/build.xml
+++ b/build.xml
@@ -1,4 +1,4 @@
-
+
@@ -11,44 +11,56 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
+
+ Creating directory ${build.dir}...
+
+
+
+
+ Creating ${JQUERY_PLUGIN_NAME}...
+
-
+
+ Concatenating files:${line.separator}${prettty-sourcefiles}${line.separator}into ${build.dir}/${JS_NAME}...
-
+
-
-
+
+ output="${build.dir}/${JS_NAME_MIN}.tmp">
@@ -61,15 +73,28 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
diff --git a/build/.gitkeepdir b/build/.gitkeepdir
deleted file mode 100644
index e69de29..0000000
diff --git a/readme.md b/readme.md
index aeb934d..7ebc8cd 100644
--- a/readme.md
+++ b/readme.md
@@ -37,10 +37,15 @@ For more information and examples, please visit the cobexer)
+
+
v0.32 - 20.2.2012
* Added changelog!
* Added bookmarklet (cobexer)
* Option to select single element to render (niklasvh)
* Fixed closure compiler warnings (cobexer)
-* Enable profiling in FF (cobexer)
\ No newline at end of file
+* Enable profiling in FF (cobexer)
diff --git a/src/Core.js b/src/Core.js
index 35be7f2..a10efda 100644
--- a/src/Core.js
+++ b/src/Core.js
@@ -10,11 +10,13 @@ var html2canvas = {};
html2canvas.logging = false;
-html2canvas.log = function (a) {
+function h2clog(a) {
if (html2canvas.logging && window.console && window.console.log) {
window.console.log(a);
}
-};
+}
+
+html2canvas.log = h2clog; // for compatibility with the jquery plugin
html2canvas.Util = {};
@@ -140,8 +142,8 @@ html2canvas.Util.Children = function(el) {
try {
children = $(el).contents();
} catch (ex) {
- html2canvas.log("html2canvas.Util.Children failed with exception: " + ex.message);
+ h2clog("html2canvas.Util.Children failed with exception: " + ex.message);
children = [];
}
return children;
-}
+};
diff --git a/src/Generate.js b/src/Generate.js
index 3cc0168..6717296 100644
--- a/src/Generate.js
+++ b/src/Generate.js
@@ -108,7 +108,7 @@ html2canvas.Generate.Gradient = function(src, bounds) {
lingrad.addColorStop(increment * i, steps[i]);
}
catch(e) {
- html2canvas.log(['failed to add color stop: ', e, '; tried to add: ', steps[i], '; stop: ', i, '; in: ', src]);
+ h2clog(['failed to add color stop: ', e, '; tried to add: ', steps[i], '; stop: ', i, '; in: ', src]);
}
}
diff --git a/src/Parse.js b/src/Parse.js
index c47c35c..15c2c9c 100644
--- a/src/Parse.js
+++ b/src/Parse.js
@@ -1002,7 +1002,7 @@ html2canvas.Parse = function (element, images, opts) {
}
}else{
- html2canvas.log("html2canvas: Error loading background:" + background_image);
+ h2clog("html2canvas: Error loading background:" + background_image);
//console.log(images);
}
@@ -1051,7 +1051,7 @@ html2canvas.Parse = function (element, images, opts) {
stack = {
- ctx: html2canvas.canvasContext( docDim.width || w , docDim.height || h ),
+ ctx: h2cRenderContext( docDim.width || w , docDim.height || h ),
zIndex: zindex,
opacity: opacity * parentStack.opacity,
cssPosition: cssPosition
@@ -1162,7 +1162,7 @@ html2canvas.Parse = function (element, images, opts) {
);
}else{
- html2canvas.log("html2canvas: Error loading
:" + imgSrc);
+ h2clog("html2canvas: Error loading
:" + imgSrc);
}
break;
case "INPUT":
diff --git a/src/Preload.js b/src/Preload.js
index 3b54cb6..13d0283 100644
--- a/src/Preload.js
+++ b/src/Preload.js
@@ -45,7 +45,7 @@ html2canvas.Preload = function(element, opts){
}
function start(){
- html2canvas.log("html2canvas: start: images: " + images.numLoaded + " / " + images.numTotal + " (failed: " + images.numFailed + ")");
+ h2clog("html2canvas: start: images: " + images.numLoaded + " / " + images.numTotal + " (failed: " + images.numFailed + ")");
if (!images.firstRun && images.numLoaded >= images.numTotal){
/*
@@ -57,7 +57,7 @@ html2canvas.Preload = function(element, opts){
options.complete(images);
}
- html2canvas.log("Finished loading images: # " + images.numTotal + " (failed: " + images.numFailed + ")");
+ h2clog("Finished loading images: # " + images.numTotal + " (failed: " + images.numFailed + ")");
}
}
@@ -169,7 +169,7 @@ html2canvas.Preload = function(element, opts){
elNodeType = el.nodeType;
} catch (ex) {
elNodeType = false;
- html2canvas.log("html2canvas: failed to access some element's nodeType - Exception: " + ex.message);
+ h2clog("html2canvas: failed to access some element's nodeType - Exception: " + ex.message);
}
if (elNodeType === 1 || elNodeType === undefined){
@@ -256,9 +256,9 @@ html2canvas.Preload = function(element, opts){
var img, src;
if (!images.cleanupDone) {
if (cause && typeof cause === "string") {
- html2canvas.log("html2canvas: Cleanup because: " + cause);
+ h2clog("html2canvas: Cleanup because: " + cause);
} else {
- html2canvas.log("html2canvas: Cleanup after timeout: " + options.timeout + " ms.");
+ h2clog("html2canvas: Cleanup after timeout: " + options.timeout + " ms.");
}
for (src in images) {
@@ -276,7 +276,7 @@ html2canvas.Preload = function(element, opts){
}
images.numLoaded++;
images.numFailed++;
- html2canvas.log("html2canvas: Cleaned up failed img: '" + src + "' Steps: " + images.numLoaded + " / " + images.numTotal);
+ h2clog("html2canvas: Cleaned up failed img: '" + src + "' Steps: " + images.numLoaded + " / " + images.numTotal);
}
}
}
@@ -307,19 +307,19 @@ html2canvas.Preload = function(element, opts){
if (options.timeout > 0) {
timeoutTimer = window.setTimeout(methods.cleanupDOM, options.timeout);
}
- html2canvas.log('html2canvas: Preload starts: finding background-images');
+ h2clog('html2canvas: Preload starts: finding background-images');
images.firstRun = true;
getImages( element );
- html2canvas.log('html2canvas: Preload: Finding images');
+ h2clog('html2canvas: Preload: Finding images');
// load
images
for (i = 0; i < imgLen; i+=1){
methods.loadImage( domImages[i].getAttribute( "src" ) );
}
images.firstRun = false;
- html2canvas.log('html2canvas: Preload: Done.');
+ h2clog('html2canvas: Preload: Done.');
if ( images.numTotal === images.numLoaded ) {
start();
}
diff --git a/src/Queue.js b/src/Queue.js
index 1c9eb2a..3113467 100644
--- a/src/Queue.js
+++ b/src/Queue.js
@@ -5,7 +5,7 @@
Released under MIT License
*/
-html2canvas.canvasContext = function (width, height) {
+function h2cRenderContext(width, height) {
var storage = [];
return {
storage: storage,
@@ -40,4 +40,4 @@ html2canvas.canvasContext = function (width, height) {
});
}
};
-};
+}
diff --git a/src/Renderer.js b/src/Renderer.js
index 074bf2b..bd09493 100644
--- a/src/Renderer.js
+++ b/src/Renderer.js
@@ -176,7 +176,7 @@ html2canvas.Renderer = function(parseQueue, opts){
}
- html2canvas.log("html2canvas: Renderer: Canvas renderer done - returning canvas obj");
+ h2clog("html2canvas: Renderer: Canvas renderer done - returning canvas obj");
// this.canvasRenderStorage(queue,this.ctx);
queueLen = options.elements.length;
@@ -390,7 +390,7 @@ html2canvas.Renderer = function(parseQueue, opts){
- html2canvas.log("html2canvas: Renderer: SVG Renderer done - returning SVG DOM obj");
+ h2clog("html2canvas: Renderer: SVG Renderer done - returning SVG DOM obj");
return svg;
@@ -405,11 +405,11 @@ html2canvas.Renderer = function(parseQueue, opts){
case "canvas":
canvas = doc.createElement('canvas');
if (canvas.getContext){
- html2canvas.log("html2canvas: Renderer: using canvas renderer");
+ h2clog("html2canvas: Renderer: using canvas renderer");
return canvasRenderer(parseQueue);
} else {
usingFlashcanvas = true;
- html2canvas.log("html2canvas: Renderer: canvas not available, using flashcanvas");
+ h2clog("html2canvas: Renderer: canvas not available, using flashcanvas");
var script = doc.createElement("script");
script.src = options.flashcanvas;
@@ -436,7 +436,7 @@ html2canvas.Renderer = function(parseQueue, opts){
window.setTimeout( intervalFunc, 250 );
} else {
- html2canvas.log("html2canvas: Renderer: Can't track when flashcanvas is loaded");
+ h2clog("html2canvas: Renderer: Can't track when flashcanvas is loaded");
}
@@ -446,9 +446,9 @@ html2canvas.Renderer = function(parseQueue, opts){
})(script, function(){
- if (typeof FlashCanvas !== "undefined") {
- html2canvas.log("html2canvas: Renderer: Flashcanvas initialized");
- FlashCanvas.initElement( canvas );
+ if (typeof window.FlashCanvas !== "undefined") {
+ h2clog("html2canvas: Renderer: Flashcanvas initialized");
+ window.FlashCanvas.initElement( canvas );
canvasRenderer(parseQueue);
}
});
@@ -460,7 +460,7 @@ html2canvas.Renderer = function(parseQueue, opts){
break;
case "svg":
if (doc.createElementNS){
- html2canvas.log("html2canvas: Renderer: using SVG renderer");
+ h2clog("html2canvas: Renderer: using SVG renderer");
return svgRenderer(parseQueue);
}
break;
diff --git a/src/html2canvas-post.txt b/src/html2canvas-post.txt
new file mode 100644
index 0000000..77b193e
--- /dev/null
+++ b/src/html2canvas-post.txt
@@ -0,0 +1,2 @@
+window.html2canvas = html2canvas;
+}(window, document));
diff --git a/src/html2canvas-pre.txt b/src/html2canvas-pre.txt
new file mode 100644
index 0000000..d9cc589
--- /dev/null
+++ b/src/html2canvas-pre.txt
@@ -0,0 +1 @@
+(function(window, document, undefined){
diff --git a/tests/test.js b/tests/test.js
index 9260f4e..6de231e 100644
--- a/tests/test.js
+++ b/tests/test.js
@@ -8,7 +8,7 @@
(function(document, window) {
var scrStart = '';
document.write(scrStart + '../external/jquery-1.6.2.js' + scrEnd);
- var html2canvas = ['Core', 'Generate', 'Parse', 'Preload', 'Queue', 'Renderer', 'plugins/jquery.plugin.html2canvas'], i;
+ var html2canvas = ['Core', 'Generate', 'Parse', 'Preload', 'Queue', 'Renderer', 'Util', 'plugins/jquery.plugin.html2canvas'], i;
for (i = 0; i < html2canvas.length; ++i) {
document.write(scrStart + '../src/' + html2canvas[i] + '.js' + scrEnd);
}