MediaWiki:Common.js: Difference between revisions

Content added Content deleted
No edit summary
No edit summary
Line 53: Line 53:
var svgs = canvas.getElementsByTagName("svg");
var svgs = canvas.getElementsByTagName("svg");
if (svgs.length == 0 || svgs[0].getAttribute("data-element-id") == null) {
if (svgs.length == 0 || svgs[0].getAttribute("data-element-id") == null) {
console.log("No SVG found");
return false;
return false;
}
}
console.log("SVG found");
var clone = svgs[0].cloneNode(true);
var clone = svgs[0].cloneNode(true);
Line 63: Line 61:
var bbox = clone.getBBox();
var bbox = clone.getBBox();
console.log(bbox);
clone.setAttribute("width", bbox.width + "px");
clone.setAttribute("width", bbox.width + "px");
clone.setAttribute("height", bbox.height + "px");
clone.setAttribute("height", bbox.height + "px");