mirror of
https://github.com/niklasvh/html2canvas.git
synced 2023-08-10 21:13:10 +03:00
jquery.plugin.html2canvas: add profiling option, tests: enable profiling
in case you run the tests in firefox and have firebug installed and active you now get a profiling run of html2canvas ;)
This commit is contained in:
parent
8bbbace790
commit
bbd75286a8
@ -3,6 +3,9 @@
|
|||||||
*/
|
*/
|
||||||
(function( $ ){
|
(function( $ ){
|
||||||
$.fn.html2canvas = function(options) {
|
$.fn.html2canvas = function(options) {
|
||||||
|
if (options && options.profile && window.console && window.console.profile) {
|
||||||
|
console.profile();
|
||||||
|
}
|
||||||
var date = new Date(),
|
var date = new Date(),
|
||||||
$message = null,
|
$message = null,
|
||||||
timeoutTimer = false,
|
timeoutTimer = false,
|
||||||
@ -14,20 +17,17 @@
|
|||||||
$canvas = $(html2canvas.Renderer(queue, options)),
|
$canvas = $(html2canvas.Renderer(queue, options)),
|
||||||
finishTime = new Date();
|
finishTime = new Date();
|
||||||
|
|
||||||
|
if (options && options.profile && window.console && window.console.profileEnd) {
|
||||||
|
console.profileEnd();
|
||||||
|
}
|
||||||
$canvas.css({ position: 'absolute', left: 0, top: 0 }).appendTo(document.body);
|
$canvas.css({ position: 'absolute', left: 0, top: 0 }).appendTo(document.body);
|
||||||
$canvas.siblings().toggle();
|
$canvas.siblings().toggle();
|
||||||
|
|
||||||
$(window).click(function(){
|
$(window).click(function(){
|
||||||
if (!$canvas.is(':visible')){
|
|
||||||
$canvas.toggle().siblings().toggle();
|
$canvas.toggle().siblings().toggle();
|
||||||
throwMessage("Canvas Render visible");
|
throwMessage("Canvas Render " + ($canvas.is(':visible') ? "visible" : "hidden"));
|
||||||
} else{
|
|
||||||
$canvas.siblings().toggle();
|
|
||||||
$canvas.toggle();
|
|
||||||
throwMessage("Canvas Render hidden");
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
throwMessage('Screenshot created in '+ ((finishTime.getTime()-timer)/1000) + " seconds<br />",4000);
|
throwMessage('Screenshot created in '+ ((finishTime.getTime()-timer)) + " ms<br />",4000);
|
||||||
}
|
}
|
||||||
}, options));
|
}, options));
|
||||||
|
|
||||||
@ -36,6 +36,7 @@
|
|||||||
timeoutTimer = window.setTimeout(function(){
|
timeoutTimer = window.setTimeout(function(){
|
||||||
$message.fadeOut(function(){
|
$message.fadeOut(function(){
|
||||||
$message.remove();
|
$message.remove();
|
||||||
|
$message = null;
|
||||||
});
|
});
|
||||||
},duration || 2000);
|
},duration || 2000);
|
||||||
if ($message)
|
if ($message)
|
||||||
@ -55,8 +56,10 @@
|
|||||||
width:'auto',
|
width:'auto',
|
||||||
height:'auto',
|
height:'auto',
|
||||||
textAlign:'center',
|
textAlign:'center',
|
||||||
textDecoration:'none'
|
textDecoration:'none',
|
||||||
}).hide().fadeIn().appendTo('body');
|
display:'none'
|
||||||
|
}).appendTo(document.body).fadeIn();
|
||||||
|
html2canvas.log(msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
})( jQuery );
|
})( jQuery );
|
||||||
|
@ -18,7 +18,8 @@
|
|||||||
}
|
}
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$(document.body).html2canvas({
|
$(document.body).html2canvas({
|
||||||
logging: true
|
logging: true,
|
||||||
|
profile: true
|
||||||
});
|
});
|
||||||
}, 100);
|
}, 100);
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user