Skip to content

Commit

Permalink
Merge branch 'release/v1.5.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
mattd committed Jul 17, 2022
2 parents e061b92 + d0823b2 commit 14085d4
Show file tree
Hide file tree
Showing 7 changed files with 70 additions and 105 deletions.
4 changes: 2 additions & 2 deletions module/module.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"author": "troygoode, Argonius-Angelus, mattd",
"url": "https://github.com/mattd/foundryvtt-progress-clocks",
"manifest": "https://raw.githubusercontent.com/mattd/foundryvtt-progress-clocks/main/module/module.json",
"download": "https://github.com/mattd/foundryvtt-progress-clocks/releases/download/v1.5.2/build.zip",
"version": "1.5.2",
"download": "https://github.com/mattd/foundryvtt-progress-clocks/releases/download/v1.5.3/build.zip",
"version": "1.5.3",
"minimumCoreVersion": "0.7.0",
"compatibleCoreVersion": "10",
"compatibility": {
Expand Down
24 changes: 0 additions & 24 deletions module/scripts/clock.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
const nextIndexInArray = (arr, el) => {
const idx = arr.indexOf(el);
return (idx < 0 || idx >= arr.length) ? 0 : idx + 1;
}

export class Clock {
static sizes = [
2, 3, 4, 5, 6, 8, 10, 12
Expand Down Expand Up @@ -48,14 +43,6 @@ export class Clock {
};
}

cycleSize () {
return new Clock({
size: Clock.sizes[nextIndexInArray(Clock.sizes, this.size)],
progress: this.progress,
theme: this.theme
});
}

increment () {
const old = this;
return new Clock({
Expand All @@ -73,15 +60,4 @@ export class Clock {
theme: old.theme
});
}

isEqual (clock) {
return clock
&& clock.size === this.size
&& clock.progress === this.progress
&& clock.theme === this.theme;
}

toString () {
return `${this.progress}/${this.size}${this.theme}`;
}
}
10 changes: 5 additions & 5 deletions module/scripts/sheet.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class ClockSheet extends ActorSheet {
actor: this.actor
})
);
this.updateClock(oldClock.decrement());
this.updateActorAndTokens(oldClock.decrement());
});

html.find("button[name=plus]").click(async (e) => {
Expand All @@ -97,7 +97,7 @@ export class ClockSheet extends ActorSheet {
actor: this.actor
})
);
this.updateClock(oldClock.increment());
this.updateActorAndTokens(oldClock.increment());
});

html.find("button[name=reset]").click(async (e) => {
Expand All @@ -112,7 +112,7 @@ export class ClockSheet extends ActorSheet {
progress: 0,
size: oldClock.size
});
this.updateClock(newClock);
this.updateActorAndTokens(newClock);
});
}

Expand All @@ -130,10 +130,10 @@ export class ClockSheet extends ActorSheet {
size: form.size,
theme: form.theme
});
await this.updateClock(newClock);
await this.updateActorAndTokens(newClock);
}

async updateClock(clock) {
async updateActorAndTokens(clock) {
const actor = this.actor;
const tokens = actor.getActiveTokens();
const foundryVersion = getFoundryVersion(game);
Expand Down
15 changes: 0 additions & 15 deletions module/templates/buttons.html

This file was deleted.

116 changes: 60 additions & 56 deletions module/templates/sheet.html
Original file line number Diff line number Diff line change
@@ -1,63 +1,67 @@
<form class="{{cssClass}} clock-form" autocomplete="off">
{{#if editable}}
<div class="clock-name editable">
<input name="name" value="{{actor.name}}" />
</div>
{{else}}
<div class="clock-name">
<input name="name" value="{{actor.name}}" readonly />
</div>
{{/if}}
{{#if editable}}
<div class="clock-progress">
{{#if (lte clock.progress 0)}}
<button name="minus" disabled>
<i class="fa fa-minus"></i>
</button>
{{#if editable}}
<div class="clock-name editable">
<input name="name" value="{{actor.name}}" />
</div>
{{else}}
<button name="minus">
<i class="fa fa-minus"></i>
</button>
<div class="clock-name">
<input name="name" value="{{actor.name}}" readonly />
</div>
{{/if}}
<button name="reset">
<i class="fa fa-redo"></i>
</button>
{{#if (gte clock.progress clock.size)}}
<button name="plus" disabled>
<i class="fa fa-plus"></i>
</button>
{{else}}
<button name="plus">
<i class="fa fa-plus"></i>
</button>
{{#if editable}}
<div class="clock-progress">
{{#if (lte clock.progress 0)}}
<button name="minus" disabled>
<i class="fa fa-minus"></i>
</button>
{{else}}
<button name="minus">
<i class="fa fa-minus"></i>
</button>
{{/if}}
<button name="reset">
<i class="fa fa-redo"></i>
</button>
{{#if (gte clock.progress clock.size)}}
<button name="plus" disabled>
<i class="fa fa-plus"></i>
</button>
{{else}}
<button name="plus">
<i class="fa fa-plus"></i>
</button>
{{/if}}
</div>
{{/if}}
</div>
{{/if}}
<div class="clock-image">
<img src="{{clock.image.url}}" width="{{clock.image.width}}" height="{{clock.image.height}}" />
</div>
{{#if editable}}
<div class="clock-config">
<div class="clock-config-group theme">
<label for="theme"><i class="fa fa-palette"></i></label>
<select name="theme">
{{#select clock.theme}}
{{#each clock.settings.themes as |theme|}}
<option value="{{theme}}">{{theme}}</option>
{{/each}}
{{/select}}
</select>
<div class="clock-image">
<img
src="{{clock.image.url}}"
width="{{clock.image.width}}"
height="{{clock.image.height}}"
/>
</div>
<div class="clock-config-group">
<label for="size"><i class="fa fa-chart-pie"></i></label>
<select name="size">
{{#select clock.size}}
{{#each clock.settings.sizes as |size|}}
<option value="{{size}}">{{size}}</option>
{{/each}}
{{/select}}
</select>
{{#if editable}}
<div class="clock-config">
<div class="clock-config-group theme">
<label for="theme"><i class="fa fa-palette"></i></label>
{{#select clock.theme}}
<select name="theme">
{{#each clock.settings.themes as |theme|}}
<option value="{{theme}}">{{theme}}</option>
{{/each}}
</select>
{{/select}}
</div>
<div class="clock-config-group">
<label for="size"><i class="fa fa-chart-pie"></i></label>
{{#select clock.size}}
<select name="size">
{{#each clock.settings.sizes as |size|}}
<option value="{{size}}">{{size}}</option>
{{/each}}
</select>
{{/select}}
</div>
</div>
</div>
{{/if}}
{{/if}}
</form>
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "foundryvtt-progress-clocks",
"version": "1.5.2",
"version": "1.5.3",
"description": "Brings Forged in the Dark style progress clocks to your FoundryVTT games.",
"main": "module/scripts/init.mjs",
"scripts": {
Expand Down

0 comments on commit 14085d4

Please sign in to comment.