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
* @param {App.Entity.SlaveState} slave
* @returns {HTMLSpanElement}
* @returns {HTMLAnchorElement}
*/
App.UI.favoriteToggle = function(slave) {
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.
&& V.slaves !== undefined) { // no V.slaves at game start
if (V.slaves.includes(null)) {
const p = document.createElement("p");
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 => {
}))
.filter(s => s.ID === id)
.map(s => `${s.idx}: ${s.name} (${s.assignment})`)
.join(', ')
.join(", ")
}`, "error"));
});
}
}
});
};
......@@ -2,15 +2,14 @@
Config.saves.onLoad = App.EventHandlers.onLoad;
Config.saves.onSave = App.EventHandlers.onSave;
$(document).on(':storyready', function() {
App.EventHandlers.storyReady();
});
/* ### Every-time listeners #### */
$(document).one(':passagestart', function() {
App.EventHandlers.optionsChanged();
$(document).on(":storyready", () => {
App.EventHandlers.storyReady();
});
$(document).on(':passagestart', function() {
$(document).on(":passagestart", event => {
App.Debug.slavesConsistency(event);
Object.defineProperty(State.temporary, "S", {
get: () => S,
enumerable: true
......@@ -23,3 +22,9 @@ $(document).on(":passageinit", () => {
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