diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 48f0c1e2cd4738d6beba35b65d37c371a057a776..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"; 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/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 } } }); - };