From 970879f060c194d1438c88b9e7c49934d8c5ed41 Mon Sep 17 00:00:00 2001 From: Trinidad <anchaiscastilla@gmail.com> Date: Wed, 2 Aug 2023 10:03:29 +0200 Subject: [PATCH] modified: src/events/eventUtils.js modified: src/js/utilsPC.js --- src/events/eventUtils.js | 17 +++++++++++++++-- src/js/utilsPC.js | 6 +++--- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/src/events/eventUtils.js b/src/events/eventUtils.js index c3245d1ea50..34c3c611986 100644 --- a/src/events/eventUtils.js +++ b/src/events/eventUtils.js @@ -221,7 +221,7 @@ App.Events.Result = class { * @param {string} [text] - the link text for the response * @param {resultHandler} [handler] - the function to call to generate the result when the link is clicked * @param {string|HTMLElement|DocumentFragment} [note] - a note to provide alongside the link (for example, a cost or virginity loss warning) - * To mark an option as disabled, construct the result with only the note. String may NOT contain HTML. + * To mark an option as disabled, construct the result with only the note. String may NOT contain HTML, but a WARNING# tag may be included in the note string to add a warning text ("This is the information note. WARNING# This is a warning text."). */ constructor(text, handler, note) { this.text = text; @@ -256,7 +256,20 @@ App.Events.Result = class { node.append(" "); } if (this.note) { - node.appendChild(App.UI.DOM.makeElement("span", this.note, ["detail"])); + if (typeof this.note === "string" && this.note.includes("WARNING#")) { + let warning = ""; + let subnote = ""; + warning = this.note.substring(this.note.indexOf("WARNING#") + 8); + subnote = this.note.substring(0, this.note.indexOf("WARNING#")); + if (subnote.length) { + node.appendChild(App.UI.DOM.makeElement("span", subnote, ["detail"])); + } + if (warning.length) { + node.appendChild(App.UI.DOM.makeElement("span", warning, ["warning"])); + } + } else { + node.appendChild(App.UI.DOM.makeElement("span", this.note, ["detail"])); + } wrote = true; } return wrote; diff --git a/src/js/utilsPC.js b/src/js/utilsPC.js index 8117443c930..9e88a1c2bfc 100644 --- a/src/js/utilsPC.js +++ b/src/js/utilsPC.js @@ -1099,12 +1099,12 @@ globalThis.PCPenetrationWarning = function(holes = "vaginal first", escape = fal return result; } else if (virgins.length === 2) { if (holes === "either") { - result += ` WARNING: This option ${action} take your vaginal or anal virginities.`; + result += `WARNING# This option ${action} take your vaginal or anal virginities.`; } else { - result += ` WARNING: This option ${action} take your vaginal and anal virginities.`; + result += `WARNING# This option ${action} take your vaginal and anal virginities.`; } } else { - result += ` WARNING: This option ${action} take your ${virgins[0]} virginity.`; + result += `WARNING# This option ${action} take your ${virgins[0]} virginity.`; } return result; } -- GitLab