diff --git a/src/js/utilsSC.js b/src/js/utilsSC.js index 5e1e5008faf948cbb7dfed1f6c0bb62c6a2ee708..c25ceb4cf6a800de58595e40b43ff64045adacbd 100644 --- a/src/js/utilsSC.js +++ b/src/js/utilsSC.js @@ -270,3 +270,25 @@ App.UI.disabledLink = function(link, reasons) { `<div class="tooltip"><ul>${reasons.map(e => `<li>${e}</li>`).join('')}</ul></div>`; return `<span class="textWithTooltip">${link}${tooltips}</span>`; }; + +/** + * Generates a link which shows a slave description dialog for a specified slave. + * Do not call from within another dialog. + * @param {App.Entity.SlaveState} slave + * @returns {string} link (in SC markup) + */ +App.UI.slaveDescriptionDialog = function(slave) { + function showDialog() { + const oldEventDescription = V.eventDescription; + V.eventDescription = 1; // should be easy enough to use this for non-event cases too, but you'll need to fix the art display + const oldActiveSlave = V.activeSlave; + V.activeSlave = slave; + Dialog.setup(SlaveFullName(slave)); + Dialog.wiki('<div class="imageRef medImg"><<= SlaveArt($activeSlave, 2, 0)>></div><<include "Long Slave Description">>'); + Dialog.open(); + V.activeSlave = oldActiveSlave; + V.eventDescription = oldEventDescription; + } + + return App.UI.link(SlaveFullName(slave), showDialog, []); +}; diff --git a/src/uncategorized/reSlaveMarriage.tw b/src/uncategorized/reSlaveMarriage.tw index 0078bbf9be1a30804a54687676228d30d0bb5af2..2e305bdb97c80687ae74e479770bc7d039d94e90 100644 --- a/src/uncategorized/reSlaveMarriage.tw +++ b/src/uncategorized/reSlaveMarriage.tw @@ -25,7 +25,7 @@ /* 000-250-006 */ </span> -<<print "[[_groomSlave.slaveName|Long Slave Description][$nextLink = passage(), $eventDescription = 1,$activeSlave = _groomSlave]]">> and <<print "[[_brideSlave.slaveName|Long Slave Description][$nextLink = passage(), $eventDescription = 1,$activeSlave = _brideSlave]]">> come into your office +<<= App.UI.slaveDescriptionDialog(_groomSlave)>> and <<= App.UI.slaveDescriptionDialog(_brideSlave)>> come into your office <<if hasAnyArms(_groomSlave) && hasAnyArms(_brideSlave)>>holding hands<<else>>doing their best to stay close to one another despite their physical limitations<</if>>. _brideSlave.slaveName looks at _groomSlave.slaveName expectantly, but _he2's terribly nervous and makes several false starts before beginning. Finally _groomSlave.slaveName musters $his courage and <<if !canTalk(_groomSlave)>>asks you with simple gestures to grant the two of them a slave marriage.<<else>>asks with $his voice cracking, "<<Master>>, would you plea<<s>>e grant u<<s>> a <<s>>lave marriage?"<</if>> <br><br> diff --git a/src/utility/miscWidgets.tw b/src/utility/miscWidgets.tw index d29ab3c6e288a5e8baa021bcd1d24259224d3444..baca622d5448858e0c28d08f3389e1babdf2915a 100644 --- a/src/utility/miscWidgets.tw +++ b/src/utility/miscWidgets.tw @@ -371,33 +371,9 @@ $args[0]: Slave. /* Call as <<EventNameLink>> */ -<<widget "EventNameLink">> - <span id="name"> - <<link "<<= SlaveFullName($activeSlave)>>">> - <<replace #longSlaveHide>> - <<link "(hide)">> - <<replace #longSlaveHide>> - <</replace>> - <<replace #longSlaveDescription>> - /* Hide */ - <</replace>> - <</link>> - <</replace>> - <<replace #longSlaveDescription>> - <p> - <<set _eventDescription = $eventDescription, $eventDescription = 1>> - <<include "Long Slave Description">> - <<set $eventDescription = _eventDescription>> - </p> - <</replace>> - <</link>> - </span> - <span id="longSlaveHide"></span> - - <span id="longSlaveDescription"></span> -<</widget>> +<<widget "EventNameLink">><<= App.UI.slaveDescriptionDialog($activeSlave)>><</widget>> /* Call as <<EventNameDelink>> */ -<<widget "EventNameDelink">><<replace "#name">><<= SlaveFullName($activeSlave)>><</replace>><</widget>> \ No newline at end of file +<<widget "EventNameDelink">><</widget>> \ No newline at end of file