Skip to content
This repository has been archived by the owner on Feb 2, 2019. It is now read-only.

Commit

Permalink
Filtering for multiple players
Browse files Browse the repository at this point in the history
  • Loading branch information
robflop committed Oct 27, 2017
1 parent ad7a3d3 commit c9e62f6
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 46 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ToL-Mod-Utility",
"version": "1.3.1",
"version": "1.4.0",
"productName": "ToL-Mod-Utility",
"description": "Moderation utility for Throne of Lies player reports.",
"main": "./src/client",
Expand Down
12 changes: 8 additions & 4 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,21 @@ body {
}

form {
margin-top: 5vh;
margin-top: 4vh;
}

form > input, form > label, form > select {
form select, form input, form label {
margin: 10px auto;
display: block;
max-width: 95%;
}

ol > li {
margin-top: 10px;
#player-filter input, #player-filter label, input[id^="view-"], label[for^="view-"] {
display: inline;
}

ol > li, #player-filter {
margin: 10px auto;
}

#app {
Expand Down
100 changes: 62 additions & 38 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,51 +24,74 @@
<div style="color:red; margin-top:35px;"><span v-if="!chatLogsInput || !matchInfoInput">Enter Match info and Chat logs!</span></div>
</form>
</div>

<div id="config-wrapper">
<form id="config" method="post">
<label for="type-select">Type filter: </label>
<select id="type-select" v-model="selectedType" @change="filter" :disabled="!isLoaded">
<option selected>All</option>
<option>Day</option>
<option>Alive</option>
<option>System</option>
<option>Mind Link</option>
<option>Attack</option>
<option>Crier</option>
<option>Dead</option>
<option>Heal</option>
<option>Win</option>
<option>Announcement</option>
<option>PrivateAnnouncement</option>
<option>Whisper</option>
<option>Trollbox</option>
</select>

<label for="player-select">Player filter: </label>
<select id="player-select" v-model="selectedPlayer" @change="filter" :disabled="!isLoaded">
<option selected>All</option>
<option v-for="player in parsedMatchInfo">
{{ player.IGN }} [{{ parsedMatchInfo.findIndex(p => p.IGN === player.IGN) + 1 }}]
</option>
</select>

<label for="day-select">Day filter: </label>
<select id="day-select" v-model="selectedDay" @change="filter" :disabled="!isLoaded">
<option selected>All</option>
<option v-for="day in days">Day {{ day }}</option>
</select>
<div>
<input type="radio" id="view-general" value="generalConfig" name="viewSelect" v-model="view" :disabled="!isLoaded">
<label for="view-general">General Options</label>
</div>
<div>
<input type="radio" id="view-players" value="playerFilter" name="viewSelect" v-model="view" :disabled="!isLoaded">
<label for="view-players">Player filter</label>
</div>

<label for="night-select">Night filter: </label>
<select id="night-select" v-model="selectedNight" @change="filter" :disabled="!isLoaded">
<option selected>All</option>
<option v-for="night in nights">Night {{ night }}</option>
</select>
<div id="general-config" v-show="view === 'generalConfig'">
<label for="type-select">Type filter: </label>
<select id="type-select" v-model="selectedType" @change="filter" :disabled="!isLoaded">
<option selected>All</option>
<option>Day</option>
<option>Alive</option>
<option>System</option>
<option>Mind Link</option>
<option>Attack</option>
<option>Crier</option>
<option>Dead</option>
<option>Heal</option>
<option>Win</option>
<option>Announcement</option>
<option>PrivateAnnouncement</option>
<option>Whisper</option>
<option>Trollbox</option>
</select>

<label for="day-select">Day filter: </label>
<select id="day-select" v-model="selectedDay" @change="filter" :disabled="!isLoaded">
<option selected>All</option>
<option v-for="day in days">Day {{ day }}</option>
</select>

<label for="night-select">Night filter: </label>
<select id="night-select" v-model="selectedNight" @change="filter" :disabled="!isLoaded">
<option selected>All</option>
<option v-for="night in nights">Night {{ night }}</option>
</select>

<label for="seperators-toggle">Line seperators: </label>
<input id="seperators-toggle" type="checkbox" v-model.trim="seperatorsToggle" :disabled="!isLoaded">
</div>

<label for="seperators-toggle">Line seperators: </label>
<input id="seperators-toggle" type="checkbox" v-model.trim="seperatorsToggle" :disabled="!isLoaded">
<div id="player-filter" v-show="view === 'playerFilter'">
<form method="post">
<div v-for="player in parsedMatchInfo">
<input
type="checkbox"
:id="`${player.IGN}-selector`"
:value="`${player.IGN} [${parsedMatchInfo.findIndex(p => p.IGN === player.IGN) + 1}]`"
v-model="selectedPlayers"
@click="filter"
:disabled="!isLoaded"
>
<label :for="`${player.IGN}-selector`">
{{ player.IGN }} [{{ parsedMatchInfo.findIndex(p => p.IGN === player.IGN) + 1 }}]
</label>
</div>
</form>
</div>
</form>
</div>
</div>

<div id="display-wrapper">
<div id="match-info-wrapper">
<ol>
Expand All @@ -83,6 +106,7 @@
</li>
</ol>
</div>

<div id="chat-log-wrapper">
<p v-for="log in parsedChatLogs" :class="[checkType(log), seperatorCheck(log)]"> {{ log }}</p>
</div>
Expand Down
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ const app = new Vue({
savedChatLogs: '',
parsedMatchInfo: '',
parsedChatLogs: '',
view: 'generalConfig',
selectedType: 'All',
selectedPlayer: 'All',
selectedDay: 'All',
selectedNight: 'All',
seperatorsToggle: false,
selectedPlayers: [],
days: 0,
nights: 0
},
Expand Down Expand Up @@ -104,9 +105,9 @@ const app = new Vue({
}
}

if (this.selectedPlayer !== 'All') {
if (this.selectedPlayers.length) {
chatLogs = chatLogs.filter(line => {
return line.includes(this.selectedPlayer) || line.startsWith('(Day)') || line.startsWith('(Win)');
return this.selectedPlayers.some(player => line.includes(player) || line.startsWith('(Day)') || line.startsWith('(Win)'));
});
}

Expand Down

0 comments on commit c9e62f6

Please sign in to comment.