Skip to content
This repository has been archived by the owner on Aug 19, 2021. It is now read-only.

Commit

Permalink
Add room code to player statuses dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
kcgidw committed Apr 20, 2020
1 parent aa77d0e commit 44d269d
Show file tree
Hide file tree
Showing 6 changed files with 252 additions and 162 deletions.
43 changes: 26 additions & 17 deletions src/public/js/game-menu.vue
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
<template>
<div id="game-menu" class="dropup">
<button id="game-menu-btn" class="flex-center" :class="{expanded: expanded === true}" @click="toggle">
<div id="game-menu" class="dropup">
<button
id="game-menu-btn"
class="flex-center"
:class="{ expanded: expanded === true }"
@click="toggle"
>
<svg class="feather">
<use xlink:href="feather-sprite.svg#more-horizontal"/>
<use xlink:href="feather-sprite.svg#more-horizontal" />
</svg>
</button>
<div id="game-menu-dropdown" class="dropup-content" v-show="expanded === true">
<ul class="dropup-list">
<div id="game-menu-dropdown" class="dropup-content" v-show="expanded === true">
<ul class="dropup-list">
<div v-for="item in items" :key="item.text">
<li v-if="!item.hr" @click="doAction(item)">{{item.text}}</li>
<hr v-if="item.hr">
<li v-if="!item.hr" @click="doAction(item)">{{ item.text }}</li>
<hr v-if="item.hr" />
</div>
</ul>
</div>
</div>
</ul>
</div>
</div>
</template>
<script>
import Store from './state';
Expand All @@ -40,29 +45,33 @@ export default {
this.expanded = false;
},
doAction(item) {
if(item.action) {
if (item.action) {
item.action();
this.toggleHide();
}
},
senseClickOutside(event) {
let clickedOutside;
if(event.composedPath) {
clickedOutside = event.composedPath().indexOf(document.getElementById('game-menu')) === -1;
if (event.composedPath) {
clickedOutside =
event.composedPath().indexOf(document.getElementById('game-menu')) === -1;
} else {
// Edge, IE
clickedOutside = Array.from(document.getElementById('game-menu').getElementsByTagName('*')).indexOf(event.target) === -1;
clickedOutside =
Array.from(
document.getElementById('game-menu').getElementsByTagName('*')
).indexOf(event.target) === -1;
}
if(clickedOutside) {
if (clickedOutside) {
this.toggleHide();
}
}
},
},
mounted() {
document.addEventListener('pointerdown', this.senseClickOutside);
},
beforeDestroy() {
document.removeEventListener('pointerdown', this.senseClickOutside);
}
},
};
</script>
Loading

0 comments on commit 44d269d

Please sign in to comment.