Skip to content

Commit

Permalink
More NovaCast work
Browse files Browse the repository at this point in the history
  • Loading branch information
novafurry committed May 14, 2024
1 parent 5344397 commit 5c28fb9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 35 deletions.
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@
<script type="module" src="script.js"></script>
<script type="module" src="libraries/foxywm.js"></script>
<div class="cur"></div>
<script src="libraries/ht2canvas.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/toastify-js"></script>
</body>

Expand Down
23 changes: 3 additions & 20 deletions libraries/ht2canvas.js

Large diffs are not rendered by default.

32 changes: 17 additions & 15 deletions libraries/novacast.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import './ht2canvas.js'
window.novacast = {
test: function(){
html2canvas(document.body).then(canvas => {
let canvasUrl = canvas.toDataURL();
console.log(canvasUrl);
let createEl = document.createElement('a');
createEl.href = canvasUrl;

// This is the name of our downloaded file
createEl.download = "download-this-canvas";

// Click the download button, causing a download, and then remove it
createEl.click();
createEl.remove();
});
test: function () {
alert()
domtoimage.toPng(document.body.parentElement)
.then(function (dataUrl) {
let createEl = document.createElement('a');
createEl.href = dataUrl;

// This is the name of our downloaded file
createEl.download = "download-this-canvas";

// Click the download button, causing a download, and then remove it
createEl.click();
createEl.remove();
})
.catch(function (error) {
console.error('oops, something went wrong!', error);
});
}
}

0 comments on commit 5c28fb9

Please sign in to comment.