Silver calculator

This commit is contained in:
Codrin Pavel
2020-05-17 18:31:41 +03:00
parent 4f509aeaf6
commit f3a57b6e8b
8 changed files with 141 additions and 2 deletions

37
_assets/js/calculator.js Normal file
View File

@@ -0,0 +1,37 @@
var calculator = new Vue({
el : '#calculator',
data : {
//guilds: new Array(10)
guilds: [
'',
'Pyro',
'Knights',
'Confectioners',
'Family',
'Sofa',
'Twisted',
'Trium',
'Atomic',
'Black',
'Vagabunden',
]
},
computed: {
// Helps render enemy teams in order by power level
orderedEnemies: function () {
return orderByPower(this.map.enemySlots);
},
// Helps render allied teams in order by power level
orderedAllies: function () {
return orderByPower(this.map.ourSlots);
},
// Renders total team powers: hero, titan, total
getAllyPower: function () {
return getTotalPower(this.map.ourSlots);
},
// Renders total enemy team powers: hero, titan, total
getEnemyPower: function () {
return getTotalPower(this.map.enemySlots);
}
}
});

View File

@@ -22,6 +22,7 @@
"modules/war",
"modules/hamburger",
"modules/header",
"modules/calculator",
// Print
"base/print"

View File

@@ -0,0 +1,34 @@
.calculator {
display: block;
table {
margin: 80px auto;
}
thead {
font-weight: 600;
color: #261CD1;
}
td {
border: 0;
padding: 15px 20px;
width: calc(100% / 6);
}
tbody tr {
&:nth-child(odd) td {
background: #FAFAFC;
}
}
input {
border: 0;
font: inherit;
font-weight: 600;
background: none;
outline: 0;
cursor: text;
color: #261CD1;
}
}

View File

@@ -11,6 +11,7 @@
<script src="{{ "/assets/js/app.js" | relative_url }}"></script>
<script src="{{ "/assets/js/localstorage.js" | relative_url }}"></script>
<script src="{{ "/assets/js/hamburger.js" | relative_url }}"></script>
<script src="{{ "/assets/js/calculator.js" | relative_url }}"></script>
{% endif %}
<!-- / _includes/partials/scripts.html -->

View File

@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en" data-baseurl="{{site.baseurl}}">
{% include svg.html %}
{% include head.html %}
<body>
<main class="wrapper">
{% raw %}
<div id="calculator" class="calculator">
<h1>Silver League Calculator</h1>
<table>
<thead>
<tr>
<td></td>
<td>Monday</td>
<td>Tuesday</td>
<td>Wednesday</td>
<td>Thursday</td>
<td>Friday</td>
</tr>
</thead>
<tbody>
<tr v-for="(guild, index) in guilds" v-if="index > 0">
<td>
<input type="text" v-model="guilds[index]" />
</td>
<!-- Odd guilds -->
<template v-if="index % 2">
<td>{{ guilds[(index + 3) % 10 || 10] }}</td>
<td>{{ guilds[(index + 5) % 10 || 10] }}</td>
<td>{{ guilds[(index + 7) % 10 || 10] }}</td>
<td>{{ guilds[(index + 9) % 10 || 10] }}</td>
<td>{{ guilds[(index + 11) % 10 || 10] }}</td>
</template>
<!-- Even guilds -->
<template v-else>
<td>{{ guilds[(index + 10 - 3) % 10] }}</td>
<td>{{ guilds[(index + 10 - 5) % 10] }}</td>
<td>{{ guilds[(index + 10 - 7) % 10] }}</td>
<td>{{ guilds[(index + 10 - 9) % 10] }}</td>
<td>{{ guilds[(index + 10 - 11) % 10] }}</td>
</template>
</tr>
</tbody>
</table>
</div>
{% endraw %}
</main>
{% include footer.html %}
{% include scripts.html %}
</body>
</html>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

6
calculator.md Normal file
View File

@@ -0,0 +1,6 @@
---
layout: war-calculator
title: ''
meta_description: ''
meta_image: ''
---