Skip to content
Snippets Groups Projects
Commit c344f5d6 authored by Pregmodder's avatar Pregmodder
Browse files

Merge branch 'stuff' into 'pregmod-master'

Various improvements

See merge request pregmodfan/fc-pregmod!8560
parents 7fe93935 22165bdf
No related branches found
No related tags found
1 merge request!8560Various improvements
/** Render a link that toggles the slave's favorite status /** Render a link that toggles the slave's favorite status
* @param {App.Entity.SlaveState} slave * @param {App.Entity.SlaveState} slave
* @returns {HTMLSpanElement} * @returns {HTMLAnchorElement}
*/ */
App.UI.favoriteToggle = function(slave) { App.UI.favoriteToggle = function(slave) {
function favLink() { function favLink() {
......
/* checks V.slaves for consistency */ /**
$(document).on(":passagestart", event => { * checks V.slaves for consistency
* @param {PassageRenderingEvent} event
*/
App.Debug.slavesConsistency = function(event) {
if (event.passage.title !== "AS Dump" // Don't put in the work on passages we leave immediately anyway. if (event.passage.title !== "AS Dump" // Don't put in the work on passages we leave immediately anyway.
&& V.slaves !== undefined) { // no V.slaves at game start && V.slaves !== undefined) { // no V.slaves at game start
if (V.slaves.includes(null)) { if (V.slaves.includes(null)) {
const p = document.createElement("p"); const p = document.createElement("p");
p.append(App.UI.DOM.makeElement("span", "ERROR: Main slaves array contains a null entry! Please report this. ", "error"), p.append(App.UI.DOM.makeElement("span", "ERROR: Main slaves array contains a null entry! Please report this. ", "error"),
...@@ -23,9 +27,9 @@ $(document).on(":passagestart", event => { ...@@ -23,9 +27,9 @@ $(document).on(":passagestart", event => {
})) }))
.filter(s => s.ID === id) .filter(s => s.ID === id)
.map(s => `${s.idx}: ${s.name} (${s.assignment})`) .map(s => `${s.idx}: ${s.name} (${s.assignment})`)
.join(', ') .join(", ")
}`, "error")); }`, "error"));
}); });
} }
} }
}); };
...@@ -2,15 +2,14 @@ ...@@ -2,15 +2,14 @@
Config.saves.onLoad = App.EventHandlers.onLoad; Config.saves.onLoad = App.EventHandlers.onLoad;
Config.saves.onSave = App.EventHandlers.onSave; Config.saves.onSave = App.EventHandlers.onSave;
$(document).on(':storyready', function() { /* ### Every-time listeners #### */
App.EventHandlers.storyReady();
});
$(document).one(':passagestart', function() { $(document).on(":storyready", () => {
App.EventHandlers.optionsChanged(); App.EventHandlers.storyReady();
}); });
$(document).on(':passagestart', function() { $(document).on(":passagestart", event => {
App.Debug.slavesConsistency(event);
Object.defineProperty(State.temporary, "S", { Object.defineProperty(State.temporary, "S", {
get: () => S, get: () => S,
enumerable: true enumerable: true
...@@ -23,3 +22,9 @@ $(document).on(":passageinit", () => { ...@@ -23,3 +22,9 @@ $(document).on(":passageinit", () => {
delete V.passageSwitchHandler; delete V.passageSwitchHandler;
} }
}); });
/* ### One-time listeners ### */
$(document).one(":passagestart", () => {
App.EventHandlers.optionsChanged();
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment