Skip to content

Instantly share code, notes, and snippets.

@swichers
Last active August 17, 2019 01:52
Show Gist options
  • Save swichers/4353eace03f53ed7811d18741fb62eae to your computer and use it in GitHub Desktop.
Save swichers/4353eace03f53ed7811d18741fb62eae to your computer and use it in GitHub Desktop.
A simple, filterable list of provisions for DND
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Provision List</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
<script defer src="https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
</head>
<body>
<section class="section">
<div class="container">
<article class="message">
<div class="message-body">Provides a sortable and filterable list of provisions for use in Dungeons & Dragons campaigns.</div>
</article>
</div>
</section>
<div id="app">
<section class="section">
<form class="container">
<div class="field">
<label class="label">Filter by name</label>
<div class="control">
<input class="input" type="text" placeholder="Name" v-model="search" />
</div>
</div>
<div class="tags has-addons">
<span class="tag is-dark">{{ sortedItems.length }}</span>
<span class="tag is-light">Items</span>
</div>
</form>
</section>
<section class="section">
<div class="container">
<table class="table is-striped is-hoverable is-fullwidth">
<thead>
<tr>
<th nowrap @click="sort('name')">Name <span class="fa fa-sort"></span></th>
<th nowrap @click="sort('min')">Price <span class="fa fa-sort"></span></th>
<th>Tags</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr v-for="item in sortedItems">
<td nowrap>{{ item.name }}</td>
<td nowrap>
{{ item.min | currency }}
<span v-if="item.max > 0">&mdash; {{ item.max | currency }}</span>
</td>
<td>
<span class="tags" v-for="tag in item.tags">
<span class="tag is-rounded is-medium is-info">{{ tag }}</span>
</span>
</td>
<td>{{ item.description }}</td>
</tr>
</tbody>
</table>
</div>
</section>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
Vue.filter('currency', function (value) {
var output = '';
var currencies = [
{
'abbrev': 'pp',
'rate': 1000,
},
{
'abbrev': 'gp',
'rate': 100,
},
// {
// 'abbrev': 'ep',
// 'rate': 50,
// },
{
'abbrev': 'sp',
'rate': 10,
},
{
'abbrev': 'cp',
'rate': 1,
},
];
var copper = parseInt(value);
currencies.forEach(function (currency) {
var coins = Math.floor(copper / currency.rate);
if (0 < coins && Number.isInteger(coins)) {
copper -= coins * currency.rate;
output += coins + currency.abbrev + ' ';
}
});
return output.trim();
});
var app = new Vue({
el: '#app',
data: {
search: '',
currentSort: 'name',
currentSortDir: 'asc',
items: []
},
computed: {
filteredItems: function() {
return this.items.filter(item => {
return item.name.toLowerCase().indexOf(this.search.toLowerCase()) > -1
})
},
sortedItems: function() {
return this.filteredItems.sort((a,b) => {
let modifier = 1;
if(this.currentSortDir === 'desc') modifier = -1;
if(a[this.currentSort] < b[this.currentSort]) return -1 * modifier;
if(a[this.currentSort] > b[this.currentSort]) return 1 * modifier;
return 0;
});
}
},
methods: {
sort: function(s) {
if (s === this.currentSort) {
this.currentSortDir = this.currentSortDir === 'asc' ? 'desc': 'asc';
}
this.currentSort = s;
}
},
beforeCreate: function () {
fetch('provisions.json')
.then(r => r.json())
.then(json => {
this.items = json.items;
});
}
});
</script>
</body>
</html>
{
"items": [
{
"name": "Ale, 10-gallon barrel",
"min": 500,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage brewed especially by rapid fermentation from an infusion of malt with the addition of hops."
},
{
"name": "Ale, jug ",
"min": 200,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage brewed especially by rapid fermentation from an infusion of malt with the addition of hops."
},
{
"name": "Ale, pint ",
"min": 10,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage brewed especially by rapid fermentation from an infusion of malt with the addition of hops."
},
{
"name": "Beans, 1-lb.",
"min": 10,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An immature bean pod used as a vegetable."
},
{
"name": "Beef, fresh, 1-lb.",
"min": 100,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The flesh of an adult domestic bovine-such as a steer or cow used as food."
},
{
"name": "Beef, salted, 1-lb.",
"min": 70,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The flesh of an adult domestic bovine-such as a steer or cow used as food."
},
{
"name": "Beer, heavy 10-gallon barrel",
"min": 700,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage usually made from malted cereal grain (as barley), flavored with hops, and brewed by slow fermentation"
},
{
"name": "Beer, heavy jug",
"min": 400,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage usually made from malted cereal grain (as barley), flavored with hops, and brewed by slow fermentation"
},
{
"name": "Beer, heavy pint",
"min": 5,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage usually made from malted cereal grain (as barley), flavored with hops, and brewed by slow fermentation"
},
{
"name": "Beer, watery 10-gallon barrel ",
"min": 500,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage usually made from malted cereal grain (as barley), flavored with hops, and brewed by slow fermentation, then watered to a thin consistancy to make it go further."
},
{
"name": "Beer, watery jug ",
"min": 100,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage usually made from malted cereal grain (as barley), flavored with hops, and brewed by slow fermentation, then watered to a thin consistancy to make it go further."
},
{
"name": "Beer, watery pint ",
"min": 3,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage usually made from malted cereal grain (as barley), flavored with hops, and brewed by slow fermentation, then watered to a thin consistancy to make it go further."
},
{
"name": "Brandy Elvin, tumbler",
"min": 500,
"max": 0,
"season": "Year Round",
"tags": ["Rare"],
"description": "An alcoholic beverage distilled from wine or fermented fruit juice, sweetened with honey or mint."
},
{
"name": "Brandy, 10-gallon barrel",
"min": 5000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage distilled from wine or fermented fruit juice."
},
{
"name": "Brandy, bottle",
"min": 500,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage distilled from wine or fermented fruit juice."
},
{
"name": "Brandy, Elvin, bottle",
"min": 5000,
"max": 0,
"season": "Year Round",
"tags": ["Rare"],
"description": "An alcoholic beverage distilled from wine or fermented fruit juice, sweetened with honey or mint."
},
{
"name": "Brandy, good, 10-gallon barrel",
"min": 10000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage distilled from wine or fermented fruit juice."
},
{
"name": "Brandy, good, bottle",
"min": 1000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage distilled from wine or fermented fruit juice."
},
{
"name": "Brandy, tumbler",
"min": 10,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage distilled from wine or fermented fruit juice."
},
{
"name": "Bread, flat, single piece",
"min": 2,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A usually baked and leavened food made of a mixture whose basic constituent is flour or meal, rolled flat, sometimes with a pocket."
},
{
"name": "Bread, journey, single piece",
"min": 5,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A usually baked and leavened food made of a mixture whose basic constituent is flour or meal, cut into squares and twice baked for conservative purposes. Each piece is good for one day of food, but it gets old really quick."
},
{
"name": "Bread, journey, square",
"min": 300,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A usually baked and leavened food made of a mixture whose basic constituent is flour or meal, cut into squares and twice baked for conservative purposes. Each piece is good for one day of food, but it gets old really quick."
},
{
"name": "Bread, wheat, loaf",
"min": 80,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A usually baked and leavened food made of a mixture whose basic constituent is flour or meal."
},
{
"name": "Bread, wheat, single piece",
"min": 5,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A usually baked and leavened food made of a mixture whose basic constituent is flour or meal."
},
{
"name": "Bread, white, loaf",
"min": 200,
"max": 0,
"season": "Year Round",
"tags": ["Uncommon"],
"description": "A usually baked and leavened food made of a mixture whose basic constituent is flour or meal."
},
{
"name": "Bread, white, single piece",
"min": 10,
"max": 0,
"season": "Year Round",
"tags": ["Uncommon"],
"description": "A usually baked and leavened food made of a mixture whose basic constituent is flour or meal."
},
{
"name": "Butter, 1-lb. tub",
"min": 20,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A solid emulsion of fat globules, air, and water made by churning milk or cream and used as food. Tasty sounding, no?"
},
{
"name": "Cheese, cylindrical cake",
"min": 500,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A food consisting of the coagulated, compressed, and usually ripened curd of milk separated from the whey, an often cylindrical cake."
},
{
"name": "Cheese, slice",
"min": 5,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A food consisting of the coagulated, compressed, and usually ripened curd of milk separated from the whey."
},
{
"name": "Chicken, fresh, 1-lb.",
"min": 40,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The common domestic fowl, especially when young, also its flesh used as food."
},
{
"name": "Chicken, salted, 1-lb.",
"min": 10,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The common domestic fowl, especially when young, also its flesh used as food."
},
{
"name": "Coarse Sugar, 1-lb. bag",
"min": 100,
"max": 0,
"season": "Year Round",
"tags": ["Uncommon"],
"description": "A sweet crystallizable material that consists wholly or essentially of sucrose, is colorless or white when pure tending to brown when less refined."
},
{
"name": "Common Herbs, various, 1-lb. bag",
"min": 5,
"max": 0,
"season": "Seasonal",
"tags": [],
"description": "A plant or plant part valued for its medicinal, savory, or aromatic qualities."
},
{
"name": "Dry, Trail Rations, 1 day",
"min": 50,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A food allowance for one day consisting of dried fruit, raisins, and nuts, cheese, and jerky wrapped in an oiled cloth."
},
{
"name": "Egg, chicken",
"min": 3,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The hard-shelled reproductive body produced by a bird and especially by the common domestic chicken, also, its contents used as food."
},
{
"name": "Egg, goose",
"min": 5,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The hard-shelled reproductive body produced by a bird and especially by the common domestic chicken, also, its contents used as food. The goose egg is slightly larger than a chicken egg."
},
{
"name": "Egg, goose, 100",
"min": 400,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The hard-shelled reproductive body produced by a bird and especially by the common domestic chicken, also, its contents used as food. The goose egg is slightly larger than a chicken egg."
},
{
"name": "Egg, goose, 2 dozen",
"min": 50,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The hard-shelled reproductive body produced by a bird and especially by the common domestic chicken, also, its contents used as food. The goose egg is slightly larger than a chicken egg."
},
{
"name": "Eggs, chicken, 100",
"min": 100,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The hard-shelled reproductive body produced by a bird and especially by the common domestic chicken, also, its contents used as food."
},
{
"name": "Eggs, chicken, 2 dozen",
"min": 20,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The hard-shelled reproductive body produced by a bird and especially by the common domestic chicken, also, its contents used as food."
},
{
"name": "Feywine, bottle",
"min": 15000,
"max": 0,
"season": "Year Round",
"tags": ["Rare"],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage, and sweetened with honey or mint."
},
{
"name": "Feywine, goblet",
"min": 1000,
"max": 0,
"season": "Year Round",
"tags": ["Rare"],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage, and sweetened with honey or mint."
},
{
"name": "Figs, 1-lb.",
"min": 30,
"max": 0,
"season": "Seasonal",
"tags": [],
"description": "An oblong or pear-shaped fruit that is a syconium."
},
{
"name": "Fish, fresh, single",
"min": 200,
"max": 0,
"season": "Year Round",
"tags": ["Waterfront"],
"description": "The flesh of various salt water and fresh water fish used as food."
},
{
"name": "Fish, fresh, single",
"min": 1000,
"max": 0,
"season": "Year Round",
"tags": ["Landlocked"],
"description": "The flesh of various salt water and fresh water fish used as food."
},
{
"name": "Fish, salted, single",
"min": 100,
"max": 500,
"season": "Year Round",
"tags": [],
"description": "Assorted fish preserved with salt or in brine."
},
{
"name": "Fish, smoked, single",
"min": 300,
"max": 800,
"season": "Year Round",
"tags": [],
"description": "Assorted fish cured by exposure to smoke."
},
{
"name": "Flour, 10-lbs. sack",
"min": 50,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Finely ground meal of wheat usually largely freed from bran, also, a similar meal of another material-such as a cereal grain, an edible seed, or dried processed fish."
},
{
"name": "Fresh Vegetable, single serving",
"min": 5,
"max": 0,
"season": "Seasonal",
"tags": [],
"description": "The vegetable being served depends on both the area and the time of year. Most fresh vegetables are available in the summer to fall period, some in the spring, but you will rarely find anything fresh in the winter months."
},
{
"name": "Fruit, bushel",
"min": 60,
"max": 500,
"season": "Seasonal",
"tags": [],
"description": "The usually edible reproductive body of a seed plant, especially one having a sweet pulp associated with the seed."
},
{
"name": "Game Meat, 20-lbs.",
"min": 1200,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Animal tissue considered especially as food."
},
{
"name": "Grain, 5-lbs. sack",
"min": 500,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The seeds or fruits of various food plants including the cereal grasses and in commercial and statutory usage other plants-such as the soybean."
},
{
"name": "Grog, 10-gallon barrel",
"min": 1500,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Alcoholic liquor; especially : liquor-such as rum-cut with water and now often served hot with lemon juice and sugar sometimes added."
},
{
"name": "Grog, jug",
"min": 100,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Alcoholic liquor; especially : liquor-such as rum-cut with water and now often served hot with lemon juice and sugar sometimes added."
},
{
"name": "Grog, pint",
"min": 3,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Alcoholic liquor; especially : liquor-such as rum-cut with water and now often served hot with lemon juice and sugar sometimes added."
},
{
"name": "Honey, single jar",
"min": 50,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A sweet viscid material elaborated out of the nectar of flowers in the honey sac of various bees, or a sweet fluid resembling honey that is collected or elaborated by various insects."
},
{
"name": "Pickled Fish, barrel",
"min": 300,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Assorted fish preserved in or cured with pickle, a brine or vinegar solution in which foods are preserved."
},
{
"name": "Pickled Fish, single",
"min": 20,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Assorted fish preserved in or cured with pickle, a brine or vinegar solution in which foods are preserved."
},
{
"name": "Pork, fresh, 1-lb.",
"min": 80,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The fresh or salted flesh of swine when dressed for food."
},
{
"name": "Pork, salted, 1-lb.",
"min": 40,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The fresh or salted flesh of swine when dressed for food."
},
{
"name": "Rare Herbs, various, 1-lb. bag",
"min": 100,
"max": 0,
"season": "Seasonal",
"tags": [],
"description": "A plant or plant part valued for its medicinal, savory, or aromatic qualities."
},
{
"name": "Rum, 10-gallon barrel",
"min": 5000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage distilled from a fermented cane product such as molasses."
},
{
"name": "Rum, jug",
"min": 800,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage distilled from a fermented cane product such as molasses."
},
{
"name": "Rum, pint",
"min": 30,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "An alcoholic beverage distilled from a fermented cane product such as molasses."
},
{
"name": "Sausage, 1-lb.",
"min": 100,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A highly seasoned minced meat-such as pork, usually stuffed in casings of prepared animal intestine"
},
{
"name": "Scotch, 10-gallon barrel",
"min": 20000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Whiskey distilled from malted barley."
},
{
"name": "Scotch, bottle",
"min": 4000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Whiskey distilled from malted barley."
},
{
"name": "Scotch, glass",
"min": 300,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "Whiskey distilled from malted barley."
},
{
"name": "Spice, exotic, 1-lb. bag",
"min": 500,
"max": 0,
"season": "Seasonal",
"tags": [],
"description": "Any of various aromatic vegetable products used to season or flavor foods, particularly saffron, clove, etc."
},
{
"name": "Spice, rare, 1-lb. bag",
"min": 200,
"max": 0,
"season": "Seasonal",
"tags": [],
"description": "Any of various aromatic vegetable products used to season or flavor foods, particularly pepper, ginger, etc."
},
{
"name": "Spice, uncommon, 1-lb. bag",
"min": 50,
"max": 0,
"season": "Seasonal",
"tags": [],
"description": "Any of various aromatic vegetable products used to season or flavor foods, particularly cinnamon, etc."
},
{
"name": "Uncommon Herbs, various, 1-lb. bag",
"min": 500,
"max": 0,
"season": "Seasonal",
"tags": [],
"description": "A plant or plant part valued for its medicinal, savory, or aromatic qualities."
},
{
"name": "Whiskey, 10-gallon barrel",
"min": 5000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A liquor distilled from the fermented mash of grain-such as rye, corn, or barley."
},
{
"name": "Whiskey, bottle",
"min": 500,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A liquor distilled from the fermented mash of grain-such as rye, corn, or barley."
},
{
"name": "Whiskey, tumbler",
"min": 50,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "A liquor distilled from the fermented mash of grain-such as rye, corn, or barley."
},
{
"name": "Wine, common, 10-gallon barrel",
"min": 25000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage."
},
{
"name": "Wine, common, bottle",
"min": 6000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage."
},
{
"name": "Wine, common, goblet",
"min": 600,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage."
},
{
"name": "Wine, good, bottle",
"min": 10000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage then aged to perfection."
},
{
"name": "Wine, good, goblet",
"min": 800,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage then aged to perfection."
},
{
"name": "Wine, watered, 10-gallon barrel",
"min": 15000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage, then water is added to thin it out and make it last longer."
},
{
"name": "Wine, watered, bottle",
"min": 4000,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage, then water is added to thin it out and make it last longer."
},
{
"name": "Wine, watered, goblet",
"min": 400,
"max": 0,
"season": "Year Round",
"tags": [],
"description": "The usually fermented juice of a plant product-such as a fruit-used as a beverage, then water is added to thin it out and make it last longer."
}
]
}
@swichers
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment