Skip to content

Commit

Permalink
update web page defaults for new 'sample' world
Browse files Browse the repository at this point in the history
  • Loading branch information
chizmw committed May 22, 2023
1 parent d69d96b commit f881b43
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
30 changes: 24 additions & 6 deletions www/custom.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ document.addEventListener('DOMContentLoaded', function () {
/* find the .needsEasyPrint class elements */
document.querySelectorAll('.needs-easyprint').forEach((dependant) => {
/* if the selected value is "EasyPrint" */
if (event.target.value == 'easyprint') {
if (
event.target.value == 'easyprint' ||
event.target.value == 'sample'
) {
/* enable the element */
dependant.disabled = false;
} else {
Expand All @@ -27,14 +30,29 @@ document.addEventListener('DOMContentLoaded', function () {
});
});

/* only force the 'regular' option if we don't have a value in localStorage */
/* do something sensible if we haven't got a value in localStorage */
if (!localStorage.getItem('scriptFormat')) {
console.debug('✎ setting scriptFormat to regular');
console.debug('✎ setting scriptFormat to sample');
// set to "regular" by default; it's not what Chisel uses, but it's
// probably the least surprising
match.value = 'regular';
// trigger the change event to disable the other options
match.dispatchEvent(new Event('change'));
match.value = 'sample';

// selector and default value to choose
const defaults = {
'#scriptFormat': 'sample',
'#printFormat': 'doubleSided',
'#playerNightInfo': 'yes',
'#playerCount': 'sample',
};

// loop through the defaults and set them
for (const [selector, value] of Object.entries(defaults)) {
document.querySelector(selector).value = value;
// match the item, store the value in localStorage, and trigger a change event
let itemname = document.querySelector(selector).name;
localStorage.setItem(itemname, value);
document.querySelector(selector).dispatchEvent(new Event('change'));
}
}
});

Expand Down
12 changes: 7 additions & 5 deletions www/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,15 @@
<div>Format:</div>
<select name="scriptFormat" id="scriptFormat">
<option value="regular">Regular</option>
<option value="easyprint" selected>
Hassle-Free Printable
</option>
<option value="sample" selected>Enhanced</option>
<option value="easyprint">Hassle-Free Printable</option>
</select>
<img
src="images/infobutton.png"
alt="info"
height="16"
class="tippy-tip"
data-tippy-content="<strong>Regular</strong> format is the default format and is a single page for each page of information (Player Reference, Night Order, etc).<br/><br/><strong>Hassle-Free Printable</strong> format is intended to be a document that can just be printed and has the correct quantity of pages for players as well as the Storyteller.<br>This option also enables other PDF rendering options such as <em>double-sided printing</em>."
data-tippy-content="<strong>Regular</strong> format is the default format and is a single page for each page of information (Player Reference, Night Order, etc).<br/><br/><strong>Enhanced</strong> format is a short step up from regular, and includes a compact version of the night order. This could be printed double-sided with the player references.<br/><br/><strong>Hassle-Free Printable</strong> format is intended to be a document that can just be printed and has the correct quantity of pages for players as well as the Storyteller.<br><br>Both non-regular options enable other PDF rendering options such as <em>double-sided printing</em>."
/>
</div>

Expand Down Expand Up @@ -214,13 +213,16 @@
<option value="ravenswood_traveler">
Ravenswood Bluff Max (21 copies)
</option>
<option value="sample">
Non-regular format (1 copy)
</option>
</select>
<img
src="images/infobutton.png"
alt="info"
height="16"
class="tippy-tip"
data-tippy-content="There's no benefit in printing more copies than you need. Choose the number of players you expect to have in your game and the generated PDF will have the correct number of pages for you to print.<br/><br/><strong>Teensyville</strong>: these are games and scripts suited for 5 and 6 players. <small><em>(7 copies)</em></small> <br/><strong>Ravenswood Bluff</strong>: there are enough copies to run games at the full non-traveler player count. Alternatively medium sized towns with space for travellers. <small><em>(16 copies)</em></small> <br/><strong>Ravenswood Bluff Max</strong>: enough copies for a full village and the maximum number of travelers. <small><em>(21 copies)</em></small> <br/><br/><strong>… one for the Storyteller</strong>: each quantity is one more than you may initially expect so that the Storyteller has a copy to refer to. <br/><br/><strong>Note:</strong> This option is only available when <em>Hassle-Free Printable</em> format is selected."
data-tippy-content="There's no benefit in printing more copies than you need. Choose the number of players you expect to have in your game and the generated PDF will have the correct number of pages for you to print.<br/><br/><strong>Teensyville</strong>: these are games and scripts suited for 5 and 6 players. <small><em>(7 copies)</em></small> <br/><strong>Ravenswood Bluff</strong>: there are enough copies to run games at the full non-traveler player count. Alternatively medium sized towns with space for travellers. <small><em>(16 copies)</em></small> <br/><strong>Ravenswood Bluff Max</strong>: enough copies for a full village and the maximum number of travelers. <small><em>(21 copies)</em></small><br/><strong>Non-regular format:</strong> this is a slightly weird option for those that want to showcase some of the 'Hassle-Free' options and only produce one copy with the extended options enabled.<br/><br/><strong>… one for the Storyteller</strong>: each quantity is one more than you may initially expect so that the Storyteller has a copy to refer to. <br/><br/><strong>Note:</strong> This option is only available when <em>Hassle-Free Printable</em> format is selected."
/>
</div>
</details>
Expand Down

0 comments on commit f881b43

Please sign in to comment.