Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor screenshot logic #323

Merged
merged 1 commit into from Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 1 addition & 11 deletions app/static/js/app.js
Expand Up @@ -372,15 +372,6 @@ function setCursor(cursor, save = true) {
}
}

function screenShot() {
var link = document.createElement("a");
link.href = "/snapshot";
link.download = "TinyPilot-" + new Date().getTime() + ".jpg";
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}

document.onload = document.getElementById("app").focus();

document.addEventListener("keydown", onKeyDown);
Expand Down Expand Up @@ -415,8 +406,7 @@ for (const button of document.getElementsByClassName("manual-modifier-btn")) {
button.addEventListener("click", onManualModifierButtonClicked);
}
document.getElementById("screenshot-btn").addEventListener("click", (evt) => {
screenShot();
evt.preventDefault();
evt.target.download = "TinyPilot-" + new Date().toISOString() + ".jpg";
});
document.getElementById("fullscreen-btn").addEventListener("click", (evt) => {
document.getElementById("remote-screen").fullscreen = true;
Expand Down
2 changes: 1 addition & 1 deletion app/templates/components/navbar.html
Expand Up @@ -14,7 +14,7 @@
</ul>
</li>
<li>
<a id="screenshot-btn">Screenshot</a>
<a id="screenshot-btn" href="/snapshot">Screenshot</a>
</li>
<li>
<a id="fullscreen-btn">Full Screen</a>
Expand Down