Skip to content

Commit

Permalink
css and HTML setup
Browse files Browse the repository at this point in the history
  • Loading branch information
Norc committed Jul 15, 2020
1 parent c0fc6ba commit 985aaed
Show file tree
Hide file tree
Showing 13 changed files with 111 additions and 148 deletions.
Binary file added GitHub - Shortcut.lnk
Binary file not shown.
5 changes: 3 additions & 2 deletions core-hotbar-flags-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export class CoreHotbarFlagsForm extends FormApplication {
* 'submenu':submenu.toLowerCase(),
* 'key':entry.metadata.package+'.'+entry.metadata.name
*/
//this is currently defined for an onload not a submit...
async _updateObject(e, d) {
console.debug("Custom Hotbar | Attempting to update core user flags with form values...");
await game.user.unsetFlag("custom-hotbar", "corePrimaryColor");
Expand All @@ -79,6 +78,7 @@ export class CoreHotbarFlagsForm extends FormApplication {
await game.user.unsetFlag("custom-hotbar", "coreXPos");
await game.user.unsetFlag("custom-hotbar", "coreYPos");

setTimeout(100);

await game.user.setFlag("custom-hotbar", "corePrimaryColor", d.corePrimaryColor);
await game.user.setFlag("custom-hotbar", "coreBorderColor", d.coreBorderColor);
Expand All @@ -87,7 +87,8 @@ export class CoreHotbarFlagsForm extends FormApplication {

await game.user.setFlag("custom-hotbar","coreXPos", d.coreXPos);
await game.user.setFlag("custom-hotbar","coreYPos", d.coreYPos);
this.render();
this.render();
ui.notifications.notify("Saving... Please refresh Foundry to apply changes.");
}

onReset() {
Expand Down
91 changes: 0 additions & 91 deletions core-hotbar-flags-form_old.js

This file was deleted.

4 changes: 2 additions & 2 deletions core-hotbar-settings-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export class CoreHotbarSettingsForm extends FormApplication {
* 'submenu':submenu.toLowerCase(),
* 'key':entry.metadata.package+'.'+entry.metadata.name
*/
//this is currently defined for an onload not a submit...
async _updateObject(e, d) {
console.debug("Custom Hotbar | Attempting to update settings with form values...");
game.settings.set("custom-hotbar", "corePrimaryColor", d.corePrimaryColor);
Expand All @@ -64,7 +63,8 @@ export class CoreHotbarSettingsForm extends FormApplication {
game.settings.set("custom-hotbar", "coreBorderColorInactive", d.coreBorderColorInactive);
game.settings.set("custom-hotbar", "coreXPos", d.coreXPos);
game.settings.set("custom-hotbar", "coreYPos", d.coreYPos);
this.render();
this.render();
ui.notifications.notify("Saving... Please refresh Foundry to apply changes.");
}

onReset() {
Expand Down
36 changes: 35 additions & 1 deletion css/custom-hotbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,38 @@ pointer-events: all;
font-size: 20px;
line-height: 8px;
}
*/
*/

/* Settings CSS */
div.chbSettings div.formgroup {
margin-top: 0.75em;
margin-bottom: 0.75em;
}

div.chbSettings input[is="colorpicker-input"] {
background-color: white;
max-width:20%;
text-align: center;
margin-left: auto;
margin-right: auto;

border: black 1px;
}
div.chbSettings input[type="Number"] {
background-color: white;
max-width:10%;
text-align: center;
border: black 1px;
float: left;
margin-right:0.5em;
}

div.chbSettings div.colorsplash {
display: grid;
place-items: center;
background-color: blue;
padding-top: 0.4em;
padding-bottom: 0.4em;
border: black 1px;
border-radius: 0.5em;
}
53 changes: 30 additions & 23 deletions custom-hotbar-flags-form.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { CustomHotbarSettings } from './custom-hotbar-settings.js';

export class CustomHotbarFlagsForm extends FormApplication {

constructor(object, options = {}) {
Expand All @@ -20,34 +22,38 @@ export class CustomHotbarFlagsForm extends FormApplication {

getData() {
let data = {
chbPrimaryColor: game.user.getFlag("custom-hotbar", "chbPrimaryColor"),
chbBorderColor: game.user.getFlag("custom-hotbar", "chbBorderColor"),
chbBorderColorActive: game.user.getFlag("custom-hotbar", "chbBorderColorActive"),
chbBorderColorInactive: game.user.getFlag("custom-hotbar", "chbBorderColorInactive"),
chbPrimaryColor: CustomHotbarSettings.getCHBPrimaryColor(),
chbBorderColor: CustomHotbarSettings.getCHBBorderColor(),
chbBorderColorActive: CustomHotbarSettings.getCHBBorderColorActive(),
chbBorderColorInactive: CustomHotbarSettings.getCHBBorderColorInactive(),

chbXPos: game.user.getFlag("custom-hotbar", "chbXPos"),
chbYPos: game.user.getFlag("custom-hotbar", "chbYPos")
chbXPos: CustomHotbarSettings.getCHBXPos(),
chbYPos: CustomHotbarSettings.getCHBYPos(),
};

if (this.reset == true) {
async () => {
await game.user.unsetFlag("custom-hotbar", "chbPrimaryColor");
await game.user.unsetFlag("custom-hotbar", "chbBorderColor");
await game.user.unsetFlag("custom-hotbar", "chbBorderColorActive");
await game.user.unsetFlag("custom-hotbar", "chbBorderColorInactive");

await game.user.unsetFlag("custom-hotbar", "chbXPos");
await game.user.unsetFlag("custom-hotbar", "chbYPos");
};

data = {
chbPrimaryColor: game.settings.settings.get("custom-hotbar.chbPrimaryColor").default,
chbBorderColor: game.settings.settings.get("custom-hotbar.chbBorderColor").default,
chbBorderColorActive: game.settings.settings.get("custom-hotbar.chbBorderColorActive").default,
chbBorderColorInactive: game.settings.settings.get("custom-hotbar.chbBorderColorInactive").default,
chbPrimaryColor: game.settings.settings.get("custom-hotbar","chbPrimaryColor"),
chbBorderColor: game.settings.settings.get("custom-hotbar","chbBorderColor"),
chbBorderColorActive: game.settings.settings.get("custom-hotbar","chbBorderColorActive"),
chbBorderColorInactive: game.settings.settings.get("custom-hotbar","chbBorderColorInactive"),

chbXPos: game.settings.settings.get("custom-hotbar.chbXPos").default,
chbYPos: game.settings.settings.get("custom-hotbar.chbYPos").default
chbXPos: game.settings.settings.get("custom-hotbar","chbXPos"),
chbYPos: game.settings.settings.get("custom-hotbar","chbYPos")
};

game.user.unsetFlag("custom-hotbar", "chbPrimaryColor");
game.user.unsetFlag("custom-hotbar", "chbBorderColor");
game.user.unsetFlag("custom-hotbar", "chbBorderColorActive");
game.user.unsetFlag("custom-hotbar", "chbBorderColorInactive");

game.user.unsetFlag("custom-hotbar", "chbXPos");
game.user.unsetFlag("custom-hotbar", "chbYPos");
this.reset = false;
}

this.render;
return data;
}
Expand All @@ -62,7 +68,6 @@ export class CustomHotbarFlagsForm extends FormApplication {
* 'submenu':submenu.toLowerCase(),
* 'key':entry.metadata.package+'.'+entry.metadata.name
*/
//this is currently defined for an onload not a submit...
async _updateObject(e, d) {
console.debug("Custom Hotbar | Attempting to update custom user flags with form values...");
await game.user.unsetFlag("custom-hotbar", "chbPrimaryColor");
Expand All @@ -73,15 +78,17 @@ export class CustomHotbarFlagsForm extends FormApplication {
await game.user.unsetFlag("custom-hotbar", "chbXPos");
await game.user.unsetFlag("custom-hotbar", "chbYPos");


setTimeout(100);

await game.user.setFlag("custom-hotbar", "chbPrimaryColor", d.chbPrimaryColor);
await game.user.setFlag("custom-hotbar", "chbBorderColor", d.chbBorderColor);
await game.user.setFlag("custom-hotbar", "chbBorderColorActive", d.chbBorderColorActive);
await game.user.setFlag("custom-hotbar", "chbBorderColorInactive", d.chbBorderColorInactive);

await game.user.setFlag("custom-hotbar","chbXPos", d.chbXPos);
await game.user.setFlag("custom-hotbar","chbYPos", d.chbYPos);
this.render();
this.render();
ui.notifications.notify("Saving... Please refresh Foundry to apply changes.");
}

onReset() {
Expand Down
3 changes: 2 additions & 1 deletion custom-hotbar-settings-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export class CustomHotbarSettingsForm extends FormApplication {
game.settings.set("custom-hotbar", "chbBorderColorInactive", d.chbBorderColorInactive);
game.settings.set("custom-hotbar","chbXPos", d.chbXPos);
game.settings.set("custom-hotbar","chbYPos", d.chbYPos);
this.render();
this.render();
ui.notifications.notify("Saving... Please refresh Foundry to apply changes.");
}

onReset() {
Expand Down
4 changes: 2 additions & 2 deletions custom-hotbar-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ export class CustomHotbarSettings {
static register(){
//Global, GM-only settings menus
game.settings.registerMenu("custom-hotbar", 'chbSettingsMenu', {
name: '(𝗚𝗠 𝗢𝗻𝗹𝘆) Set Custom Hotbar Defaults for All Users',
name: '(𝗚𝗠 𝗢𝗻𝗹𝘆) Default Custom Hotbar Settings for All Users',
label: 'Global Custom Hotbar',
icon: 'fas fa-bars',
type: CustomHotbarSettingsForm,
restricted: true
});

game.settings.registerMenu("custom-hotbar", 'coreSettingsMenu', {
name: '(𝗚𝗠 𝗢𝗻𝗹𝘆) Set Foundry Hotbar Defaults for All Users',
name: '(𝗚𝗠 𝗢𝗻𝗹𝘆) Default Core Foundry Hotbar Settings for All Users',
label: 'Global Core Hotbar',
icon: 'fas fa-minus',
type: CoreHotbarSettingsForm,
Expand Down
32 changes: 16 additions & 16 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,54 +15,54 @@

"chbPrimaryColor": {
"name": "Custom Hotbar Color:",
"nameHint": "Background color for the extra hotbar added by this module. Default: #0000FF80"
"nameHint": "Background color for the extra hotbar added by this module."
},
"chbBorderColor": {
"name": "Custom Hotbar Border Color:",
"nameHint": "Border color for the border box around each macro on the Custom Hotbar. Default: #0000FFff"
"nameHint": "Border color of each macro on the Custom Hotbar."
},
"chbBorderColorActive": {
"name": "Custom Hotbar Highlight Color:",
"nameHint": "Color of the border around a filled macro slot on the Custom Hotbar when you hover over it with the mouse. Default: #FFFFFFff"
"nameHint": "Border color of macro when hovered."
},
"chbBorderColorInactive": {
"name": "Custom Hotbar Highlight Color (Empty):",
"nameHint": "Color of the border around an empty macro slot on the Custom Hotbar when you hover over it with the mouse. Default: #808080ff"
"nameHint": "Border color of empty slot when hovered."
},
"chbXPos":{
"name": "Custom Hotbar Horizontal Position:",
"nameHint": "Higher values are further to the right of the screen horizontally. Default: 220"
"name": "Custom Hotbar Horizontal Position",
"nameHint": "Higher values are further to the right of the screen horizontally."
},
"chbYPos":{
"name": "Custom Hotbar Vertical Position:",
"nameHint": "Higher values are further up the screen vertically. Default: 63"
"name": "Custom Hotbar Vertical Position",
"nameHint": "Higher values are further up the screen vertically."
},



"corePrimaryColor": {
"name": "Core Foundry Hotbar Color:",
"nameHint": "Background color for the core Foundry hotbar. Default: #00000080"
"nameHint": "Background color for the core Foundry hotbar."
},
"coreBorderColor": {
"name": "Core Foundry Border Color:",
"nameHint": "Border color for the border box around each macro on the core Foundry hotbar. Default: #000000ff"
"nameHint": "Border color of each macro on the core Foundry hotbar."
},
"coreBorderColorActive": {
"name": "Core Foundry Highlight Color:",
"nameHint": "Color of the border around a filled macro slot on the core Foundry hotbar when you hover over it with the mouse. Default: #ff0000ff"
"nameHint": "Border color of macro when hovered."
},
"coreBorderColorInactive": {
"name": "Core Foundry Hotbar Highlight Color (Empty):",
"nameHint": "Color of the border around an empty macro slot on the core Foundry hotbar when you hover over it with the mouse. Default: #ff6400ff"
"nameHint": "Border color of empty slot when hovered."
},
"coreXPos":{
"name": "Core Foundry Hotbar Horizontal Position:",
"nameHint": "Higher values are further to the right of the screen horizontally. Default: 220"
"name": "Core Foundry Hotbar Horizontal Position",
"nameHint": "Higher values are further to the right of the screen horizontally."
},
"coreYPos":{
"name": "Core Foundry Hotbar Vertical Position:",
"nameHint": "Higher values are further up the screen vertically. Default: 10"
"name": "Core Foundry Hotbar Vertical Position",
"nameHint": "Higher values are further up the screen vertically."
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion templates/coreHotbarFlags.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="core-hotbar-flags-form"">
<div class="chbSettings" id="core-hotbar-flags-form"">
<form autocomplete="off" onsubmit="event.preventDefault()">
<h1 class="module-header">Your Foundry Hotbar Settings</h1>
<p>To discard your customizations and use the standard settings recommended by the GM instead, use the Reset button in the bottom left.</p>
Expand Down
4 changes: 3 additions & 1 deletion templates/coreHotbarSettings.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<div class="chbSettings" id="core-hotbar-settings-form"">
<form autocomplete="off" onsubmit="event.preventDefault()">
<h1 class="module-header">Global Foundry Hotbar Settings</h1>
<p>These settings apply to the built-in Foundry hotbar for all players. However, this will not override customizations a player chooses for themself.</p>
Expand Down Expand Up @@ -41,4 +42,5 @@ <h2>Position Settings</h2>
<i class="fas fa-save"></i> Save
</button>
</div>
</form>
</form>
</div>
2 changes: 1 addition & 1 deletion templates/customHotbarFlags.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="custom-hotbar-flags-form"">
<div class="chbSettings" id="custom-hotbar-flags-form"">
<form autocomplete="off" onsubmit="event.preventDefault()">
<h1 class="module-header">Your Custom Hotbar Settings</h1>
<p>To discard your customizations and use the standard settings recommended by the GM instead, use the Reset button in the bottom left.</p>
Expand Down
Loading

0 comments on commit 985aaed

Please sign in to comment.