remove screenshot feature as it is no longer needed

This commit is contained in:
Steffen 2020-12-27 20:11:57 +01:00
parent 3545b3a69d
commit 2741950837
9 changed files with 3 additions and 167 deletions

View File

@ -25,7 +25,7 @@
<meta name="theme-color" content="#ff0000"> <meta name="theme-color" content="#ff0000">
<link href="https://fonts.googleapis.com/css?family=Roboto+Condensed&display=swap" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Roboto+Condensed&display=swap" rel="stylesheet">
<meta name="description" content="A free, virtual Blood on the Clocktower Town Square and Grimoire to help you run (online) games both as a storyteller and player. Batteries included!"> <meta name="description" content="A free, virtual Blood on the Clocktower Town Square and Grimoire to help you run (online) games both as a storyteller and player. Batteries included!">
<meta name="keywords" content="botc, blood, clocktower, storyteller, townsquare, grimoire, screenshot,town square, english, blood on the clocktower, character, tokens, reminder, free"> <meta name="keywords" content="botc, blood, clocktower, storyteller, townsquare, grimoire, voting,town square, english, blood on the clocktower, character, tokens, reminder, free">
<meta name="robots" content="index, follow"> <meta name="robots" content="index, follow">
<meta name="language" content="English"> <meta name="language" content="English">
<meta name="author" content="Steffen Baumgart"> <meta name="author" content="Steffen Baumgart">

View File

