MediaWiki:Common.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 2: Line 2:


function runUntilSuccess(f) {
function runUntilSuccess(f) {
console.log("Running function");
(function run() {
(function run() {
if (!f()) {
if (!f()) {
console.log("Rerunning function");
setTimeout(run, 10);
setTimeout(run, 10);
}
}
Line 60: Line 62:
console.log("SVG found");
console.log("SVG found");
clone = svgs[0].cloneNode(true);
var clone = svgs[0].cloneNode(true);
canvas.remove();
canvas.remove();
parent.appendChild(clone);
parent.appendChild(clone);
bbox = clone.getBBox();
var bbox = clone.getBBox();
clone.setAttribute("width", `${bbox.width}px`);
clone.setAttribute("width", `${bbox.width}px`);
clone.setAttribute("height", `${bbox.height}px`);
clone.setAttribute("height", `${bbox.height}px`);