diff --git a/public/handwritten/script.js b/public/handwritten/script.js index 29a0feb79..2b9c42550 100644 --- a/public/handwritten/script.js +++ b/public/handwritten/script.js @@ -1,4 +1,5 @@ -// ⚠ Warning: This is just a javascript copy of /src/components/HandwrittenText/utils/handwriteText.ts +// ⚠ Warning: This is just a javascript copy of +// /src/components/HandwrittenText/utils/handwriteText.ts function handwriteText(options) { function getElement(elementId) { @@ -593,21 +594,20 @@ function handwriteText(options) { var canvasElement = getElement('canvas'); /* - var styleSelectElement = getElement('select-style'); - var biasSliderElement = getElement('bias-slider'); - var speedSliderElement = getElement('speed-slider'); - var widthSliderElement = getElement('width-slider'); + var styleSelectElement = getElement('select-style'); + var biasSliderElement = getElement('bias-slider'); + var speedSliderElement = getElement('speed-slider'); + var widthSliderElement = getElement('width-slider'); - widthSliderElement.oninput = () => - ((r) => { - for (; canvasElement.lastChild; ) canvasElement.removeChild(canvasElement.lastChild); - if (K(r) != 0) { - const e = options.width; /*parseFloat(widthSliderElement.value)* / - const a = z(r); - for (let l = 0; l < K(a); l++) (r = a[l]), K(r) < 2 || q(r, t, e); - } - })(tr); - */ + widthSliderElement.oninput = () => + ((r) => { + for (; canvasElement.lastChild; ) + canvasElement.removeChild(canvasElement.lastChild); if (K(r) != 0) { const e = + options.width; /*parseFloat(widthSliderElement.value)* / const a = z(r); for + (let l = 0; l < K(a); l++) (r = a[l]), K(r) < 2 || q(r, t, e); + } + })(tr); + */ let ur; let fr; @@ -624,7 +624,8 @@ function handwriteText(options) { }, 200); })(); - // --------------------------------------- Press [Write!] button --------------------------------------- + // --------------------------------------- Press [Write!] button + // --------------------------------------- fetch(ur) .then((res) => { @@ -689,12 +690,13 @@ function handwriteText(options) { handleWriteClick(); /* - getElement('draw-button').addEventListener('mousedown', handleWriteClick); - getElement('text-input').addEventListener('keydown', (event) => { - return event.keyCode === 13 ? handleWriteClick() : 1; - }); - getElement('loading-indicator').remove(); - */ + getElement('draw-button').addEventListener('mousedown', + handleWriteClick); + getElement('text-input').addEventListener('keydown', (event) => { + return event.keyCode === 13 ? handleWriteClick() : 1; + }); + getElement('loading-indicator').remove(); + */ } }; return init(), at; @@ -703,27 +705,29 @@ function handwriteText(options) { }); /* - // --------------------------------------- Saving --------------------------------------- + // --------------------------------------- Saving + --------------------------------------- - getElement('save-button').addEventListener('click', () => { - const r = getElement('canvas').getBBox(); - const width = [hr(r.x - 3), hr(r.y - 3), hr(r.width + 6), hr(r.height + 6)].join(' '); - const svgElement = getElement('canvas'); - svgElement.setAttribute('viewBox', width); - const extremeSvg = new XMLSerializer().serializeToString(svgElement); - svgElement.removeAttribute('viewBox'); - const popOutActionElement = window.document.createElement('a'); - popOutActionElement.setAttribute('href', `data:image/svg+xml;base64,${window.btoa(extremeSvg)}`); - popOutActionElement.setAttribute( - 'download', - `${Z.toString() - .toLowerCase() - .replace(/\s+/g, '-') - .replace(/[^\w\-]+/g, '') - .replace(/\-\-+/g, '-') - .trim()}.svg`, - ); - popOutActionElement.click(); - }); - */ + getElement('save-button').addEventListener('click', () => { + const r = getElement('canvas').getBBox(); + const width = [hr(r.x - 3), hr(r.y - 3), hr(r.width + 6), hr(r.height + + 6)].join(' '); const svgElement = getElement('canvas'); + svgElement.setAttribute('viewBox', width); + const extremeSvg = new XMLSerializer().serializeToString(svgElement); + svgElement.removeAttribute('viewBox'); + const popOutActionElement = window.document.createElement('a'); + popOutActionElement.setAttribute('href', + `data:image/svg+xml;base64,${window.btoa(extremeSvg)}`); + popOutActionElement.setAttribute( + 'download', + `${Z.toString() + .toLowerCase() + .replace(/\s+/g, '-') + .replace(/[^\w\-]+/g, '') + .replace(/\-\-+/g, '-') + .trim()}.svg`, + ); + popOutActionElement.click(); + }); + */ } diff --git a/public/visual-testing/common.js b/public/visual-testing/common.js index 662859261..5fa72ebdf 100644 --- a/public/visual-testing/common.js +++ b/public/visual-testing/common.js @@ -1,10 +1,11 @@ -// TODO: Do not show the Next.js errors in the iframes (they are not relevant in this case) +// TODO: Do not show the Next.js errors in the iframes (they are not relevant in +// this case) window.document.querySelectorAll('iframe').forEach((iframeElement) => { function hideNextjsErrors() { const iframeDocument = iframeElement.contentDocument; iframeDocument.body.innerHTML = iframeDocument.body.innerHTML + - ` + `