MediaWiki:Common.js: Difference between revisions
Content added Content deleted
Piranhaplant (talk | contribs) No edit summary |
Piranhaplant (talk | contribs) No edit summary |
||
Line 44: | Line 44: | ||
} |
} |
||
} |
} |
||
}); |
|||
// Modify BPMN chart embeds to be just the SVG |
|||
runUntilSuccess(function() { |
|||
if (document.getElementsByClassName("bpmn_embed").length > 0) { |
|||
var canvas = document.getElementById("canvas"); |
|||
var parent = canvas.parentElement; |
|||
var svgs = canvas.getElementsByTagName("svg"); |
|||
if (svgs.length == 0) { |
|||
return false; |
|||
} |
|||
clone = svgs[0].cloneNode(true); |
|||
canvas.remove(); |
|||
parent.appendChild(clone); |
|||
bbox = clone.getBBox(); |
|||
clone.setAttribute("width", `${bbox.width}px`); |
|||
clone.setAttribute("height", `${bbox.height}px`); |
|||
clone.setAttribute("viewBox", `${bbox.x} ${bbox.y} ${bbox.width} ${bbox.height}`); |
|||
} |
|||
return true; |
|||
}); |
}); |