From 4ef570ed8c23933e6589c5f202040604287b0060 Mon Sep 17 00:00:00 2001
From: ezsh <ezsh.junk@gmail.com>
Date: Wed, 20 Feb 2019 07:40:59 +0100
Subject: [PATCH] slaveSummary: Fix HTML markup when skipping slaves

Closes #507.
---
 src/js/slaveSummaryWidgets.js | 86 +++++++++++++++++------------------
 1 file changed, 43 insertions(+), 43 deletions(-)

diff --git a/src/js/slaveSummaryWidgets.js b/src/js/slaveSummaryWidgets.js
index 294764fd40e..688f7a4644d 100644
--- a/src/js/slaveSummaryWidgets.js
+++ b/src/js/slaveSummaryWidgets.js
@@ -5026,17 +5026,17 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Spa":
 				if (V.Flag == 0) {
-					if (V.spa <= V.spaSlaves) continue;
+					if (V.spa <= V.spaSlaves) { res.pop(); continue; }
 					if ((_Slave.health < 20) || (_Slave.trust < 60) || (_Slave.devotion <= 60) || (_Slave.fetish == "mindbroken") || _Slave.sexualFlaw !== "none" || _Slave.behavioralFlaw !== "none") {
 						if (_Slave.devotion >= -20 || _Slave.fetish == "mindbroken") {
 							res.push(dividerAndImage(_Slave));
 							res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 						} else {
-							res.push(`<br><i>${_Slave.slaveName} cannot be trusted in the spa</i>`);
+							res.push(`<i>${_Slave.slaveName} cannot be trusted in the spa</i></div>`);
 							continue;
 						}
 					} else {
-						res.push(`<br><i>${_Slave.slaveName} cannot benefit from the spa</i>`);
+						res.push(`<i>${_Slave.slaveName} cannot benefit from the spa</i></div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5053,12 +5053,12 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Nursery":
 				if (V.Flag == 0) {
-					if (V.nurseryNannies <= V.nurserySlaves) continue;
+					if (V.nurseryNannies <= V.nurserySlaves) { res.pop(); continue; }
 					if ((_Slave.devotion >= -20) || ((_Slave.devotion >= -50) && (_Slave.trust <= 20)) || (_Slave.trust < -20)) {
 						res.push(dividerAndImage(_Slave));
 						res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 					} else {
-						res.push(`<br><i>${_Slave.slaveName} must be either more fearful of you or devoted to you</i>`);
+						res.push(`<i>${_Slave.slaveName} must be either more fearful of you or devoted to you</i></div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5077,17 +5077,17 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Brothel":
 				if (V.Flag == 0) {
-					if (V.brothel <= V.brothelSlaves) continue;
+					if (V.brothel <= V.brothelSlaves) { res.pop(); continue; }
 					if (_Slave.breedingMark != 1 || V.propOutcome == 0) {
 						if ((_Slave.devotion > 50) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50) || (_Slave.trust > 50)) {
 							res.push(dividerAndImage(_Slave));
 							res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 						} else {
-							res.push(`<br><i>${_Slave.slaveName} must be either more fearful of you or devoted to you</i>`);
+							res.push(`<i>${_Slave.slaveName} must be either more fearful of you or devoted to you</i></div>`);
 							continue;
 						}
 					} else {
-						res.push(`<br><i>${_Slave.slaveName} is for private use only</i>`);
+						res.push(`<i>${_Slave.slaveName} is for private use only</i></div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5106,17 +5106,17 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Club":
 				if (V.Flag == 0) {
-					if (V.club <= V.clubSlaves) continue;
+					if (V.club <= V.clubSlaves) { res.pop(); continue; }
 					if (_Slave.breedingMark != 1 || V.propOutcome == 0) {
 						if ((_Slave.devotion > 50) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50) || (_Slave.trust > 50)) {
 							res.push(dividerAndImage(_Slave));
 							res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 						} else {
-							res.push(`<br>//${_Slave.slaveName} must be either more fearful of you or devoted to you//`);
+							res.push(`//${_Slave.slaveName} must be either more fearful of you or devoted to you//</div>`);
 							continue;
 						}
 					} else {
-						res.push(`<br>//${_Slave.slaveName} is for private use only//`);
+						res.push(`//${_Slave.slaveName} is for private use only//</div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5133,12 +5133,12 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Clinic":
 				if (V.Flag == 0) {
-					if (V.clinic <= V.clinicSlaves) continue;
+					if (V.clinic <= V.clinicSlaves) { res.pop(); continue; }
 					if ((_Slave.health < 20) || (V.Nurse != 0 && ((_Slave.chem > 15 && V.clinicUpgradeFilters == 1) || (V.bellyImplants == 1 && _Slave.bellyImplant > -1) || (_Slave.pregKnown == 1 && (V.clinicSpeedGestation >= 0 || _Slave.pregControl == "speed up")) || (_Slave.pregAdaptation * 1000 < _Slave.bellyPreg || _Slave.preg > _Slave.pregData.normalBirth / 1.33)))) {
 						res.push(dividerAndImage(_Slave));
 						res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 					} else {
-						res.push(`<br>//${_Slave.slaveName} cannot benefit from the clinic//`);
+						res.push(`//${_Slave.slaveName} cannot benefit from the clinic//</div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5155,17 +5155,17 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Schoolroom":
 				if (V.Flag == 0) {
-					if (V.schoolroom <= V.schoolroomSlaves) continue;
+					if (V.schoolroom <= V.schoolroomSlaves) { res.pop(); continue; }
 					if ((_Slave.devotion >= -20) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50)) {
 						if ((_Slave.intelligenceImplant < 30) || (_Slave.voice != 0 && _Slave.accent + V.schoolroomUpgradeLanguage > 2) || (_Slave.oralSkill <= 10 + V.schoolroomUpgradeSkills * 20) || (_Slave.whoreSkill <= 10 + V.schoolroomUpgradeSkills * 20) || (_Slave.entertainSkill <= 10 + V.schoolroomUpgradeSkills * 20) || (_Slave.analSkill < 10 + V.schoolroomUpgradeSkills * 20) || ((_Slave.vagina >= 0) && (_Slave.vaginalSkill < 10 + V.schoolroomUpgradeSkills * 20))) {
 							res.push(dividerAndImage(_Slave));
 							res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 						} else {
-							res.push(`<br>//${_Slave.slaveName} already has a basic education//`);
+							res.push(`//${_Slave.slaveName} already has a basic education//</div>`);
 							continue;
 						}
 					} else {
-						res.push(`<br>//${_Slave.slaveName} is too resistant to learn//`);
+						res.push(`//${_Slave.slaveName} is too resistant to learn//</div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5183,19 +5183,19 @@ App.UI.slaveSummaryList = function (passageName) {
 			case "Dairy":
 				if (V.Flag == 0) {
 					const _dairySeed = V.bioreactorsXY + V.bioreactorsXX + V.bioreactorsHerm + V.bioreactorsBarren;
-					if (_Slave.assignment == "work in the dairy") continue;
-					if (V.dairy <= V.dairySlaves + _dairySeed) continue;
+					if (_Slave.assignment == "work in the dairy") { res.pop(); continue; }
+					if (V.dairy <= V.dairySlaves + _dairySeed) { res.pop(); continue; }
 					if ((_Slave.indentureRestrictions > 0) && (V.dairyRestraintsSetting > 1)) {
-						res.push(`<br>//${_Slave.slaveName}'s indenture forbids extractive Dairy service.//`);
+						res.push(`//${_Slave.slaveName}'s indenture forbids extractive Dairy service.//</div>`);
 						continue;
 					} else if ((_Slave.indentureRestrictions > 1) && (V.dairyRestraintsSetting > 0)) {
-						res.push(`<br>//${_Slave.slaveName}'s indenture allows only free range milking.//`);
+						res.push(`//${_Slave.slaveName}'s indenture allows only free range milking.//</div>`);
 						continue;
 					} else if (_Slave.breedingMark == 1 && V.propOutcome == 1 && V.dairyRestraintsSetting > 0) {
-						res.push(`<br>//${_Slave.slaveName} may only be a free range cow//`);
+						res.push(`//${_Slave.slaveName} may only be a free range cow//</div>`);
 						continue;
 					} else if ((V.dairyPregSetting > 0) && ((_Slave.bellyImplant != -1) || (_Slave.broodmother != 0))) {
-						res.push(`<br>//${_Slave.slaveName}'s womb cannot accommodate current machine settings//`);
+						res.push(`//${_Slave.slaveName}'s womb cannot accommodate current machine settings//</div>`);
 						continue;
 					} else {
 						if ((_Slave.lactation > 0) || (_Slave.balls > 0) || ((V.dairySlimMaintainUpgrade == 0 || V.dairySlimMaintain == 0) && (_Slave.boobs > 300 || _Slave.balls == 0 || V.dairyImplantsSetting == 1) && V.dairyImplantsSetting != 2)) {
@@ -5205,22 +5205,22 @@ App.UI.slaveSummaryList = function (passageName) {
 										res.push(dividerAndImage(_Slave));
 										res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 									} else {
-										res.push(`<br>//${_Slave.slaveName}'s vagina cannot accommodate current machine settings//`);
+										res.push(`//${_Slave.slaveName}'s vagina cannot accommodate current machine settings//</div>`);
 										continue;
 									}
 								} else {
-									res.push(`<br>//${_Slave.slaveName}'s anus cannot accommodate current machine settings//`);
+									res.push(`//${_Slave.slaveName}'s anus cannot accommodate current machine settings//</div>`);
 									continue;
 								}
 							} else {
-								res.push(`<br>//${_Slave.slaveName} must be obedient in order to be milked here//`);
+								res.push(`//${_Slave.slaveName} must be obedient in order to be milked here//</div>`);
 								continue;
 							}
 						} else if ((V.dairySlimMaintainUpgrade == 1 && V.dairySlimMaintain == 1) || (V.dairyImplantsSetting == 2) || (_Slave.boobs <= 300 && _Slave.balls > 0 && (V.dairyImplantsSetting == 0 || V.dairyImplantsSetting == 3))) {
-							res.push(`<br>//${_Slave.slaveName} is not lactating` + (V.seeDicks > 0) ? 'or producing semen' : '' + `and ${V.dairyName}'s current settings forbid the automatic implantation of lactation inducing drugs or manual stimulation to induce it, so she cannot be a cow//`);
+							res.push(`//${_Slave.slaveName} is not lactating` + (V.seeDicks > 0) ? 'or producing semen' : '' + `and ${V.dairyName}'s current settings forbid the automatic implantation of lactation inducing drugs or manual stimulation to induce it, so she cannot be a cow//</div>`);
 							continue;
 						} else {
-							res.push(`<br>//${_Slave.slaveName} is not lactating` + (V.seeDicks > 0) ? 'or producing semen' : '' + 'and cannot be a cow//');
+							res.push(`//${_Slave.slaveName} is not lactating` + (V.seeDicks > 0) ? 'or producing semen' : '' + 'and cannot be a cow//</div>');
 							continue;
 						}
 					}
@@ -5238,8 +5238,8 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Farmyard":
 				if (V.Flag == 0) {
-					if (_Slave.assignment == "work as a farmhand") continue;
-					if (V.farmyard <= V.farmyardSlaves) continue;
+					if (_Slave.assignment == "work as a farmhand") { res.pop(); continue; }
+					if (V.farmyard <= V.farmyardSlaves){ res.pop(); continue; }
 					res.push(dividerAndImage(_Slave));
 					res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 				} else if (V.Flag == 1) {
@@ -5256,12 +5256,12 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Servants' Quarters":
 				if (V.Flag == 0) {
-					if (V.servantsQuarters <= V.servantsQuartersSlaves) continue;
+					if (V.servantsQuarters <= V.servantsQuartersSlaves) { res.pop(); continue; }
 					if ((_Slave.devotion >= -20) || ((_Slave.devotion >= -50) && (_Slave.trust <= 20)) || (_Slave.trust < -20)) {
 						res.push(dividerAndImage(_Slave));
 						res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 					} else {
-						res.push(`<br>//${_Slave.slaveName} must be either more fearful of you or devoted to you//`);
+						res.push(`//${_Slave.slaveName} must be either more fearful of you or devoted to you//</div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5278,12 +5278,12 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Master Suite":
 				if (V.Flag == 0) {
-					if (V.masterSuite <= V.masterSuiteSlaves) continue;
+					if (V.masterSuite <= V.masterSuiteSlaves) { res.pop(); continue; }
 					if ((_Slave.devotion > 20) || ((_Slave.devotion >= -50) && (_Slave.trust < -20)) || (_Slave.trust < -50)) {
 						res.push(dividerAndImage(_Slave));
 						res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 					} else {
-						res.push(`<br>//${_Slave.slaveName} is not sufficiently broken for the master suite//`);
+						res.push(`//${_Slave.slaveName} is not sufficiently broken for the master suite//</div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5299,14 +5299,14 @@ App.UI.slaveSummaryList = function (passageName) {
 				res.push(`[[${_slaveName}|Concubine Workaround][$i = ${_ssi}]]`);
 				break;
 			case "Cellblock":
-				if (_Slave.assignmentVisible != 1) continue;
+				if (_Slave.assignmentVisible != 1) { res.pop(); continue; }
 				if (V.Flag == 0) {
-					if (V.cellblock <= V.cellblockSlaves) continue;
+					if (V.cellblock <= V.cellblockSlaves) { res.pop(); continue; }
 					if ((_Slave.devotion < -20 && _Slave.trust >= -20) || (_Slave.devotion < -50 && _Slave.trust >= -50)) {
 						res.push(dividerAndImage(_Slave));
 						res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 					} else {
-						res.push(`<br>//${_Slave.slaveName} is sufficiently broken in so that the cellblock would have no effect//`);
+						res.push(`//${_Slave.slaveName} is sufficiently broken in so that the cellblock would have no effect//</div>`);
 						continue;
 					}
 				} else if (V.Flag == 1) {
@@ -5323,18 +5323,18 @@ App.UI.slaveSummaryList = function (passageName) {
 				break;
 			case "Arcade":
 				if (V.Flag == 0) {
-					if (_Slave.assignment == "be confined in the arcade") continue;
-					if (V.arcade <= V.arcadeSlaves && V.arcadeUpgradeFuckdolls != 1) continue;
+					if (_Slave.assignment == "be confined in the arcade") { res.pop(); continue; }
+					if (V.arcade <= V.arcadeSlaves && V.arcadeUpgradeFuckdolls != 1) { res.pop(); continue; }
 					if ((_Slave.breedingMark != 1 || V.propOutcome == 0)) {
 						if (_Slave.indentureRestrictions <= 0) {
 							res.push(dividerAndImage(_Slave));
 							res.push(`[[${_slaveName}|Slave Interact][$activeSlave = $slaves[${_ssi}]]]`);
 						} else {
-							res.push(`<br>//${_Slave.slaveName}'s indenture forbids arcade service.//`);
+							res.push(`//${_Slave.slaveName}'s indenture forbids arcade service.//</div>`);
 							continue;
 						}
 					} else {
-						res.push(`<br>//${_Slave.slaveName} is for private use only//`);
+						res.push(`//${_Slave.slaveName} is for private use only//</div>`);
 						continue;
 					}
 				} else {
@@ -5345,13 +5345,13 @@ App.UI.slaveSummaryList = function (passageName) {
 			case "Pit":
 				if (V.Flag == 0) {
 					if ((_Slave.indentureRestrictions > 0) && (V.pitLethal == 1)) {
-						res.push(`<br>//${_Slave.slaveName}'s indenture forbids lethal fights.//`);
+						res.push(`//${_Slave.slaveName}'s indenture forbids lethal fights.//</div>`);
 						continue;
 					} else if (_Slave.indentureRestrictions > 1) {
-						res.push(`<br>//${_Slave.slaveName}'s indenture forbids fighting.//`);
+						res.push(`//${_Slave.slaveName}'s indenture forbids fighting.//</div>`);
 						continue;
 					} else if (_Slave.breedingMark == 1 && V.propOutcome == 1) {
-						res.push(`<br>//${_Slave.slaveName} may not participate in combat//`);
+						res.push(`//${_Slave.slaveName} may not participate in combat//</div>`);
 						continue;
 					} else {
 						res.push(dividerAndImage(_Slave));
-- 
GitLab