diff --git a/src/endWeek/saServeThePublic.js b/src/endWeek/saServeThePublic.js index 381e887ac272eae8141bddcd1203d891962b86ba..366c7736815a4cb4e84a7f433c07f9df4d7e3c36 100644 --- a/src/endWeek/saServeThePublic.js +++ b/src/endWeek/saServeThePublic.js @@ -38,7 +38,7 @@ window.saServeThePublic = (function saServeThePublic() { sexCounts(slave); jobPreface(slave); bonusMultiplierText(slave); - usageCountDescripions(slave); + usageCountDescriptions(slave); if (V.seeAge === 1) { comingOfAge(slave); } @@ -199,7 +199,7 @@ window.saServeThePublic = (function saServeThePublic() { } /** @param {App.Entity.SlaveState} slave */ - function usageCountDescripions(slave) { + function usageCountDescriptions(slave) { r += ` ${His} appearance attracted ${slave.sexAmount} members of the public (${Math.trunc(slave.sexAmount / 7)} a day)`; if (slave.sexAmount > 160) { r += `, so many that `; diff --git a/src/endWeek/saWhore.js b/src/endWeek/saWhore.js index adeb229cae6ff32ed5c86b8fa90d6d449a88feaa..51252a283c1d8b28791671ff8df38a2597892a72 100644 --- a/src/endWeek/saWhore.js +++ b/src/endWeek/saWhore.js @@ -46,7 +46,7 @@ window.saWhore = (function saWhore() { sexCounts(slave); jobPreface(slave); bonusMultiplierText(slave); - usageCountDescripions(slave); + usageCountDescriptions(slave); if (V.seeAge === 1) { comingOfAge(slave); } @@ -78,7 +78,6 @@ window.saWhore = (function saWhore() { // I suspect this one will mostly be cut out in the overhauling /** @param {App.Entity.SlaveState} slave */ function updateNonSlaveVariables(slave) { - // FResult setting FuckResult = FResult(slave); //slave needs release @@ -102,7 +101,7 @@ window.saWhore = (function saWhore() { if (canDoAnal(slave) && slave.anus === 0) { FuckResult += 10; } - + // Beauty setting beauty = Beauty(slave); if (V.ACitizens > (V.ASlaves * 4)) { @@ -127,7 +126,7 @@ window.saWhore = (function saWhore() { if (slave.minorInjury !== 0) { beauty -= 1; } - + // Beauty multipliers beautyMultiplier = 1; if (V.brothel > 0) { @@ -211,7 +210,7 @@ window.saWhore = (function saWhore() { } } } - + // setting and adjustments beauty = Math.trunc(beauty * beautyMultiplier); if ((slave.hears === -1 && slave.earwear !== "hearing aids") || (slave.hears === 0 && slave.earwear === "muffling ear plugs") ||(slave.hears === -2)) { @@ -228,7 +227,7 @@ window.saWhore = (function saWhore() { } T.incomeStats.customers = beauty; } - + /** @param {App.Entity.SlaveState} slave */ function jobPreface(slave) { if (slave.devotion > 95 || slave.energy > 95) { @@ -318,7 +317,7 @@ window.saWhore = (function saWhore() { } } if (V.Madam !== 0) { - let madamPronouns = getPronouns(V.Madam); + const madamPronouns = getPronouns(V.Madam); if (V.madamCashBonus > 0) { if (slave.assignment === "whore") { r += ` Working`; @@ -362,7 +361,7 @@ window.saWhore = (function saWhore() { } /** @param {App.Entity.SlaveState} slave */ - function usageCountDescripions(slave) { + function usageCountDescriptions(slave) { r += ` ${His} appearance attracted ${beauty} members of the public (${Math.trunc(beauty / 7)} a day)`; if (beauty > 160) { r += `, so many that `; @@ -591,7 +590,7 @@ window.saWhore = (function saWhore() { } else if (slave.skill.entertainer >= V.masteredXP) { r += ` ${He} has experience as a prostitute from working for you, making ${him} more effective.`; } - + if (!canWalk(slave)) { if ((V.universalRulesFacilityWork === 1 && slave.assignment === "whore" && V.brothelSpots > 0) || (slave.assignment === "work in the brothel")) { r += ` Since ${he} can't walk, ${he} spends all of $his time in $his own room in ${V.brothelName}. Customers come in, fuck ${him}, and leave.`; @@ -705,14 +704,14 @@ window.saWhore = (function saWhore() { if ((slave.releaseRules === "restrictive" || slave.releaseRules === "chastity") && slave.standardReward !== "orgasm") { r += ` ${He}'s a better whore because prostitution is ${his} main sexual outlet.`; } - + //Someone double check this block if (V.familyTesting === 1) { if (totalRelatives(slave) > 0) { let children = []; children = V.slaves.filter( - function(s) { - return ((slave.ID == s.father || slave.ID == s.mother || s.ID == slave.father || s.ID == slave.mother || areSisters(slave, s) > 0) && (s.assignment === slave.assignment)); + function(s) { + return ((slave.ID === s.father || slave.ID === s.mother || s.ID === slave.father || s.ID === slave.mother || areSisters(slave, s) > 0) && (s.assignment === slave.assignment)); } ); if (children.length > 2) { @@ -739,7 +738,7 @@ window.saWhore = (function saWhore() { r += ` Customers are very enthusiastic about being able to participate in incestuous sex.`; } } else if (children.length > 0) { - let relativePronouns = getPronouns(children[0]); + const relativePronouns = getPronouns(children[0]); r += ` Since ${his} relative, ${children[0].slaveName}, is selling ${relativePronouns.objectReflexive} too, ${he} earns extra ¤ by working with ${relativePronouns.object}.`; if (arcology.FSEgyptianRevivalist > 20) { r += ` Customers are very enthusiastic about being able to participate in incestuous sex like the ancient Egyptians.`; @@ -752,7 +751,7 @@ window.saWhore = (function saWhore() { if (slave.relation !== 0) { SWi = V.slaveIndices[slave.relationTarget]; if (SWi !== undefined && slave.assignment === V.slaves[SWi].assignment) { - let relativePronouns = getPronouns(V.slaves[SWi]); + const relativePronouns = getPronouns(V.slaves[SWi]); r += ` Since ${his} ${V.slaves[SWi].relation} ${V.slaves[SWi].slaveName} is selling ${relativePronouns.objectReflexive} too, ${he} earns extra ¤ by working with ${relativePronouns.object}.`; if (arcology.FSEgyptianRevivalist > 20) { r += ` Customers are very enthusiastic about being able to participate in incestuous sex like the ancient Egyptians.`; @@ -840,7 +839,7 @@ window.saWhore = (function saWhore() { if (slave.butt > 4 && slave.boobs > 800) { if (arcology.FSAssetExpansionist !== "unset") { r += ` ${He} makes a river of ¤ with ${his} huge, fashionable assets.`; - if (canTalk(slave)){ + if (canTalk(slave)) { if (slave.voice > 2) { r += ` ${His} high voice contributes to ${his} bimbo image, so ${he} does even better.`; } @@ -928,7 +927,7 @@ window.saWhore = (function saWhore() { } } } else if (arcology.FSHedonisticDecadence !== "unset" && slave.weight <= 30) { // reduced weight malus for fat loving societies - if (arcology.FSHedonisticDecadenceStrongFat === 1) { // no muscle malus for muscle loving societies + if (arcology.FSHedonisticDecadenceStrongFat === 1) { // no muscle malus for muscle loving societies if (arcology.FSSlimnessEnthusiast > 20) { r += ` ${He} makes extra ¤ due to ${his} fashionably sleek little body.`; } else { @@ -1045,7 +1044,7 @@ window.saWhore = (function saWhore() { } if (arcology.FSSupremacist !== "unset") { if (slave.race !== arcology.FSSupremacistRace) { - r += ` Some citizens fetishize whoress of the servile races.`; + r += ` Some citizens fetishize whores of the servile races.`; } } if (arcology.FSSubjugationist !== "unset") { @@ -1371,7 +1370,7 @@ window.saWhore = (function saWhore() { cashX(cash, "whoring in an unregistered building", slave); } } - + /** @param {App.Entity.SlaveState} slave */ function addCashText(slave) { r += ` In total, you were paid <span class="yellowgreen">${cashFormat(cash)}</span> for the use of ${slave.slaveName}'s body this week.`; @@ -1618,8 +1617,7 @@ window.saWhore = (function saWhore() { /** @param {App.Entity.SlaveState} slave */ function assignmentVignette(slave) { - let vignette; - vignette = GetVignette(slave); + const vignette = GetVignette(slave); // I forgot what to do with __X__ r += ` __This week__ ${vignette.text} `; if (vignette.type === "cash") { @@ -1706,4 +1704,4 @@ window.saWhore = (function saWhore() { T.incomeStats.rep += Math.trunc(FuckResult * vignette.effect * 0.1); } } -})(); \ No newline at end of file +})(); diff --git a/src/endWeek/saWorkTheFarm.js b/src/endWeek/saWorkTheFarm.js index 2570b995320b2b16ac95933dc5e767a6df061b20..8a1c5bb3c3a2a75b6f0a159d3da766b3ff0e525e 100644 --- a/src/endWeek/saWorkTheFarm.js +++ b/src/endWeek/saWorkTheFarm.js @@ -294,7 +294,7 @@ window.saWorkTheFarm = /** @param {App.Entity.SlaveState} slave */ function saWo if (slave.health > 20) { t += `${He} is in such excellent health that ${he} is able to put on longer and more energetic shows, earning you more. `; } else if (slave.health < -20) { - t += `${His} poor health negatively affects ${his} ablility to put on good shows, cutting into your profits. `; + t += `${His} poor health negatively affects ${his} ability to put on good shows, cutting into your profits. `; } if (slave.face > 40) { t += `${He} is so `; diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 7e20f2a38a0bde6fffe5e131481495aa47300c80..5bbce4a050ae02f511f8eb1cf51fca2b5d727b4e 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -171,7 +171,7 @@ window.assignJob = function assignJob(slave, job) { slave.assignmentVisible = 0; V.masterSuiteSlaves++; V.MastSiIDs.push(slave.ID); - if(V.masterSuiteUpgradeLuxury > 0) + if (V.masterSuiteUpgradeLuxury > 0) slave.livingRules = "luxurious"; else slave.livingRules = "spare"; @@ -259,7 +259,7 @@ window.assignJob = function assignJob(slave, job) { case "be your concubine": slave.assignment = job; slave.assignmentVisible = 0; /* non-visible leadership roles */ - if(V.masterSuiteUpgradeLuxury > 0) + if (V.masterSuiteUpgradeLuxury > 0) slave.livingRules = "luxurious"; else slave.livingRules = "normal"; @@ -592,7 +592,7 @@ App.UI.jobLinks = function () { } } if (slave.fuckdoll === 0) { - const assignment = "choose her own job" + const assignment = "choose her own job"; if (slave.assignment !== assignment) { const linkAction = callback !== undefined ? callback(assignment) : ''; res.push(`<<link "Let ${slave.object} choose" ${passage !== undefined ? '"' + passage + '"' : ''}>><<= assignJob(${App.Utils.slaveRefString(index)}, "${assignment}")>>${linkAction}<</link>>`); @@ -660,7 +660,7 @@ App.UI.SlaveInteract = { links.push('<<link "Dick">><<set $activeSlave.toyHole = "dick">><<replace "#hole">>$activeSlave.toyHole<</replace>><</link>>'); } links.push(`<<link "No Preference">><<set $activeSlave.toyHole = "all ${slave.possessive} holes">><<replace "#hole">>$activeSlave.toyHole<</replace>><</link>>`); - res += links.join(' | ') + '<br>' + res += links.join(' | ') + '<br>'; } let ins = jQuery(document.createDocumentFragment()); ins.wiki(res); @@ -672,8 +672,8 @@ App.UI.SlaveInteract = { return `<<replace "#assign">>$activeSlave.assignment<</replace>><<replace "#${blockId}">><<= App.UI.SlaveInteract.assignmentBlock("${blockId}")>><<= App.UI.SlaveInteract.fucktoyPref()>><</replace>>`; }); if (State.variables.activeSlave.assignment !== "choose her own job") { - res += ' |  <<link "Stay on this assignment for another month">><<set $activeSlave.sentence += 4>><<replace "#assign">>$activeSlave.assignment($activeSlave.sentence weeks)<</replace>><</link>>' + res += ' |  <<link "Stay on this assignment for another month">><<set $activeSlave.sentence += 4>><<replace "#assign">>$activeSlave.assignment($activeSlave.sentence weeks)<</replace>><</link>>'; } return res; } -} +}; diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index 57b6e9ccebaf8d831ee4149929c84131e70af10b..1edb9708fd8882990bb8000f099b3981b251ee0d 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -146,7 +146,7 @@ App.Entity.Utils.SlaveDataSchemeCleanup = (function () { customTitle: "title", customTitleLisp: "titleLisp", customHairVector: "hairVector" - } + }; for (let prop in slave) { if (nameMap.hasOwnProperty(prop)) { @@ -771,7 +771,7 @@ window.SlaveDatatypeCleanup = (function SlaveDatatypeCleanup() { } if (slave.custom.image !== null) { if (typeof slave.custom.image.filename !== "string") { - slave.custom.image = null + slave.custom.image = null; } } } diff --git a/src/js/descriptionWidgets.js b/src/js/descriptionWidgets.js index 0359baa9dd2b5624ec630d98eb8f6b948d32263a..91ba8540fcd90237e4d2dd5898bfbe697af6c408 100644 --- a/src/js/descriptionWidgets.js +++ b/src/js/descriptionWidgets.js @@ -34,8 +34,8 @@ App.Desc.eyes = function (slave) { } r += ` and unfocused`; } - } else if (slave.eyes === -3){ - r += `${He} has ${slave.eyeColor} colored glass eyes` + } else if (slave.eyes === -3) { + r += `${He} has ${slave.eyeColor} colored glass eyes`; } else { r += `${His} gaze is empty`; } @@ -241,7 +241,7 @@ App.Desc.eyes = function (slave) { } } return r; -} +}; /** * @param {App.Entity.SlaveState} slave @@ -251,15 +251,15 @@ App.Desc.eyeColor = function (slave) { "use strict"; let r; - if (slave.eyes === -4){ - r = 'empty' + if (slave.eyes === -4) { + r = "empty"; } else if (hasVisibleHeterochromia(slave)) { - r = `heterochromatic ${slave.eyeColor} and ${slave.geneticQuirks.heterochromatia}`; + r = `heterochromatic ${slave.eyeColor} and ${slave.geneticQuirks.heterochromia}`; } else { r = `${slave.eyeColor}`; } return r; -} +}; /** * @param {App.Entity.SlaveState} slave @@ -442,6 +442,7 @@ App.Desc.ageAndHealth = function (slave) { ** This section replaces the age/therapy texts, giving more details for the NCS condition. */ if (slave.geneMods.NCS) { + let bodyNCS; if (slave.vagina < 0 && slave.dick <= 0) { bodyNCS = "childlike"; } else if (slave.vagina < 0 && slave.dick > 0) { @@ -565,7 +566,7 @@ App.Desc.ageAndHealth = function (slave) { r += ` and ${slave.physicalAge} years old.`; } return r; -} +}; App.Desc.brand = /** @@ -597,7 +598,7 @@ App.Desc.brand = } } return r; - } + }; App.Desc.amputee = /** @@ -637,7 +638,7 @@ App.Desc.amputee = } } return r; - } + }; App.Desc.waist = /** @@ -676,7 +677,6 @@ App.Desc.waist = r += ` despite how thin ${he} is. `; } else { r += `. `; - } if (slave.belly >= 1500) { if (slave.belly >= 750000) { @@ -713,11 +713,11 @@ App.Desc.waist = } } } else if (slave.waist > 40) { - r += `a broad, <span class=red>ugly waist</span> that makes ${him} look mannish` + r += `a broad, <span class=red>ugly waist</span> that makes ${him} look mannish`; if (slave.weight > 30) { - r += ` and exaggerates how fat ${he} is. ` + r += ` and exaggerates how fat ${he} is. `; } else if (slave.weight < -30) { - r += ` despite how thin ${he} is. ` + r += ` despite how thin ${he} is. `; } else { r += `. `; } @@ -756,7 +756,7 @@ App.Desc.waist = } } } else if (slave.waist > 10) { - r += `an <span class=red>unattractive waist</span> that conceals ${his} ` + r += `an <span class=red>unattractive waist</span> that conceals ${his} `; if (slave.visualAge > 25) { r += `girlish`; } else { @@ -809,16 +809,16 @@ App.Desc.waist = } } } else if (slave.waist > -10) { - r += `an average waist for a ` + r += `an average waist for a `; if (slave.visualAge > 25) { r += `${boy}`; } else { r += `${woman}`; } if (slave.weight > 30) { - r += `, though it looks broader since ${he}'s fat. ` + r += `, though it looks broader since ${he}'s fat. `; } else if (slave.weight < -30) { - r += `, though it looks narrower since ${he}'s thin. ` + r += `, though it looks narrower since ${he}'s thin. `; } else { r += `. `; } @@ -861,7 +861,7 @@ App.Desc.waist = } } } else if (slave.waist > -40) { - r += `a nice <span class=pink>feminine waist</span> that gives ${him} a ` + r += `a nice <span class=pink>feminine waist</span> that gives ${him} a `; if (slave.visualAge > 25) { r += `girlish`; } else { @@ -961,7 +961,7 @@ App.Desc.waist = } } } else if (slave.belly < 750000) { - r += `${His} ${belly} belly lewdly bulges to either side of ${his} narrow waist and continues for nearly half a ` + r += `${His} ${belly} belly lewdly bulges to either side of ${his} narrow waist and continues for nearly half a `; if (V.showInches === 2) { r += `yard`; } else { @@ -978,7 +978,7 @@ App.Desc.waist = } } } else { - r += `an <span class=pink>absurdly narrow waist</span> that gives ${him} a cartoonishly hourglass figure` + r += `an <span class=pink>absurdly narrow waist</span> that gives ${him} a cartoonishly hourglass figure`; if (slave.weight > 30) { r += `made even more ludicrous by ${his} extra weight. `; } else if (slave.weight < -30) { @@ -988,7 +988,7 @@ App.Desc.waist = } if (slave.belly >= 1500) { if (slave.belly >= 750000) { - r += `${His} ${belly} belly grotesquely bulges around ${his} narrow waist and continues ` + r += `${His} ${belly} belly grotesquely bulges around ${his} narrow waist and continues `; if (slave.belly >= 1000000) { r += `quite the distance`; } else { @@ -1027,7 +1027,7 @@ App.Desc.waist = } } } else if (slave.belly < 750000) { - r += `${His} ${belly} belly lewdly bulges to either side of ${his} narrow waist and continues for nearly half a ` + r += `${His} ${belly} belly lewdly bulges to either side of ${his} narrow waist and continues for nearly half a `; if (V.showInches === 2) { r += `yard`; } else { @@ -1045,4 +1045,4 @@ App.Desc.waist = } } return r; - } + }; diff --git a/src/js/extendedFamilyModeJS.js b/src/js/extendedFamilyModeJS.js index de9c109f11b68c44985aa4eb36c1357a5a19b92c..a44dd4c8ea5efeac41560bec0a4f105fb37de352 100644 --- a/src/js/extendedFamilyModeJS.js +++ b/src/js/extendedFamilyModeJS.js @@ -16,17 +16,15 @@ window.isParentP = function isParentP(daughter, parent) { window.sameDad = function (slave1, slave2) { if ((slave1.father === slave2.father) && (slave1.father !== 0 && slave1.father !== -2)) { return true; - } else { - return false; } + return false; }; window.sameMom = function (slave1, slave2) { if ((slave1.mother === slave2.mother) && (slave1.mother !== 0 && slave1.mother !== -2)) { return true; - } else { - return false; } + return false; }; window.isAunt = /** @param {App.Entity.SlaveState} niece, @param {App.Entity.SlaveState} aunt */ function (niece, aunt) { @@ -58,9 +56,8 @@ window.sameTParent = function (slave1, slave2) { return 2; } else if ((slave1.mother === slave2.father || slave1.father === slave2.mother) && slave1.mother !== 0 && slave1.mother !== -2 && slave2.mother !== 0 && slave2.mother !== -2 && slave1.mother !== slave1.father) { return 3; - } else { - return 0; } + return 0; }; /* @@ -80,9 +77,8 @@ window.areTwins = function (slave1, slave2) { return false; } else if (slave1.actualAge === slave2.actualAge && slave1.birthWeek === slave2.birthWeek) { return true; - } else { - return false; } + return false; }; window.areSisters = function (slave1, slave2) { @@ -205,9 +201,8 @@ window.isSlaveAvailable = /** @param {App.Entity.SlaveState} slave */ function ( return false; } else if (slave.assignment === "work in the dairy" && State.variables.dairyRestraintsSetting >= 2) { return false; - } else { - return true; } + return true; }; /* OLD @@ -312,7 +307,7 @@ window.totalPlayerRelatives = function (pc) { window.relativeTerm = /** @param {App.Entity.SlaveState} slave1 @param {App.Entity.SlaveState} slave2 */ function (slave1, slave2) { if (slave2.mother === slave1.ID || slave2.father === slave1.ID) { - if (slave2.genes === "XY" && State.variables.diversePronouns == 1) { + if (slave2.genes === "XY" && State.variables.diversePronouns === 1) { return "son"; } else { return "daughter"; @@ -322,31 +317,31 @@ window.relativeTerm = /** @param {App.Entity.SlaveState} slave1 @param {App.Enti } else if (slave1.father === slave2.ID) { return "father"; } else if (areSisters(slave2, slave1) === 1) { - if (slave2.genes === "XY" && State.variables.diversePronouns == 1) { + if (slave2.genes === "XY" && State.variables.diversePronouns === 1) { return "twin brother"; } else { return "twin sister"; } } else if (areSisters(slave2, slave1) === 2) { - if (slave2.genes === "XY" && State.variables.diversePronouns == 1) { + if (slave2.genes === "XY" && State.variables.diversePronouns === 1) { return "brother"; } else { return "sister"; } } else if (areSisters(slave2, slave1) === 3) { - if (slave2.genes === "XY" && State.variables.diversePronouns == 1) { + if (slave2.genes === "XY" && State.variables.diversePronouns === 1) { return "half-brother"; } else { return "half-sister"; } } else if (isAunt(slave1, slave2)) { - if (slave2.genes === "XY" && State.variables.diversePronouns == 1) { + if (slave2.genes === "XY" && State.variables.diversePronouns === 1) { return "nephew"; } else { return "niece"; } } else if (isAunt(slave2, slave1)) { - if (slave2.genes === "XY" && State.variables.diversePronouns == 1) { + if (slave2.genes === "XY" && State.variables.diversePronouns === 1) { return "uncle"; } else { return "aunt"; diff --git a/src/js/familyTreeJS.js b/src/js/familyTreeJS.js index 4819a4019cad81bb1a854391173009beb8d321c6..491dfcd9d01c0e7699e1e4cb50dbfaaf260b21bf 100644 --- a/src/js/familyTreeJS.js +++ b/src/js/familyTreeJS.js @@ -37,14 +37,14 @@ window.renderFamilyTree = function(slaves, filterID) { function initFtreeSVG(data) { ftreeWidth = data.nodes.length * 45; ftreeHeight = data.nodes.length * 35; - if(ftreeWidth < 600) { + if (ftreeWidth < 600) { ftreeWidth = 600; - } else if(ftreeWidth > 1920) { + } else if (ftreeWidth > 1920) { ftreeWidth = 1920; } - if(ftreeHeight < 480) { + if (ftreeHeight < 480) { ftreeHeight = 480; - } else if(ftreeHeight > 1200) { + } else if (ftreeHeight > 1200) { ftreeHeight = 1200; } @@ -95,9 +95,9 @@ window.renderFamilyTree = function(slaves, filterID) { .append('line') .attr('marker-end', 'url(#arrowhead)') .attr('stroke', function(d) { - if(d.type === 'homologous') { + if (d.type === 'homologous') { return '#862d59'; - } else if(d.type === 'paternal') { + } else if (d.type === 'paternal') { return '#24478f'; } else { return '#aa909b'; @@ -118,7 +118,7 @@ window.renderFamilyTree = function(slaves, filterID) { node.append('circle') .attr('r', function (d) { return d.r; }) .attr('stroke', function(d) { - if(d.ID === filterID) { + if (d.ID === filterID) { return '#ffff20'; } else { return '#5a5a5a'; @@ -130,8 +130,8 @@ window.renderFamilyTree = function(slaves, filterID) { node.append('text') .text(function(d) { var ssym; - if(d.ID === -1) { - if(d.dick === 1 && d.vagina === 1) { + if (d.ID === -1) { + if (d.dick === 1 && d.vagina === 1) { ssym = '☿'; } else if (d.dick === 1) { ssym = '♂'; @@ -153,13 +153,13 @@ window.renderFamilyTree = function(slaves, filterID) { .attr('dx', function(d) { return -(8*d.name.length)/2; }) .attr('class', 'node-text') .style('fill', function(d) { - if(d.is_mother && d.is_father) { + if (d.is_mother && d.is_father) { return '#b84dff'; - } else if(d.is_father) { + } else if (d.is_father) { return '#00ffff'; - } else if(d.is_mother) { + } else if (d.is_mother) { return '#ff3399'; - } else if(d.unborn) { + } else if (d.unborn) { return '#a3a3c2'; } else { return '#66cc66'; @@ -202,7 +202,6 @@ window.renderFamilyTree = function(slaves, filterID) { d.fx = null; d.fy = null; } - } }; @@ -237,78 +236,78 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { charList.push.apply(charList, State.variables.tanks); var unborn = {}; - for(let i = 0; i < State.variables.tanks.length; i++) { + for (let i = 0; i < State.variables.tanks.length; i++) { unborn[State.variables.tanks[i].ID] = true; } for (let i = 0; i < State.variables.cribs.length; i++) { unborn[State.variables.cribs[i].ID] = true; } - for(let i = 0; i < charList.length; i++) { + for (let i = 0; i < charList.length; i++) { var mom = charList[i].mother; var dad = charList[i].father; - if(mom) { - if(!kids[mom]) { + if (mom) { + if (!kids[mom]) { kids[mom] = {}; } kids[mom].mother = true; } - if(dad) { - if(!kids[dad]) { + if (dad) { + if (!kids[dad]) { kids[dad] = {}; } kids[dad].father = true; } } - for(let i = 0; i < charList.length; i++) { + for (let i = 0; i < charList.length; i++) { var character = charList[i]; - if(character.mother === 0 && character.father === 0 && !kids[character.ID]) { + if (character.mother === 0 && character.father === 0 && !kids[character.ID]) { continue; } let mom = character.mother; - if(mom < -6) { + if (mom < -6) { if (mom in State.variables.missingTable && State.variables.showMissingSlaves) { node_lookup[mom] = family_graph.nodes.length; var missing = State.variables.missingTable[mom]; charList.push({ID: mom, mother: 0, father: 0, is_mother: true, dick: missing.dick, vagina: missing.vagina, slaveName: missing.slaveName}); } else { - if(typeof outmoms[mom] === 'undefined') { + if (typeof outmoms[mom] === 'undefined') { outmoms[mom] = []; } outmoms[mom].push(character.slaveName); } - } else if(mom < 0 && typeof node_lookup[mom] === 'undefined' && typeof preset_lookup[mom] !== 'undefined') { + } else if (mom < 0 && typeof node_lookup[mom] === 'undefined' && typeof preset_lookup[mom] !== 'undefined') { node_lookup[mom] = family_graph.nodes.length; charList.push({ID: mom, mother: 0, father: 0, is_father: true, dick: 0, vagina: 1, slaveName: preset_lookup[mom]}); } let dad = character.father; - if(dad < -6) { + if (dad < -6) { if (dad in State.variables.missingTable && State.variables.showMissingSlaves) { node_lookup[dad] = family_graph.nodes.length; let missing = State.variables.missingTable[dad]; charList.push({ID: dad, mother: 0, father: 0, is_father: true, dick: missing.dick, vagina: missing.vagina, slaveName: missing.slaveName}); } else { - if(typeof outdads[dad] === 'undefined') { + if (typeof outdads[dad] === 'undefined') { outdads[dad] = []; } outdads[dad].push(character.slaveName); } - } else if(dad < 0 && typeof node_lookup[dad] === 'undefined' && typeof preset_lookup[dad] !== 'undefined') { + } else if (dad < 0 && typeof node_lookup[dad] === 'undefined' && typeof preset_lookup[dad] !== 'undefined') { node_lookup[dad] = family_graph.nodes.length; charList.push({ID: dad, mother: 0, father: 0, is_father: true, dick: 1, vagina: -1, slaveName: preset_lookup[dad]}); } } var mkeys = Object.keys(outmoms); - for(let i = 0; i < mkeys.length; i++) { + for (let i = 0; i < mkeys.length; i++) { var name; var key = mkeys[i]; var names = outmoms[key]; - if(names.length === 1) { + if (names.length === 1) { name = names[0]; - } else if(names.length === 2) { + } else if (names.length === 2) { name = names.join(' and '); } else { names[-1] = `and ${names[-1]}`; @@ -320,13 +319,13 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { } var dkeys = Object.keys(outdads); - for(let i = 0; i < dkeys.length; i++) { + for (let i = 0; i < dkeys.length; i++) { let name; let key = dkeys[i]; let names = outdads[key]; - if(names.length === 1) { + if (names.length === 1) { name = names[0]; - } else if(names.length === 2) { + } else if (names.length === 2) { name = names.join(' and '); } else { names[-1] = `and ${names[-1]}`; @@ -338,7 +337,7 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { } var charHash = {}; - for(let i = 0; i < charList.length; i++) { + for (let i = 0; i < charList.length; i++) { charHash[charList[i].ID] = charList[i]; } @@ -347,43 +346,43 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { var saveTree = {}; function relatedTo(character, targetID, relIDs = {tree: {}, related: false}) { relIDs.tree[character.ID] = true; - if(related[character.ID]) { + if (related[character.ID]) { relIDs.related = true; return relIDs; } - if(character.ID === targetID) { + if (character.ID === targetID) { relIDs.related = true; } - if(seen[character.ID]) { + if (seen[character.ID]) { return relIDs; } seen[character.ID] = true; - if(character.mother !== 0) { - if(charHash[character.mother]) { + if (character.mother !== 0) { + if (charHash[character.mother]) { relatedTo(charHash[character.mother], targetID, relIDs); } } - if(character.father !== 0) { - if(charHash[character.father]) { + if (character.father !== 0) { + if (charHash[character.father]) { relatedTo(charHash[character.father], targetID, relIDs); } } return relIDs; } - if(filterID) { - if(charHash[filterID]) { + if (filterID) { + if (charHash[filterID]) { var relIDs = relatedTo(charHash[filterID], filterID); - for(let k in relIDs.tree) { + for (let k in relIDs.tree) { related[k] = true; } - for(let i = 0; i < charList.length; i++) { - if(charHash[charList[i].ID]) { + for (let i = 0; i < charList.length; i++) { + if (charHash[charList[i].ID]) { var pRelIDs = relatedTo(charHash[charList[i].ID], filterID); - if(pRelIDs.related) { - for(let k in pRelIDs.tree) { + if (pRelIDs.related) { + for (let k in pRelIDs.tree) { related[k] = true; - if(saveTree[k]) { - for(let k2 in saveTree[k].tree) { + if (saveTree[k]) { + for (let k2 in saveTree[k].tree) { related[k2] = true; } } @@ -395,13 +394,13 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { } } - for(let i = 0; i < charList.length; i++) { + for (let i = 0; i < charList.length; i++) { let character = charList[i]; let char_id = character.ID; - if(character.mother === 0 && character.father === 0 && !kids[char_id]) { + if (character.mother === 0 && character.father === 0 && !kids[char_id]) { continue; } - if(filterID && !related[char_id]) { + if (filterID && !related[char_id]) { continue; } node_lookup[char_id] = family_graph.nodes.length; @@ -412,7 +411,7 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { unborn: !!unborn[char_id], vagina: character.vagina }; - if(kids[char_id]) { + if (kids[char_id]) { char_obj.is_mother = !!kids[char_id].mother; char_obj.is_father = !!kids[char_id].father; } else { @@ -422,24 +421,24 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { family_graph.nodes.push(char_obj); } - for(let i = 0; i < charList.length; i++) { + for (let i = 0; i < charList.length; i++) { let character = charList[i]; let char_id = character.ID; - if(character.mother === 0 && character.father === 0 && !kids[char_id]) { + if (character.mother === 0 && character.father === 0 && !kids[char_id]) { continue; } - if(filterID && !related[char_id]) { - if(related[character.mother]) { + if (filterID && !related[char_id]) { + if (related[character.mother]) { console.log('wtf, mom'); } - if(related[character.father]) { + if (related[character.father]) { console.log('wtf, dad'); } continue; } - if(typeof node_lookup[character.mother] !== 'undefined') { + if (typeof node_lookup[character.mother] !== 'undefined') { var ltype; - if(character.mother === character.father) { + if (character.mother === character.father) { ltype = 'homologous'; } else { ltype = 'maternal'; @@ -450,10 +449,10 @@ window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { source: node_lookup[character.mother]*1 }); } - if(character.mother === character.father) { + if (character.mother === character.father) { continue; } - if(typeof node_lookup[character.father] !== 'undefined') { + if (typeof node_lookup[character.father] !== 'undefined') { family_graph.links.push({ type: 'paternal', target: node_lookup[char_id]*1, @@ -487,7 +486,7 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS var numTreeNodes = 0; var graphElement = document.getElementById("graph"); - if(!graphElement) + if (!graphElement) return; graphElement.innerHTML = ""; @@ -497,17 +496,17 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS */ function getSlave(id, expectedGenes) { - if(id === -1) { + if (id === -1) { return {"slaveName": "YOU", "ID": id, "physicalAge": PC.physicalAge, "genes": PC.genes, "father": PC.father, "mother": PC.mother}; } - if(id === 0) { + if (id === 0) { return {"slaveName": "-", "ID": id, "genes": expectedGenes}; } - if(id === activeSlave.ID) { + if (id === activeSlave.ID) { return activeSlave; } - for(let i = 0; i < slaves.length; ++i) { - if(slaves[i].ID === id) + for (let i = 0; i < slaves.length; ++i) { + if (slaves[i].ID === id) return slaves[i]; } return {"slaveName": "-", "ID": id, "genes": expectedGenes}; @@ -516,23 +515,23 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS function slaveInfo(slave, activeSlaveId, recursionProtectSlaveId = {}) { numTreeNodes = 0; treeDepth = 0; - if(recursionProtectSlaveId[slave.ID]) { + if (recursionProtectSlaveId[slave.ID]) { console.log("Recursion protection"); return slaveInfo_(slave, activeSlaveId); } recursionProtectSlaveId[slave.ID] = true; - if(typeof slave.father === "undefined" || typeof slave.mother === "undefined") + if (typeof slave.father === "undefined" || typeof slave.mother === "undefined") return slaveInfo_(slave, activeSlaveId); - if(slave.father === -1 || slave.mother === -1) { + if (slave.father === -1 || slave.mother === -1) { return slaveInfo(getSlave(-1), activeSlaveId, recursionProtectSlaveId); } - if(slave.father !== 0) { + if (slave.father !== 0) { return slaveInfo(getSlave(slave.father, "unknownXY"), activeSlaveId, recursionProtectSlaveId); } - if(slave.mother !== 0) { + if (slave.mother !== 0) { return slaveInfo(getSlave(slave.mother, "unknownXX"), activeSlaveId, recursionProtectSlaveId); } return slaveInfo_(slave, activeSlaveId); @@ -541,7 +540,7 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS numTreeNodes += 1; treeDepth = Math.max(treeDepth, depth); var shouldAddChildren = false; - if(!slavesAdded[slave.ID]) { + if (!slavesAdded[slave.ID]) { shouldAddChildren = true; slavesAdded[slave.ID] = true; } @@ -555,33 +554,33 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS var spouseToChild = {}; function maybeAddSpouseToChild(child) { - if(child.ID === slave.ID) + if (child.ID === slave.ID) return; if (child.father === slave.ID) { - if(!spouseToChild[child.mother]) { + if (!spouseToChild[child.mother]) { spouseToChild[child.mother] = []; } spouseToChild[child.mother].push(child); } else if (child.mother === slave.ID) { - if(!spouseToChild[child.father]) { + if (!spouseToChild[child.father]) { spouseToChild[child.father] = []; } spouseToChild[child.father].push(child); } } - if(activeSlave.ID !== PC.ID) + if (activeSlave.ID !== PC.ID) maybeAddSpouseToChild(activeSlave); maybeAddSpouseToChild(getSlave(-1)); - for(let i = 0; i < slaves.length; ++i) { + for (let i = 0; i < slaves.length; ++i) { var child = slaves[i]; - if(child.ID !== activeSlave.ID) + if (child.ID !== activeSlave.ID) maybeAddSpouseToChild(child); } - for(let key in spouseToChild) { - if(spouseToChild.hasOwnProperty(key)) { + for (let key in spouseToChild) { + if (spouseToChild.hasOwnProperty(key)) { var children = shouldAddChildren?spouseToChild[key]:[]; var spouse = getSlave(key, (slaves.genes === "XX")?"unknownXY":(slaves.genes === "XY")?"unknownXX":"unknown"); var spouseName; @@ -608,7 +607,7 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS var parentWidth = document.getElementById('editFamily').offsetWidth; console.log(parentWidth, document.getElementById('passages').offsetWidth); - if(!parentWidth) + if (!parentWidth) parentWidth = document.body.offsetWidth - 483; console.log(parentWidth, Math.min(200 + 40*numTreeNodes, parentWidth-200) + 200); @@ -624,5 +623,4 @@ window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastS } } }); - };