@ -3,10 +3,7 @@
id="app" id="app"
@keyup="keyup" @keyup="keyup"
tabindex="-1" tabindex="-1"
:class="{ :class="{ night: grimoire.isNight }"
screenshot: grimoire.isScreenshot,
night: grimoire.isNight
}"
:style="{ :style="{
backgroundImage: grimoire.background backgroundImage: grimoire.background
? `url('${grimoire.background}')` ? `url('${grimoire.background}')`
@ -19,7 +16,7 @@
<TownInfo v-if="players.length && !session.nomination"></TownInfo> <TownInfo v-if="players.length && !session.nomination"></TownInfo>
<Vote v-if="session.nomination"></Vote> <Vote v-if="session.nomination"></Vote>
</transition> </transition>
<TownSquare @screenshot="takeScreenshot"></TownSquare> <TownSquare></TownSquare>
<Menu ref="menu"></Menu> <Menu ref="menu"></Menu>
<EditionModal /> <EditionModal />
<FabledModal /> <FabledModal />
@ -76,9 +73,6 @@ export default {
}; };
}, },
methods: { methods: {
takeScreenshot(dimensions) {
this.$refs.menu.takeScreenshot(dimensions);
},
keyup({ key, ctrlKey, metaKey }) { keyup({ key, ctrlKey, metaKey }) {
if (ctrlKey || metaKey) return; if (ctrlKey || metaKey) return;
switch (key.toLocaleLowerCase()) { switch (key.toLocaleLowerCase()) {
@ -220,15 +214,6 @@ body {
} }
} }
// Firefox doesn't support screenshot mode yet
@-moz-document url-prefix() {
#controls > span.camera,
.player > .menu .screenshot,
.bluffs > svg.fa-camera {
display: none;
}
}
* { * {
box-sizing: border-box; box-sizing: border-box;
position: relative; position: relative;

View File

@ -1,6 +1,5 @@
<template> <template>
<div id="controls"> <div id="controls">
<Screenshot ref="screenshot"></Screenshot>
<span <span
class="session" class="session"
:class="{ :class="{
@ -18,14 +17,6 @@
<font-awesome-icon icon="broadcast-tower" /> <font-awesome-icon icon="broadcast-tower" />
{{ session.playerCount }} {{ session.playerCount }}
</span> </span>
<span class="camera">
<font-awesome-icon
icon="camera"
@click="takeScreenshot()"
title="Take a screenshot"
:class="{ success: grimoire.isScreenshotSuccess }"
/>
</span>
<div class="menu" :class="{ open: grimoire.isMenuOpen }"> <div class="menu" :class="{ open: grimoire.isMenuOpen }">
<font-awesome-icon icon="cog" @click="toggleMenu" /> <font-awesome-icon icon="cog" @click="toggleMenu" />
<ul> <ul>
@ -206,12 +197,8 @@
<script> <script>
import { mapMutations, mapState } from "vuex"; import { mapMutations, mapState } from "vuex";
import Screenshot from "./Screenshot";
export default { export default {
components: {
Screenshot
},
computed: { computed: {
...mapState(["grimoire", "session"]), ...mapState(["grimoire", "session"]),
...mapState("players", ["players"]) ...mapState("players", ["players"])
@ -222,10 +209,6 @@ export default {
}; };
}, },
methods: { methods: {
takeScreenshot(dimensions = {}) {
this.$store.commit("updateScreenshot");
this.$refs.screenshot.capture(dimensions);
},
setBackground() { setBackground() {
const background = prompt("Enter custom background URL"); const background = prompt("Enter custom background URL");
if (background || background === "") { if (background || background === "") {
@ -319,7 +302,6 @@ export default {
"toggleMenu", "toggleMenu",
"toggleNight", "toggleNight",
"toggleNightOrder", "toggleNightOrder",
"updateScreenshot",
"setZoom", "setZoom",
"toggleModal" "toggleModal"
]) ])
@ -349,10 +331,6 @@ export default {
padding-right: 50px; padding-right: 50px;
z-index: 200; z-index: 200;
#app.screenshot & {
display: none;
}
svg { svg {
filter: drop-shadow(0 0 5px rgba(0, 0, 0, 1)); filter: drop-shadow(0 0 5px rgba(0, 0, 0, 1));
&.success { &.success {

View File

@ -124,10 +124,6 @@
<font-awesome-icon icon="exchange-alt" /> <font-awesome-icon icon="exchange-alt" />
Swap seats Swap seats
</li> </li>
<li class="screenshot" @click="takeScreenshot">
<font-awesome-icon icon="camera" />
Screenshot
</li>
<li @click="removePlayer"> <li @click="removePlayer">
<font-awesome-icon icon="times-circle" /> <font-awesome-icon icon="times-circle" />
Remove Remove
@ -234,11 +230,6 @@ export default {
handleEmojis: text => text.replace(/:([^: ]+?):/g, "").replace(/ •/g, "\n•") handleEmojis: text => text.replace(/:([^: ]+?):/g, "").replace(/ •/g, "\n•")
}, },
methods: { methods: {
takeScreenshot() {
const { width, height, x, y } = this.$refs.player.getBoundingClientRect();
this.$emit("screenshot", { width, height, x, y });
this.isMenuOpen = false;
},
toggleStatus() { toggleStatus() {
if (this.grimoire.isPublic) { if (this.grimoire.isPublic) {
if (!this.player.isDead) { if (!this.player.isDead) {

View File

@ -1,83 +0,0 @@
<template>
<div id="screenshot">
<video ref="video" autoplay></video>
<canvas ref="canvas"></canvas>
</div>
</template>
<script>
export default {
data: function() {
return {
stream: null
};
},
methods: {
async capture({ x = 0, y = 0, width = 0, height = 0 }) {
const canvas = this.$refs.canvas;
const video = this.$refs.video;
// start capturing
if (!this.stream || !this.stream.active) {
alert(
"Please select to stream the current browser tab to get the appropriate screenshots"
);
try {
this.stream = await navigator.mediaDevices.getDisplayMedia({
video: {
// frameRate: 5,
cursor: "never"
},
audio: false
});
} catch (err) {
this.$store.commit("updateScreenshot", false);
}
}
// get screenshot
if (this.stream && this.stream.active) {
video.srcObject = this.stream;
video.play();
setTimeout(() => {
const context = canvas.getContext("2d");
canvas.setAttribute("width", width || video.videoWidth);
canvas.setAttribute("height", height || video.videoHeight);
context.drawImage(
video,
x || 0,
y || 0,
width || video.videoWidth,
height || video.videoHeight,
0,
0,
width || video.videoWidth,
height || video.videoHeight
);
canvas.toBlob(blob => {
try {
// eslint-disable-next-line no-undef
const item = new ClipboardItem({ "image/png": blob });
navigator.clipboard.write([item]);
this.$store.commit("updateScreenshot", true);
} catch (err) {
this.$store.commit("updateScreenshot", false);
}
});
}, 100);
}
}
}
};
</script>
<style scoped>
video {
width: 100%;
height: 100%;
display: none;
}
canvas {
width: 100%;
height: 100%;
display: none;
}
</style>

View File

@ -215,10 +215,6 @@ export default {
margin-right: 2px; margin-right: 2px;
right: 100%; right: 100%;
} }
#app.screenshot & {
display: none;
}
} }
&:hover .ability { &:hover .ability {

View File

@ -13,7 +13,6 @@
v-for="(player, index) in players" v-for="(player, index) in players"
:key="index" :key="index"
:player="player" :player="player"
@screenshot="$emit('screenshot', $event)"
@trigger="handleTrigger(index, $event)" @trigger="handleTrigger(index, $event)"
:class="{ :class="{
from: Math.max(swap, move, nominate) === index, from: Math.max(swap, move, nominate) === index,
@ -31,7 +30,6 @@
:class="{ closed: !isBluffsOpen }" :class="{ closed: !isBluffsOpen }"
> >
<h3> <h3>
<font-awesome-icon icon="camera" @click.stop="takeScreenshot" />
<span v-if="session.isSpectator">Other characters</span> <span v-if="session.isSpectator">Other characters</span>
<span v-else>Demon bluffs</span> <span v-else>Demon bluffs</span>
<font-awesome-icon icon="times-circle" @click.stop="toggleBluffs" /> <font-awesome-icon icon="times-circle" @click.stop="toggleBluffs" />
@ -119,10 +117,6 @@ export default {
}; };
}, },
methods: { methods: {
takeScreenshot() {
const { width, height, x, y } = this.$refs.bluffs.getBoundingClientRect();
this.$emit("screenshot", { width, height, x, y });
},
toggleBluffs() { toggleBluffs() {
this.isBluffsOpen = !this.isBluffsOpen; this.isBluffsOpen = !this.isBluffsOpen;
}, },
@ -371,9 +365,6 @@ export default {
&:hover { &:hover {
color: red; color: red;
} }
#app.screenshot & {
display: none;
}
} }
h3 { h3 {
margin: 5px 1vh 0; margin: 5px 1vh 0;
@ -390,9 +381,6 @@ export default {
svg { svg {
cursor: pointer; cursor: pointer;
flex-grow: 0; flex-grow: 0;
&.fa-camera {
margin-right: 1vh;
}
&.fa-times-circle { &.fa-times-circle {
margin-left: 1vh; margin-left: 1vh;
} }
@ -420,9 +408,6 @@ export default {
} }
} }
&.closed { &.closed {
svg.fa-camera {
display: none;
}
svg.fa-times-circle { svg.fa-times-circle {
display: none; display: none;
} }
@ -576,10 +561,6 @@ export default {
opacity: 1; opacity: 1;
} }
#app.screenshot & {
display: none;
}
// adjustment for fabled // adjustment for fabled
.fabled &.first { .fabled &.first {
span { span {

View File

@ -10,7 +10,6 @@ const faIcons = [
"AddressCard", "AddressCard",
"BookOpen", "BookOpen",
"BroadcastTower", "BroadcastTower",
"Camera",
"Chair", "Chair",
"CheckSquare", "CheckSquare",
"CloudMoon", "CloudMoon",

View File

@ -53,8 +53,6 @@ export default new Vuex.Store({
isNightOrder: true, isNightOrder: true,
isPublic: true, isPublic: true,
isMenuOpen: false, isMenuOpen: false,
isScreenshot: false,
isScreenshotSuccess: false,
zoom: 0, zoom: 0,
background: "" background: ""
}, },
@ -144,15 +142,6 @@ export default new Vuex.Store({
modals[modal] = false; modals[modal] = false;
} }
}, },
updateScreenshot({ grimoire }, status) {
if (status !== true && status !== false) {
grimoire.isScreenshotSuccess = false;
grimoire.isScreenshot = true;
} else {
grimoire.isScreenshotSuccess = status;
grimoire.isScreenshot = false;
}
},
/** /**
* Store custom roles * Store custom roles
* @param state * @param state