diff --git a/devTools/javaSanityCheck/ignoredVariables b/devTools/javaSanityCheck/ignoredVariables index d3402c6c1a6b22beeaee3c099b04e67408beac87..0fe9f355ebcc84c073539f219758be91f45fb068 100644 --- a/devTools/javaSanityCheck/ignoredVariables +++ b/devTools/javaSanityCheck/ignoredVariables @@ -54,7 +54,6 @@ saRules plural bimboMaleNames RuleHasError -DefaultRulesError canGrow;canImplant;implantError;growOrgan;removeOrgan totalChildTime toStringExt diff --git a/src/gui/storyCaption.tw b/src/gui/storyCaption.tw index fd44c46a26a3d275699dbcde630fce782aaf7f29..3b76ccb2d5f93bcde51dde4ef0a6017274580c86 100644 --- a/src/gui/storyCaption.tw +++ b/src/gui/storyCaption.tw @@ -2,7 +2,7 @@ <<set _Pass = passage()>> -<<if $ui != "start">><p><<userButton>></p><</if>> +<<if $ui != "start">><p><<includeDOM userButton()>></p><</if>> <<if $ui != "start">> <<if $cheatMode || $debugMode>> diff --git a/src/gui/storyCaptionWidgets.tw b/src/gui/storyCaptionWidgets.tw deleted file mode 100644 index ce839f41640d134d11dbf77287039fbf8f4a8cc3..0000000000000000000000000000000000000000 --- a/src/gui/storyCaptionWidgets.tw +++ /dev/null @@ -1,35 +0,0 @@ -:: StoryCaptionWidgets [widget nobr] - -<<widget "userButton">> - <<set _Pass = passage()>> - /* Must use link so spacebar shortcut will work. */ - /* Don't remove these spans, it will break things. */ - <<if _Pass != "End Week">> - <<if _Pass == "Main">> - <strong> - <div id="endWeekButton"> - <<link "END WEEK">> - <<run endWeek()>> - <</link>> - <span class="hotkey"> - <<print App.UI.Hotkeys.hotkeys("endWeek")>> - </span> - </div> - </strong> - <<if $rulesAssistantAuto == 1 && DefaultRulesError()>> - <div>@@.yellow;WARNING: Rules Assistant has rules with errors!@@</div> - <</if>> - <<else>> - <strong><div id="nextButton"> - <<if $nextButton != " ">> - <<link "$nextButton">> - <<goto $nextLink>> - <</link>> - <span class="hotkey"> - <<print App.UI.Hotkeys.hotkeys("nextLink")>> - </span> - <</if>> - </div></strong> - <</if>> - <</if>> -<</widget>> diff --git a/src/gui/userButton.js b/src/gui/userButton.js new file mode 100644 index 0000000000000000000000000000000000000000..b173ef506a4cf70322e4f6fadcd605d6887aa164 --- /dev/null +++ b/src/gui/userButton.js @@ -0,0 +1,42 @@ +globalThis.userButton = function(nextButton = V.nextButton, nextLink = V.nextLink) { + const el = new DocumentFragment(); + const _Pass = passage(); + let div = document.createElement("div"); + div.style.fontWeight = "bold"; + // We must always have a named element so we have something to refresh even if the button is hidden for a scene + if (_Pass !== "End Week") { + if (_Pass === "Main") { + div.id = "endWeekButton"; + div.append( + App.UI.DOM.link( + "END WEEK", + () => endWeek() + ) + ); + div.append(" "); + App.UI.DOM.appendNewElement("span", div, App.UI.Hotkeys.hotkeys("endWeek"), "hotkey"); + el.append(div); + if (V.rulesAssistantAuto === 1 && DefaultRulesError()) { + App.UI.DOM.appendNewElement("div", el, `WARNING: Rules Assistant has rules with errors!`, "yellow"); + } + } else { + div.id = "nextButton"; + if (nextButton !== " ") { + div.append( + App.UI.DOM.passageLink( + nextButton, + nextLink + ) + ); + div.append(" "); + App.UI.DOM.appendNewElement("span", div, App.UI.Hotkeys.hotkeys("nextLink"), "hotkey"); + } + el.append(div); + } + } + return el; +}; + +globalThis.updateUserButton = function() { + return jQuery("#nextButton").empty().append(userButton()); +}; diff --git a/src/utility/miscWidgets.tw b/src/utility/miscWidgets.tw index 575104a7beb1973f8bee378a022eed4cb6fc377a..9d0a63faeb61734ae5cf69a273f653cd7dbdedba 100644 --- a/src/utility/miscWidgets.tw +++ b/src/utility/miscWidgets.tw @@ -7,7 +7,7 @@ Call as <<UpdateNextButton>> Allows for dynamic updating of the next button in the storyCaption (left side-bar) for events that disable the button until user makes a selection %/ <<widget "UpdateNextButton">> - <<replace "#nextButton">> <<userButton>> <</replace>> + <<run updateUserButton()>> <</widget>> <<widget "Master">><<if def $args[0]>><<run Enunciate($args[0])>><<elseif ndef $enunciate>><<run Enunciate($activeSlave)>><</if>>$enunciate.title<</widget>>