diff --git a/.eslintrc.json b/.eslintrc.json index c50f403a8694dd5fb40484aa72555416d00e013e..4adeef8d5a026073703a4206cd4721061d20e24c 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -35,14 +35,10 @@ "curly": ["warn", "all"], "eqeqeq": "warn", "no-fallthrough": "error", - "space-before-function-paren": ["warn", { - "anonymous": "always", - "named": "never", - "asyncArrow": "always" - }], + "space-before-function-paren": "off", "template-curly-spacing": ["warn", "never"], "no-trailing-spaces": "warn", - "no-unneeded-ternary": "warn", + "no-unneeded-ternary": ["warn", "never"], "camelcase": "warn", "padded-blocks": ["warn", "never"], "comma-spacing": "warn", diff --git a/src/art/vector/VectorArtJS.js b/src/art/vector/VectorArtJS.js index 5295d7e10723260e28f416d0ee354a07e32acc0b..3da76328829c64dffd0f46ba2d17538f9f5c38e3 100644 --- a/src/art/vector/VectorArtJS.js +++ b/src/art/vector/VectorArtJS.js @@ -1,4 +1,4 @@ -window.VectorArt = (function () { +window.VectorArt = (function() { "use strict"; let V, T, slave; let r; @@ -2679,7 +2679,7 @@ window.VectorArt = (function () { return VectorArt; })(); -window.LegacyVectorArt = function (slave, artSize) { +window.LegacyVectorArt = function(slave, artSize) { const filePath = "'resources/vector"; const skinFilePath = `${filePath}/body/white`; const wearingLatex = slave.clothes === "a Fuckdoll suit" || slave.clothes === "restrictive latex" || slave.clothes === "a latex catsuit"; diff --git a/src/interaction/main/mainLinks.js b/src/interaction/main/mainLinks.js index 80a9153ca67bbc43c82f6024ed878c23aa38fa9a..44b7f3aa8b25a34b582219646e681741c2d979e1 100644 --- a/src/interaction/main/mainLinks.js +++ b/src/interaction/main/mainLinks.js @@ -1,5 +1,5 @@ /* OPEN MAIN */ -App.UI.View.MainLinks = function () { +App.UI.View.MainLinks = function() { "use strict"; const V = State.variables; const PA = Array.isArray(V.personalAttention) ? V.personalAttention.map(x => getSlave(x.ID)) : []; diff --git a/src/js/DefaultRules.js b/src/js/DefaultRules.js index c94323529c1f644a6d2bd5da1cac1d911c4dd383..90ed3d4ce5e15732d65c95663fee18ee48d31239 100644 --- a/src/js/DefaultRules.js +++ b/src/js/DefaultRules.js @@ -1,6 +1,6 @@ // this code applies RA rules onto slaves -window.DefaultRules = (function () { +window.DefaultRules = (function() { "use strict"; let V; let r; @@ -1353,7 +1353,7 @@ window.DefaultRules = (function () { } } if (_priorities.length > 1) { - _priorities = _priorities.sort(function (a, b) { + _priorities = _priorities.sort(function(a, b) { if (a.weight > b.weight) { return -1; } diff --git a/src/js/PenthouseNaming.js b/src/js/PenthouseNaming.js index be28f776426218ea7209b71f8dc82cc34cd592e3..6e85f6ab59a4e61cc0f9708a1031132165704503 100644 --- a/src/js/PenthouseNaming.js +++ b/src/js/PenthouseNaming.js @@ -1,7 +1,7 @@ /** * @return {string} */ -window.MasterSuiteUIName = function () { +window.MasterSuiteUIName = function() { const V = State.variables; const name = (V.masterSuiteNameCaps === "The Master Suite") ? "Master Suite" : V.masterSuiteNameCaps; return `<<link "${name}""Master Suite">><</link>> `; @@ -10,7 +10,7 @@ window.MasterSuiteUIName = function () { /** * @return {string} */ -window.HeadGirlSuiteUIName = function () { +window.HeadGirlSuiteUIName = function() { const V = State.variables; const name = (V.HGSuiteNameCaps === "The Head Girl Suite") ? "Head Girl Suite" : V.HGSuiteNameCaps; return `<<link "${name}""Head Girl Suite">><</link>> `; @@ -19,7 +19,7 @@ window.HeadGirlSuiteUIName = function () { /** * @return {string} */ -window.ServantQuartersUIName = function () { +window.ServantQuartersUIName = function() { const V = State.variables; const name = (V.servantsQuartersNameCaps === "The Servants' Quarters") ? "Servants' Quarters" : V.servantsQuartersNameCaps; return `<<link "${name}""Servants' Quarters">><</link>> `; @@ -28,7 +28,7 @@ window.ServantQuartersUIName = function () { /** * @return {string} */ -window.SpaUIName = function () { +window.SpaUIName = function() { const V = State.variables; const name = (V.spaNameCaps === "The Spa") ? "Spa" : V.spaNameCaps; return `<<link "${name}""Spa">><</link>> `; @@ -37,7 +37,7 @@ window.SpaUIName = function () { /** * @return {string} */ -window.NurseryUIName = function () { +window.NurseryUIName = function() { const V = State.variables; const name = (V.nurseryNameCaps === "The Nursery") ? "Nursery" : V.nurseryNameCaps; return `<<link "${name}""Nursery">><</link>> `; @@ -46,7 +46,7 @@ window.NurseryUIName = function () { /** * @return {string} */ -window.ClinicUIName = function () { +window.ClinicUIName = function() { const V = State.variables; const name = (V.clinicNameCaps === "The Clinic") ? "Clinic" : V.clinicNameCaps; return `<<link "${name}""Clinic">><</link>> `; @@ -55,7 +55,7 @@ window.ClinicUIName = function () { /** * @return {string} */ -window.SchoolRoomUIName = function () { +window.SchoolRoomUIName = function() { const V = State.variables; const name = (V.schoolroomNameCaps === "The Schoolroom") ? "Schoolroom" : V.schoolroomNameCaps; return `<<link "${name}""Schoolroom">><</link>> `; @@ -64,7 +64,7 @@ window.SchoolRoomUIName = function () { /** * @return {string} */ -window.CellblockUIName = function () { +window.CellblockUIName = function() { const V = State.variables; const name = (V.cellblockNameCaps === "The Cellblock") ? "Cellblock" : V.cellblockNameCaps; return `<<link "${name}""Cellblock">><</link>> `; @@ -73,7 +73,7 @@ window.CellblockUIName = function () { /** * @return {string} */ -window.IncubatorUIName = function () { +window.IncubatorUIName = function() { const V = State.variables; const name = (V.incubatorNameCaps === "The Incubator") ? "Incubator" : V.incubatorNameCaps; return `<<link "${name}""Incubator">><</link>> `; diff --git a/src/js/accordianJS.js b/src/js/accordianJS.js index 6966eb5334aa456673d823d77bbe64ada3412516..f65b7d736a4efbe0f5d739b5043cea6e39cc8cb9 100644 --- a/src/js/accordianJS.js +++ b/src/js/accordianJS.js @@ -13,20 +13,20 @@ * 000-250-006 03092017 */ -postdisplay.doAccordionSet = function () { +postdisplay.doAccordionSet = function() { if (variables().useAccordion === 1) { Array.prototype.slice.call(document.querySelectorAll(".macro-include")) - .forEach(function (element) { + .forEach(function(element) { element.classList.add("accHidden"); }); } }; -postdisplay.doAccordion = function () { +postdisplay.doAccordion = function() { const acc = document.getElementsByClassName("accordion"); for (let i = 0; i < acc.length; i += 1) { - acc[i].onclick = function () { + acc[i].onclick = function() { this.classList.toggle("active"); let panel = this.nextElementSibling; if (panel === null || panel === undefined) { diff --git a/src/js/assayJS.js b/src/js/assayJS.js index 85d9c11a4b12d0918b17f5bb38e79d7b0117ef53..b0812a49b6eb28974c9fa0ad3191f1759c4676a2 100644 --- a/src/js/assayJS.js +++ b/src/js/assayJS.js @@ -389,7 +389,7 @@ App.Utils.Pronouns = class { * @param {App.Entity.SlaveState} slave * @returns {App.Utils.Pronouns} */ -window.getPronouns = function (slave) { +window.getPronouns = function(slave) { return new App.Utils.Pronouns(slave); }; diff --git a/src/js/assignJS.js b/src/js/assignJS.js index 8186e8b444608f61a79fa27de5632ad175f81db2..fdd0417c4aee4a02247b91aa47e3afcd19038761 100644 --- a/src/js/assignJS.js +++ b/src/js/assignJS.js @@ -303,7 +303,7 @@ window.assignJob = function assignJob(slave, job) { } if (slave.assignmentVisible === 0 && Array.isArray(V.personalAttention)) { - const awi = V.personalAttention.findIndex(function (s) { return s.ID === slave.ID; }); + const awi = V.personalAttention.findIndex(function(s) { return s.ID === slave.ID; }); if (awi !== -1) { V.personalAttention.deleteAt(awi); if (V.personalAttention.length === 0) { @@ -485,14 +485,14 @@ window.removeJob = function removeJob(slave, assignment) { case "be your agent": case "live with your agent": slave.assignment = "rest"; - const _leaderIndex = V.leaders.findIndex(function (x) { + const _leaderIndex = V.leaders.findIndex(function(x) { return x.ID === slave.ID; }); if (_leaderIndex !== -1) { V.leaders.deleteAt(_leaderIndex); } if (slave.relationshipTarget > 0) { /* following code assumes there can be at most one companion */ - const _lover = V.slaves.findIndex(function (s) { return haveRelationshipP(s, slave) && s.assignment === "live with your agent"; }); + const _lover = V.slaves.findIndex(function(s) { return haveRelationshipP(s, slave) && s.assignment === "live with your agent"; }); if (_lover !== -1) { V.slaves[_lover].assignment = "rest"; V.slaves[_lover].assignmentVisible = 1; @@ -533,7 +533,7 @@ window.resetJobIDArray = function resetJobIDArray() { "be a subordinate slave": [] }; - slaves.forEach(function (slave) { + slaves.forEach(function(slave) { if (JobIDArray.hasOwnProperty(slave.assignment)) { JobIDArray[slave.assignment].push(slave.ID); } }); @@ -543,7 +543,7 @@ window.resetJobIDArray = function resetJobIDArray() { /** * Generates string with links for changing slave assignment */ -App.UI.jobLinks = function () { +App.UI.jobLinks = function() { "use strict"; const facilitiesOrder = [ /* sorted by improvement before work, within improvement in order of progress, within work alphabetical for facilities*/ @@ -608,7 +608,7 @@ App.UI.jobLinks = function () { }(); App.UI.SlaveInteract = { - fucktoyPref: function () { + fucktoyPref: function() { let res = ""; /** @type {App.Entity.SlaveState} */ const slave = State.variables.activeSlave; @@ -639,7 +639,7 @@ App.UI.SlaveInteract = { App.UI.replace('#fucktoypref', res); }, - assignmentBlock: function (blockId) { + assignmentBlock: function(blockId) { let res = App.UI.jobLinks.assignments(-1, undefined, () => { return `<<replace "#assign">>$activeSlave.assignment<</replace>><<replace "#${blockId}">><<= App.UI.SlaveInteract.assignmentBlock("${blockId}")>><<= App.UI.SlaveInteract.fucktoyPref()>><</replace>>`; }); diff --git a/src/js/colorModeJS.js b/src/js/colorModeJS.js index bc6d8d7630af8ec4ae6847b68196c30d4bdd031d..3c495cdb5229aa5ffa74cd92fb3820adc9554b35 100644 --- a/src/js/colorModeJS.js +++ b/src/js/colorModeJS.js @@ -1,4 +1,4 @@ -window.flipColors = function (lightColorMap) { +window.flipColors = function(lightColorMap) { if (!window.savedColorMap) { window.savedColorMap = setColors(lightColorMap); } else { @@ -7,7 +7,7 @@ window.flipColors = function (lightColorMap) { } }; -window.setColors = function (colorMap) { +window.setColors = function(colorMap) { let originalState = []; let props = ["color", "backgroundColor", "backgroundImage"]; let styleSheetArray = Array.from(document.styleSheets); @@ -38,7 +38,7 @@ window.setColors = function (colorMap) { return originalState; }; -window.restoreColors = function (styleMap) { +window.restoreColors = function(styleMap) { styleMap.forEach( item => { item.element.style[item.propName] = item.value; diff --git a/src/js/colorinput.js b/src/js/colorinput.js index 9c51bb29e2990edbfc991db678959a480c11bcff..b97711b59ca92104febaa67be13e31c62d3f4ebc 100644 --- a/src/js/colorinput.js +++ b/src/js/colorinput.js @@ -1,5 +1,5 @@ Macro.add("colorinput", { - handler: function () { + handler: function() { if (this.args.length < 2) { let e = []; return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error("no " + e.join(" or ") + " specified"); @@ -48,7 +48,7 @@ Macro.add("colorinput", { value: value, tabindex: 0 }).addClass("macro-" + this.name) - .on("change", function () { + .on("change", function() { State.setVar(varName, this.value); // eslint-disable-next-line eqeqeq if (this.value != value) { // If the value has actually changed, reload the page. Note != and not !== because types might be different diff --git a/src/js/datatypeCleanupJS.js b/src/js/datatypeCleanupJS.js index bff8c9e6d81f2d21ba931a3d8536ad630c5d3ca1..0fcc266f1b98cae9238c5791aca57e66ea26e45e 100644 --- a/src/js/datatypeCleanupJS.js +++ b/src/js/datatypeCleanupJS.js @@ -5,7 +5,7 @@ * and in general pays no attention to the property values unless they need to be changed due * to the schema change. */ -App.Entity.Utils.SlaveDataSchemeCleanup = (function () { +App.Entity.Utils.SlaveDataSchemeCleanup = (function() { "use strict"; return SlaveDataSchemeCleanup; @@ -1641,7 +1641,7 @@ window.ArcologyDatatypeCleanup = function ArcologyDatatypeCleanup() { V.NUL.schoolProsperity = Math.clamp(+V.NUL.schoolProsperity, -10, 10) || 0; }; -window.FacilityDatatypeCleanup = (function () { +window.FacilityDatatypeCleanup = (function() { "use strict"; let V; return FacilityDatatypeCleanup; @@ -1737,7 +1737,7 @@ window.FacilityDatatypeCleanup = (function () { V.brothel = Math.max(+V.brothel, 0) || 0; V.brothelUpgradeDrugs = Math.clamp(+V.brothelUpgradeDrugs, 0, 2) || 0; /* madam */ - V.Madam = V.slaves.find(function (s) { + V.Madam = V.slaves.find(function(s) { return s.assignment === "be the Madam"; }) || 0; V.MadamIgnoresFlaws = Math.clamp(+V.MadamIgnoresFlaws, 0, 1) || 0; @@ -1769,7 +1769,7 @@ window.FacilityDatatypeCleanup = (function () { V.bioreactorsXY = Math.max(+V.bioreactorsXY, 0) || 0; V.bioreactorsBarren = Math.max(+V.bioreactorsBarren, 0) || 0; /* milkmaid */ - V.Milkmaid = V.slaves.find(function (s) { + V.Milkmaid = V.slaves.find(function(s) { return s.assignment === "be the Milkmaid"; }) || 0; V.milkmaidImpregnates = Math.clamp(+V.milkmaidImpregnates, 0, 1) || 0; @@ -1780,7 +1780,7 @@ window.FacilityDatatypeCleanup = (function () { V.farmyardBreeding = Math.clamp(+V.farmyardBreeding, 0, 1) || 0; V.farmyardShows = Math.clamp(+V.farmyardShows, 0, 1) || 0; /* farmer */ - V.Farmer = V.slaves.find(function (s) { + V.Farmer = V.slaves.find(function(s) { return s.assignment === "be the Farmer"; }) || 0; } @@ -1798,7 +1798,7 @@ window.FacilityDatatypeCleanup = (function () { V.club = Math.max(+V.club, 0) || 0; V.clubUpgradePDAs = Math.clamp(+V.clubUpgradePDAs, 0, 1) || 0; /* madam */ - V.DJ = V.slaves.find(function (s) { + V.DJ = V.slaves.find(function(s) { return s.assignment === "be the DJ"; }) || 0; V.DJignoresFlaws = Math.clamp(+V.DJignoresFlaws, 0, 1) || 0; @@ -1809,7 +1809,7 @@ window.FacilityDatatypeCleanup = (function () { V.servantsQuarters = Math.max(+V.servantsQuarters, 0) || 0; V.servantsQuartersUpgradeMonitoring = Math.clamp(+V.servantsQuartersUpgradeMonitoring, 0, 1) || 0; /* stewardess */ - V.Stewardess = V.slaves.find(function (s) { + V.Stewardess = V.slaves.find(function(s) { return s.assignment === "be the Stewardess"; }) || 0; V.stewardessImpregnates = Math.clamp(+V.stewardessImpregnates, 0, 1) || 0; @@ -1822,7 +1822,7 @@ window.FacilityDatatypeCleanup = (function () { V.schoolroomUpgradeLanguage = Math.clamp(+V.schoolroomUpgradeLanguage, 0, 1) || 0; V.schoolroomUpgradeRemedial = Math.clamp(+V.schoolroomUpgradeRemedial, 0, 1) || 0; /* schoolteacher */ - V.Schoolteacher = V.slaves.find(function (s) { + V.Schoolteacher = V.slaves.find(function(s) { return s.assignment === "be the Schoolteacher"; }) || 0; } @@ -1832,7 +1832,7 @@ window.FacilityDatatypeCleanup = (function () { V.spa = Math.max(+V.spa, 0) || 0; V.spaUpgrade = Math.clamp(+V.spaUpgrade, 0, 1) || 0; /* attendant */ - V.Attendant = V.slaves.find(function (s) { + V.Attendant = V.slaves.find(function(s) { return s.assignment === "be the Attendant"; }) || 0; V.spaFix = Math.clamp(+V.spaFix, 0, 2) || 0; @@ -1847,7 +1847,7 @@ window.FacilityDatatypeCleanup = (function () { V.clinicInflateBelly = Math.clamp(+V.clinicInflateBelly, 0, 1) || 0; V.clinicSpeedGestation = Math.clamp(+V.clinicSpeedGestation, 0, 1) || 0; /* nurse */ - V.Nurse = V.slaves.find(function (s) { + V.Nurse = V.slaves.find(function(s) { return s.assignment === "be the Nurse"; }) || 0; } @@ -1866,7 +1866,7 @@ window.FacilityDatatypeCleanup = (function () { V.cellblock = Math.max(+V.cellblock, 0) || 0; V.cellblockUpgrade = Math.clamp(+V.cellblockUpgrade, 0, 1) || 0; /* wardeness */ - V.Wardeness = V.slaves.find(function (s) { + V.Wardeness = V.slaves.find(function(s) { return s.assignment === "be the Wardeness"; }) || 0; V.cellblockWardenCumsInside = Math.clamp(+V.cellblockWardenCumsInside, 0, 1) || 0; @@ -1882,14 +1882,14 @@ window.FacilityDatatypeCleanup = (function () { V.masterSuitePregnancyFertilityDrugs = Math.clamp(+V.masterSuitePregnancyFertilityDrugs, 0, 1) || 0; V.masterSuiteHyperPregnancy = Math.clamp(+V.masterSuiteHyperPregnancy, 0, 1) || 0; /* concubine */ - V.Concubine = V.slaves.find(function (s) { + V.Concubine = V.slaves.find(function(s) { return s.assignment === "be your Concubine"; }) || 0; } function HeadGirlSuiteDatatypeCleanup() { /* headgirl */ - V.HeadGirl = V.slaves.find(function (s) { + V.HeadGirl = V.slaves.find(function(s) { return s.assignment === "be your Head Girl"; }) || 0; V.HGSuiteEquality = Math.clamp(+V.HGSuiteEquality, 0, 1) || 0; @@ -1912,7 +1912,7 @@ window.FacilityDatatypeCleanup = (function () { * It removes all the unneeded properties for the gene pool attributes. * @todo remove after refactoring the slave state class */ -App.Entity.Utils.GenePoolRecordCleanup = (function () { +App.Entity.Utils.GenePoolRecordCleanup = (function() { "use strict"; return GenePoolRecordCleanup; diff --git a/src/js/descriptionWidgets.js b/src/js/descriptionWidgets.js index 8596e4991c05f9beef0a7bf100603c5e827e995d..547281a596198880e966b85b5bf328b70813cef1 100644 --- a/src/js/descriptionWidgets.js +++ b/src/js/descriptionWidgets.js @@ -2,7 +2,7 @@ * @param {App.Entity.SlaveState} slave * @return {string} Slave's eyes */ -App.Desc.eyes = function (slave) { +App.Desc.eyes = function(slave) { "use strict"; const V = State.variables; let r = ``; @@ -247,7 +247,7 @@ App.Desc.eyes = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {string} Slave's eye color */ -App.Desc.eyeColor = function (slave) { +App.Desc.eyeColor = function(slave) { "use strict"; let r; @@ -265,7 +265,7 @@ App.Desc.eyeColor = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {string} Slave's age and health */ -App.Desc.ageAndHealth = function (slave) { +App.Desc.ageAndHealth = function(slave) { "use strict"; const V = State.variables; let r = ``; @@ -572,7 +572,7 @@ App.Desc.ageAndHealth = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {string} Slave's brand */ -App.Desc.brand = function (slave) { +App.Desc.brand = function(slave) { "use strict"; let r = ``; let bellyAccessory; @@ -603,7 +603,7 @@ App.Desc.brand = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {string} Description of slave's amputation, if present */ -App.Desc.amputee = function (slave) { +App.Desc.amputee = function(slave) { "use strict"; let r = ``; /* eslint-disable */ @@ -642,7 +642,7 @@ App.Desc.amputee = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {string} Description of slave's waist */ -App.Desc.waist = function (slave) { +App.Desc.waist = function(slave) { "use strict"; const V = State.variables; let r = ``; diff --git a/src/js/economyJS.js b/src/js/economyJS.js index fadcbea2760ab3fee39eb5166e6e157fc5bdd7db..56df0d3ff6874c551a49f057fc9ecd36f32e95d0 100644 --- a/src/js/economyJS.js +++ b/src/js/economyJS.js @@ -38,7 +38,7 @@ window.PersonalAttention = Object.freeze({ HACKING: 'hacking' }); -window.calculateCosts = (function () { +window.calculateCosts = (function() { return { predict: predictCost, bill: getCost, @@ -548,7 +548,7 @@ window.calculateCosts = (function () { } })(); -window.getSlaveCost = function (s) { +window.getSlaveCost = function(s) { if (!s) { return 0; } @@ -871,7 +871,7 @@ window.getSlaveCost = function (s) { // Supply and Demand for slaves (linear, simple) // PC buying slaves reduces supply, selling slaves reduces demand. -window.menialSlaveCost = function (q) { +window.menialSlaveCost = function(q) { if (!q) { q = 0; } @@ -882,7 +882,7 @@ window.menialSlaveCost = function (q) { return (Math.trunc(baseCost + demand / 400 - supply / 400 + q / 400) + random); }; -window.NPCSexSupply = function (LC) { +window.NPCSexSupply = function(LC) { const V = State.variables; const NPCSexSupply = {lowerClass: V.NPCSexSupply.lowerClass}; @@ -900,7 +900,7 @@ window.NPCSexSupply = function (LC) { }; // The function for calculating and storing a slave's sexual interaction with citizens/'the outside' -window.slaveJobValues = function () { +window.slaveJobValues = function() { const V = State.variables; const slaveJobValues = {arcade: 0, club: 0, clubSP: 0}; let clubSpots = 0; const toTheClubTotal = 0; let DJRepBonus = 0; V.slavesGettingHelp = 0; @@ -1227,7 +1227,7 @@ window.slaveJobValues = function () { // Corporation Value -window.corpValue = function () { +window.corpValue = function() { const V = State.variables; if (V.corpIncorporated === 0) { return 0; @@ -1278,7 +1278,7 @@ window.corpValue = function () { // Corporation Share Price // A positive q means adding shares to the market, negative means removing them -window.corpSharePrice = function (q = 0) { +window.corpSharePrice = function(q = 0) { const V = State.variables; if (V.corpIncorporated === 0) { return 0; @@ -1290,7 +1290,7 @@ window.corpSharePrice = function (q = 0) { // The amount of additional slaves you can fit in a division // Can we condense this? -window.corpDivBreakSlavesRoom = function () { +window.corpDivBreakSlavesRoom = function() { const V = State.variables; if (V.corpDivBreak === 1 && V.corpDivBreakDev > V.corpDivBreakSlaves) { return V.corpDivBreakDev - V.corpDivBreakSlaves; @@ -1298,7 +1298,7 @@ window.corpDivBreakSlavesRoom = function () { return 0; }; -window.corpDivSurgerySlavesRoom = function () { +window.corpDivSurgerySlavesRoom = function() { const V = State.variables; if (V.corpDivSurgery === 1 && V.corpDivSurgeryDev > V.corpDivSurgerySlaves) { return V.corpDivSurgeryDev - V.corpDivSurgerySlaves; @@ -1306,7 +1306,7 @@ window.corpDivSurgerySlavesRoom = function () { return 0; }; -window.corpDivTrainSlavesRoom = function () { +window.corpDivTrainSlavesRoom = function() { const V = State.variables; if (V.corpDivTrain === 1 && V.corpDivTrainDev > V.corpDivTrainSlaves) { return V.corpDivTrainDev - V.corpDivTrainSlaves; @@ -1314,7 +1314,7 @@ window.corpDivTrainSlavesRoom = function () { return 0; }; -window.corpDivArcadeSlavesRoom = function () { +window.corpDivArcadeSlavesRoom = function() { const V = State.variables; if (V.corpDivArcade === 1 && V.corpDivArcadeDev > V.corpDivArcadeSlaves) { return V.corpDivArcadeDev - V.corpDivArcadeSlaves; @@ -1322,7 +1322,7 @@ window.corpDivArcadeSlavesRoom = function () { return 0; }; -window.corpDivMenialSlavesRoom = function () { +window.corpDivMenialSlavesRoom = function() { const V = State.variables; if (V.corpDivMenial === 1 && V.corpDivMenialDev > V.corpDivMenialSlaves) { return V.corpDivMenialDev - V.corpDivMenialSlaves; @@ -1330,7 +1330,7 @@ window.corpDivMenialSlavesRoom = function () { return 0; }; -window.corpDivDairySlavesRoom = function () { +window.corpDivDairySlavesRoom = function() { const V = State.variables; if (V.corpDivDairy === 1 && V.corpDivDairyDev > V.corpDivDairySlaves) { return V.corpDivDairyDev - V.corpDivDairySlaves; @@ -1338,7 +1338,7 @@ window.corpDivDairySlavesRoom = function () { return 0; }; -window.corpDivWhoreSlavesRoom = function () { +window.corpDivWhoreSlavesRoom = function() { const V = State.variables; if (V.corpDivWhore === 1 && V.corpDivWhoreDev > V.corpDivWhoreSlaves) { return V.corpDivWhoreDev - V.corpDivWhoreSlaves; @@ -1348,7 +1348,7 @@ window.corpDivWhoreSlavesRoom = function () { // Corporation race blacklisting/whitelisting // race is the lowercase string representing the race, 'blacklist' is either 1 or 0. 1 means we are blacklisting and 0 means we are whitelisting said race -window.corpBlacklistRace = function (race, blacklist) { +window.corpBlacklistRace = function(race, blacklist) { let raceArray = State.variables.corpSpecRaces; if (raceArray.length > 0 && blacklist === 1) { raceArray.delete(race); @@ -1360,7 +1360,7 @@ window.corpBlacklistRace = function (race, blacklist) { return raceArray; }; -window.getSlaveStatisticData = function (s, facility) { +window.getSlaveStatisticData = function(s, facility) { if (!s || !facility) { // Base data, even without facility return { @@ -1399,7 +1399,7 @@ window.getSlaveStatisticData = function (s, facility) { return data; }; -window.initFacilityStatistics = function (facility = {}) { +window.initFacilityStatistics = function(facility = {}) { facility.adsIncome = 0; facility.maintenance = 0; facility.totalIncome = 0; @@ -1435,7 +1435,7 @@ A full list of categories (slaveMod, slaveTransfer, event) are in the widget "se The third category, the "slave slot" is completely optional. Sometimes you just want to spend money by yourself. */ -window.cashX = function (cost, what, who) { +window.cashX = function(cost, what, who) { const V = State.variables; if (!Number.isFinite(cost)) { @@ -1483,7 +1483,7 @@ window.cashX = function (cost, what, who) { return cost; }; -window.repX = function (rep, what, who) { +window.repX = function(rep, what, who) { const V = State.variables; if (!Number.isFinite(rep)) { @@ -1543,10 +1543,10 @@ window.repX = function (rep, what, who) { return rep; }; -window.forceNeg = function (x) { +window.forceNeg = function(x) { return -Math.abs(x); }; -Number.prototype.toFixedHTML = function () { +Number.prototype.toFixedHTML = function() { return num(Number.prototype.toFixed.apply(this, arguments)).replace(/\.0+$/, '<span style="opacity: 0.3">$&</span>'); }; diff --git a/src/js/eventSelectionJS.js b/src/js/eventSelectionJS.js index cc6db6096771e2020b0b74643bc1aca982269e37..bb9d91a2f3f676c44c97405d66e06b84d089efdc 100644 --- a/src/js/eventSelectionJS.js +++ b/src/js/eventSelectionJS.js @@ -1,4 +1,4 @@ -window.generateRandomEventPoolStandard = function (eventSlave) { +window.generateRandomEventPoolStandard = function(eventSlave) { /* STANDARD EVENTS */ if (eventSlave.fetish !== "mindbroken") { @@ -225,7 +225,7 @@ window.generateRandomEventPoolStandard = function (eventSlave) { } if (eventSlave.relationship > 3) { - let relationshipSlave = State.variables.slaves.find(function (s) { + let relationshipSlave = State.variables.slaves.find(function(s) { return s.ID === eventSlave.relationshipTarget; }); if (relationshipSlave.devotion > 20) { @@ -1865,7 +1865,7 @@ window.generateRandomEventPoolStandard = function (eventSlave) { }; /* servants spend a lot of time in the penthouse, so should be eligible for a number (but not all) random events */ -window.generateRandomEventPoolServant = function (eventSlave) { +window.generateRandomEventPoolServant = function(eventSlave) { /* STANDARD EVENTS */ if (eventSlave.fetish !== "mindbroken") { @@ -1956,7 +1956,7 @@ window.generateRandomEventPoolServant = function (eventSlave) { } if (eventSlave.relationship > 3) { - let relationshipSlave = State.variables.slaves.find(function (s) { + let relationshipSlave = State.variables.slaves.find(function(s) { return s.ID === eventSlave.relationshipTarget; }); if (relationshipSlave.devotion > 20) { @@ -2970,7 +2970,7 @@ window.generateRandomEventPoolServant = function (eventSlave) { } }; -window.populateEventArray = function (RESS = State.variables.RESSevent.length, RESSTR = State.variables.RESSTRevent.length, RETS = State.variables.RETSevent.length, RECI = State.variables.RECIevent.length) { +window.populateEventArray = function(RESS = State.variables.RESSevent.length, RESSTR = State.variables.RESSTRevent.length, RETS = State.variables.RETSevent.length, RECI = State.variables.RECIevent.length) { /* EVENT RANDOMIZATION */ let events = State.variables.events; let i = 0; diff --git a/src/js/extendedFamilyModeJS.js b/src/js/extendedFamilyModeJS.js index ee51652283afc806186aff2235cd0dc1242ec6d0..a040b9f2f9ebfeac1828758cdc634ac7f2c572eb 100644 --- a/src/js/extendedFamilyModeJS.js +++ b/src/js/extendedFamilyModeJS.js @@ -12,14 +12,14 @@ window.isParentP = function isParentP(daughter, parent) { return isMotherP(daughter, parent) || isFatherP(daughter, parent); }; -window.sameDad = function (slave1, slave2) { +window.sameDad = function(slave1, slave2) { if ((slave1.father === slave2.father) && (slave1.father !== 0 && slave1.father !== -2)) { return true; } return false; }; -window.sameMom = function (slave1, slave2) { +window.sameMom = function(slave1, slave2) { if ((slave1.mother === slave2.mother) && (slave1.mother !== 0 && slave1.mother !== -2)) { return true; } @@ -31,7 +31,7 @@ window.sameMom = function (slave1, slave2) { * @param {App.Entity.SlaveState} aunt * @returns {boolean} */ -window.isAunt = function (niece, aunt) { +window.isAunt = function(niece, aunt) { if (!State.variables.showDistantRelatives) { return false; } @@ -53,7 +53,7 @@ window.isAunt = function (niece, aunt) { }; // testtest catches the case if a mother is a father or a father a mother - thank you familyAnon, for this code -window.sameTParent = function (slave1, slave2) { +window.sameTParent = function(slave1, slave2) { if (slave1.mother === -1 && slave1.father === -1 && slave2.mother === -1 && slave2.father === -1) { return 1; } else if (slave1.mother === slave2.father && slave1.father === slave2.mother && slave1.mother !== 0 && slave1.mother !== -2 && slave1.father !== 0 && slave1.father !== -2 && slave1.mother !== slave1.father) { @@ -74,7 +74,7 @@ window.sameTParent = function(slave1, slave2) { }; */ -window.areTwins = function (slave1, slave2) { +window.areTwins = function(slave1, slave2) { if (!sameDad(slave1, slave2)) { return false; } else if (!sameMom(slave1, slave2)) { @@ -85,7 +85,7 @@ window.areTwins = function (slave1, slave2) { return false; }; -window.areSisters = function (slave1, slave2) { +window.areSisters = function(slave1, slave2) { if (slave1.ID === slave2.ID) { return 0; // you are not your own sister } else if (((slave1.father === 0) || (slave1.father === -2)) && ((slave1.mother === 0) || (slave1.mother === -2))) { @@ -139,7 +139,7 @@ window.areSisters = function(c1, c2) { * @param {App.Entity.SlaveState} slave2 * @returns {boolean} */ -window.areCousins = function (slave1, slave2) { +window.areCousins = function(slave1, slave2) { if (!State.variables.showDistantRelatives) { return false; } @@ -172,7 +172,7 @@ window.areCousins = function (slave1, slave2) { * @returns {boolean} */ window.areRelated = - function (slave1, slave2) { + function(slave1, slave2) { return (slave1.father === slave2.ID || slave1.mother === slave2.ID || slave2.father === slave1.ID || slave2.mother === slave1.ID || areSisters(slave1, slave2) > 0); }; @@ -180,7 +180,7 @@ window.areRelated = * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.totalRelatives = function (slave) { +window.totalRelatives = function(slave) { let relatives = 0; if (slave.mother > 0) { relatives += 1; @@ -203,8 +203,8 @@ window.totalRelatives = function (slave) { * @param {App.Entity.SlaveState[]} slaves * @returns {Array} // I think */ -window.mutualChildren = function (slave1, slave2, slaves) { - return slaves.filter(function (s) { +window.mutualChildren = function(slave1, slave2, slaves) { + return slaves.filter(function(s) { return s.ID !== slave1.ID && s.ID !== slave2.ID && s.mother > 0 && s.father > 0 && ((s.mother === slave1.ID && s.father === slave2.ID) || (s.mother === slave2.ID && s.father === slave1.ID)); }).length; }; @@ -213,7 +213,7 @@ window.mutualChildren = function (slave1, slave2, slaves) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isSlaveAvailable = function (slave) { +window.isSlaveAvailable = function(slave) { if (!slave) { return null; } else if (slave.assignment === "be your agent") { @@ -241,18 +241,18 @@ window.randomRelatedSlave = function(slave, filterFunction) { * @param {function} filterFunction // I think * @returns {object} // I think */ -window.randomRelatedSlave = function (slave, filterFunction) { +window.randomRelatedSlave = function(slave, filterFunction) { if (!slave || !SugarCube) { return undefined; } if (typeof filterFunction !== 'function') { - filterFunction = function ( /* s, index, array*/ ) { + filterFunction = function( /* s, index, array*/ ) { return true; }; } const arr = State.variables.slaves.filter(filterFunction); arr.shuffle(); - return arr.find(function (s) { + return arr.find(function(s) { return areSisters(slave, s) || slave.ID === s.mother || slave.ID === s.father || @@ -265,8 +265,8 @@ window.randomRelatedSlave = function (slave, filterFunction) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomRelatedAvailableSlave = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomRelatedAvailableSlave = function(slave) { + return randomRelatedSlave(slave, function(s) { return isSlaveAvailable(s); }); }; @@ -275,8 +275,8 @@ window.randomRelatedAvailableSlave = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomSister = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomSister = function(slave) { + return randomRelatedSlave(slave, function(s) { return areSisters(slave, s); }); }; @@ -285,8 +285,8 @@ window.randomSister = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomTwinSister = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomTwinSister = function(slave) { + return randomRelatedSlave(slave, function(s) { return areSisters(slave, s); }); }; @@ -295,8 +295,8 @@ window.randomTwinSister = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomAvailableSister = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomAvailableSister = function(slave) { + return randomRelatedSlave(slave, function(s) { return isSlaveAvailable(s) && areSisters(slave, s); }); }; @@ -305,8 +305,8 @@ window.randomAvailableSister = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomAvailableTwinSister = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomAvailableTwinSister = function(slave) { + return randomRelatedSlave(slave, function(s) { return isSlaveAvailable(s) && areSisters(slave, s); }); }; @@ -315,8 +315,8 @@ window.randomAvailableTwinSister = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomDaughter = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomDaughter = function(slave) { + return randomRelatedSlave(slave, function(s) { return s.mother === slave.ID || s.father === slave.ID; }); }; @@ -325,8 +325,8 @@ window.randomDaughter = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomAvailableDaughter = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomAvailableDaughter = function(slave) { + return randomRelatedSlave(slave, function(s) { return isSlaveAvailable(s) && (s.mother === slave.ID || s.father === slave.ID); }); }; @@ -335,8 +335,8 @@ window.randomAvailableDaughter = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomParent = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomParent = function(slave) { + return randomRelatedSlave(slave, function(s) { return s.ID === slave.mother || s.ID === slave.father; }); }; @@ -345,13 +345,13 @@ window.randomParent = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {object} */ -window.randomAvailableParent = function (slave) { - return randomRelatedSlave(slave, function (s) { +window.randomAvailableParent = function(slave) { + return randomRelatedSlave(slave, function(s) { return isSlaveAvailable(s) && (s.ID === slave.mother || s.ID === slave.father); }); }; -window.totalPlayerRelatives = function (pc) { +window.totalPlayerRelatives = function(pc) { let relatives = 0; if (pc.mother > 0) { relatives += 1; @@ -374,7 +374,7 @@ window.totalPlayerRelatives = function (pc) { * @returns {string} */ window.relativeTerm = - function (slave1, slave2) { + function(slave1, slave2) { if (slave2.mother === slave1.ID || slave2.father === slave1.ID) { if (slave2.genes === "XY" && State.variables.diversePronouns) { return "son"; diff --git a/src/js/familyTreeJS.js b/src/js/familyTreeJS.js index 9242fda805790680f141f9c72241c7e9423f39d1..e98c46fb3a0f1ff4dd04fa54dd86775a890eed5a 100644 --- a/src/js/familyTreeJS.js +++ b/src/js/familyTreeJS.js @@ -16,7 +16,7 @@ let lastActiveSlave, lastSlaves, lastPC; */ -window.renderFamilyTree = function (slaves, filterID) { +window.renderFamilyTree = function(slaves, filterID) { 'use strict'; let ftreeWidth, ftreeHeight; @@ -81,11 +81,11 @@ window.renderFamilyTree = function (slaves, filterID) { function runFtreeSim(data) { let simulation = d3.forceSimulation() - .force('link', d3.forceLink().id(function (d) { + .force('link', d3.forceLink().id(function(d) { return d.index; })) // eslint-disable-next-line no-unused-vars - .force('collide', d3.forceCollide(function (d) { + .force('collide', d3.forceCollide(function(d) { return 60; }).iterations(4)) .force('charge', d3.forceManyBody().strength(-200).distanceMin(100).distanceMax(1000)) @@ -100,7 +100,7 @@ window.renderFamilyTree = function (slaves, filterID) { .enter() .append('line') .attr('marker-end', 'url(#arrowhead)') - .attr('stroke', function (d) { + .attr('stroke', function(d) { if (d.type === 'homologous') { return '#862d59'; } else if (d.type === 'paternal') { @@ -122,8 +122,8 @@ window.renderFamilyTree = function (slaves, filterID) { .on('end', dragended)); node.append('circle') - .attr('r', function (d) { return d.r; }) - .attr('stroke', function (d) { + .attr('r', function(d) { return d.r; }) + .attr('stroke', function(d) { if (d.ID === filterID) { return '#ffff20'; } else { @@ -134,7 +134,7 @@ window.renderFamilyTree = function (slaves, filterID) { .attr('r', 20); node.append('text') - .text(function (d) { + .text(function(d) { let ssym; if (d.ID === -1) { if (d.dick === 1 && d.vagina === 1) { @@ -156,11 +156,11 @@ window.renderFamilyTree = function (slaves, filterID) { return `${d.name}(${ssym})`; }) .attr('dy', 4) - .attr('dx', function (d) { + .attr('dx', function(d) { return -(8 * d.name.length) / 2; }) .attr('class', 'node-text') - .style('fill', function (d) { + .style('fill', function(d) { if (d.is_mother && d.is_father) { return '#b84dff'; } else if (d.is_father) { @@ -177,15 +177,15 @@ window.renderFamilyTree = function (slaves, filterID) { svg.selectAll('.node-circle'); svg.selectAll('.node-text'); - let ticked = function () { + let ticked = function() { link - .attr('x1', function (d) { return d.source.x; }) - .attr('y1', function (d) { return d.source.y; }) - .attr('x2', function (d) { return d.target.x; }) - .attr('y2', function (d) { return d.target.y; }); + .attr('x1', function(d) { return d.source.x; }) + .attr('y1', function(d) { return d.source.y; }) + .attr('x2', function(d) { return d.target.x; }) + .attr('y2', function(d) { return d.target.y; }); node - .attr("transform", function (d) { return `translate(${d.x}, ${d.y})`; }); + .attr("transform", function(d) { return `translate(${d.x}, ${d.y})`; }); }; simulation.nodes(data.nodes) @@ -213,7 +213,7 @@ window.renderFamilyTree = function (slaves, filterID) { } }; -window.buildFamilyTree = function (slaves = State.variables.slaves, filterID) { +window.buildFamilyTree = function(slaves = State.variables.slaves, filterID) { let family_graph = {nodes: [], links: []}; let node_lookup = {}; let preset_lookup = { @@ -528,7 +528,7 @@ If there's no active slave, you can do: <<run updateFamilyTree(null, $slaves, $PC)>> */ -window.updateFamilyTree = function (activeSlave = lastActiveSlave, slaves = lastSlaves, PC = lastPC) { +window.updateFamilyTree = function(activeSlave = lastActiveSlave, slaves = lastSlaves, PC = lastPC) { lastActiveSlave = activeSlave; lastSlaves = slaves; lastPC = PC; @@ -647,7 +647,7 @@ window.updateFamilyTree = function (activeSlave = lastActiveSlave, slaves = last } let marriage = { "spouse": {"name": spouseName, "class": spouse.genes}, - "children": children.map(function (x) { return slaveInfo_(x, activeSlaveId, slavesAdded, depth + 1); }), + "children": children.map(function(x) { return slaveInfo_(x, activeSlaveId, slavesAdded, depth + 1); }), }; data.marriages.push(marriage); } @@ -674,7 +674,7 @@ window.updateFamilyTree = function (activeSlave = lastActiveSlave, slaves = last width: Math.min(200 + 40 * numTreeNodes, parentWidth - 200) + 200, callbacks: { - nodeClick: function ( /* name, extra*/ ) {} + nodeClick: function( /* name, extra*/ ) {} } }); }; diff --git a/src/js/food.js b/src/js/food.js index 1cac0324215a51afe31c4c356923912097847f7c..d92bffb1bb4642ba02958506a08e09c5fede630c 100644 --- a/src/js/food.js +++ b/src/js/food.js @@ -2,7 +2,7 @@ * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.foodAmount = function (slave) { +window.foodAmount = function(slave) { const V = State.variables; let food = 400; // kg / food produced by base slave / week if (!slave) { @@ -61,7 +61,7 @@ window.foodAmount = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.farmShowsIncome = function (slave) { +window.farmShowsIncome = function(slave) { // TODO: incorporate farmyardRestraints const V = State.variables; let arcology = V.arcologies[0]; diff --git a/src/js/futureSocietyJS.js b/src/js/futureSocietyJS.js index be256308b2ae5892bf416d63871f545ba856b4e8..03dc2cdece4d59e73b6cfd65b988ab89aa830a1f 100644 --- a/src/js/futureSocietyJS.js +++ b/src/js/futureSocietyJS.js @@ -1,4 +1,4 @@ -window.FutureSocieties = (function () { +window.FutureSocieties = (function() { "use strict"; const FSString2Property = { // blame Hedonism and Eugenics for this Supremacist: "FSSupremacist", diff --git a/src/js/generateGenetics.js b/src/js/generateGenetics.js index 82a5099fec0c49bf18b0a89222e018a14e306fa7..9af3ce923a7b07dcc80b3a742b8c7f317384725d 100644 --- a/src/js/generateGenetics.js +++ b/src/js/generateGenetics.js @@ -1,6 +1,6 @@ // Generates a child's genetics based off mother and father and returns it as an object to be attached to an ovum -window.generateGenetics = (function () { +window.generateGenetics = (function() { "use strict"; let genes; let mother; @@ -37,7 +37,7 @@ window.generateGenetics = (function () { geneticQuirks: 0 }; if (actor1.ID > 0) { - mother = V.genePool.find(function (s) { + mother = V.genePool.find(function(s) { return s.ID === actor1.ID; }); if (mother === undefined) { @@ -52,7 +52,7 @@ window.generateGenetics = (function () { mother = V.PC; } if (actor2 > 0) { - father = V.genePool.find(function (s) { + father = V.genePool.find(function(s) { return s.ID === actor2; }); activeFather = V.slaves[V.slaveIndices[actor2]]; @@ -62,7 +62,7 @@ window.generateGenetics = (function () { } if (father === undefined) { if (V.incubator > 0) { - father = V.tanks.find(function (s) { + father = V.tanks.find(function(s) { return s.ID === actor2; }); activeFather = 0; // activeFather = father? @@ -70,7 +70,7 @@ window.generateGenetics = (function () { } if (father === undefined) { if (V.nursery > 0) { - father = V.cribs.find(function (s) { + father = V.cribs.find(function(s) { return s.ID === actor2; }); activeFather = 0; // activeFather = father? @@ -1087,7 +1087,7 @@ window.generateGenetics = (function () { return generateGenetics; })(); -window.generateChild = function (mother, ova, destination) { +window.generateChild = function(mother, ova, destination) { let V = State.variables; let genes = ova.genetics; // maybe just argument this? We'll see. let pregUpgrade = V.pregnancyMonitoringUpgrade; diff --git a/src/js/generateNewSlaveJS.js b/src/js/generateNewSlaveJS.js index ae3a48c710724e4e1acde82003b695ba114b4853..e09b3b93bc8be739ace39a6678137c8dcc2d4444 100644 --- a/src/js/generateNewSlaveJS.js +++ b/src/js/generateNewSlaveJS.js @@ -1,5 +1,5 @@ /* eslint-disable camelcase */ -window.GenerateNewSlave = (function () { +window.GenerateNewSlave = (function() { "use strict"; let V; let chance; diff --git a/src/js/heroCreator.js b/src/js/heroCreator.js index 1338cb7826ff09fbeb28121bb96a27396d9e44f8..1200dc10bd31b2393952563c997c3e0f336eb2fa 100644 --- a/src/js/heroCreator.js +++ b/src/js/heroCreator.js @@ -3,7 +3,7 @@ * @param {App.Entity.SlaveState} baseHeroSlave * @return {App.Entity.SlaveState} */ -App.Utils.getHeroSlave = function (heroSlave, baseHeroSlave) { +App.Utils.getHeroSlave = function(heroSlave, baseHeroSlave) { function isObject(o) { return (o !== undefined && typeof o === 'object' && !Array.isArray(o)); } diff --git a/src/js/itemAvailability.js b/src/js/itemAvailability.js index a94668cbd415b3db397abf97eb5ceeb30c4e64b1..a01fbbe24229a0b404327c8dc670197722ebcba7 100644 --- a/src/js/itemAvailability.js +++ b/src/js/itemAvailability.js @@ -5,7 +5,7 @@ * @param {string} string Name of the item * @returns {boolean} */ -window.isItemAccessible = function (string) { +window.isItemAccessible = function(string) { const V = State.variables; if (V.cheatMode === 1) { diff --git a/src/js/nurseryWidgets.js b/src/js/nurseryWidgets.js index 322252ede7a6ee55e68b461f3ba701689bfe97ff..235a44b457e369530a22b2ad2161f2b8f3705044 100644 --- a/src/js/nurseryWidgets.js +++ b/src/js/nurseryWidgets.js @@ -1,4 +1,4 @@ -App.Facilities.Nursery.ChildSummary = function (child) { +App.Facilities.Nursery.ChildSummary = function(child) { const V = State.variables; let r = ``; r += `${child} will stay in ${V.nurseryName} for another ${child.weeksLeft} weeks. `; diff --git a/src/js/pregJS.js b/src/js/pregJS.js index 343ec2e9446887372c7d912089869d01caa1777f..f8f08951944368009bbb0b66608e9a1c32895360 100644 --- a/src/js/pregJS.js +++ b/src/js/pregJS.js @@ -1,5 +1,5 @@ /* Major props to the anons who worked together to forge the Super Pregnancy Project. Let your legacy go unforgotten.*/ -window.getPregBellySize = function (s) { +window.getPregBellySize = function(s) { let targetLen; let gestastionWeek = s.preg; let fetuses = s.pregType; @@ -21,7 +21,7 @@ window.getPregBellySize = function (s) { * @param {App.Entity.SlaveState} slave * @returns {string} */ -window.bellyAdjective = function (slave) { +window.bellyAdjective = function(slave) { if (slave.belly >= 1500) { if (slave.belly >= 1000000) { if (slave.preg > slave.pregData.normalBirth/4) { @@ -62,7 +62,7 @@ window.bellyAdjective = function (slave) { }; /* calculates and returns expected ovum count during conception*/ -window.setPregType = function (actor) { +window.setPregType = function(actor) { /* IMHO rework is possible. Can be more interesting to play, if this code will take in account more body conditions - age, fat, food, hormone levels, etc. */ let ovum = jsRandom(actor.pregData.normalOvaMin, actor.pregData.normalOvaMax); // for default human profile it's always 1. @@ -394,7 +394,7 @@ window.setPregType = function (actor) { fatherID is the ID of her sire or 0 if undefined. displayOverride is an override if defined - fatherID must be defined in this case. */ -window.knockMeUp = function (target, chance, hole, fatherID, displayOverride) { +window.knockMeUp = function(target, chance, hole, fatherID, displayOverride) { const V = State.variables; let pronouns; let He; @@ -474,29 +474,29 @@ window.knockMeUp = function (target, chance, hole, fatherID, displayOverride) { return r; }; -window.getIncubatorReserved = function (/* slaves */) { +window.getIncubatorReserved = function(/* slaves */) { return FetusGlobalReserveCount("incubator"); }; -window.getNurseryReserved = function (/* slaves */) { +window.getNurseryReserved = function(/* slaves */) { return FetusGlobalReserveCount("nursery"); }; -window.findFather = function (fatherID) { +window.findFather = function(fatherID) { let father; let V = State.variables; father = V.slaves[V.slaveIndices[fatherID]]; if (father === undefined) { if (V.incubator > 0) { - father = V.tanks.find(function (s) { + father = V.tanks.find(function(s) { return s.ID === fatherID; }); } } if (father === undefined) { if (V.nursery > 0) { - father = V.cribs.find(function (s) { + father = V.cribs.find(function(s) { return s.ID === fatherID; }); } @@ -505,7 +505,7 @@ window.findFather = function (fatherID) { return father; }; -window.adjustFatherProperty = function (actor, property, newValue) { +window.adjustFatherProperty = function(actor, property, newValue) { let father = findFather(actor.ID); if (father) { father[property] = newValue; } }; @@ -540,6 +540,6 @@ window.adjustFatherProperty = function(actor, property, newValue) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.getBaseBoobs = function (slave) { +window.getBaseBoobs = function(slave) { return slave.boobs - slave.boobsImplant - slave.boobsMilk - slave.boobsWombVolume; }; diff --git a/src/js/quickListJS.js b/src/js/quickListJS.js index 8ac22f3e4c859dbdd3731ec668ec01de73d915d8..27fe34eed16eabb291a8b9a4fe1a9dfb792d7c9c 100644 --- a/src/js/quickListJS.js +++ b/src/js/quickListJS.js @@ -1,4 +1,4 @@ -window.sortDomObjects = function (objects, attrName, reverse = 0) { +window.sortDomObjects = function(objects, attrName, reverse = 0) { reverse = (reverse) ? -1 : 1; function sortingByAttr(a, b) { @@ -15,22 +15,22 @@ window.sortDomObjects = function (objects, attrName, reverse = 0) { return objects.toArray().sort(sortingByAttr); }; -window.sortButtonsByDevotion = function () { +window.sortButtonsByDevotion = function() { let $sortedButtons = $('#qlWrapper button').remove(); $sortedButtons = sortDomObjects($sortedButtons, 'data-devotion'); $($sortedButtons).appendTo($('#qlWrapper')); quickListBuildLinks(); }; -window.sortButtonsByTrust = function () { +window.sortButtonsByTrust = function() { let $sortedButtons = $('#qlWrapper button').remove(); $sortedButtons = sortDomObjects($sortedButtons, 'data-trust'); $($sortedButtons).appendTo($('#qlWrapper')); quickListBuildLinks(); }; -window.quickListBuildLinks = function () { - $("[data-scroll-to]").click(function () { +window.quickListBuildLinks = function() { + $("[data-scroll-to]").click(function() { let $this = $(this), $toElement = $this.attr('data-scroll-to'); // note the * 1 enforces $offset to be an integer, without @@ -44,31 +44,31 @@ window.quickListBuildLinks = function () { }); }; -window.sortIncubatorPossiblesByName = function () { +window.sortIncubatorPossiblesByName = function() { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-name'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPregnancyWeek = function () { +window.sortIncubatorPossiblesByPregnancyWeek = function() { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-week'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPregnancyCount = function () { +window.sortIncubatorPossiblesByPregnancyCount = function() { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-preg-count'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByReservedSpots = function () { +window.sortIncubatorPossiblesByReservedSpots = function() { let $sortedIncubatorPossibles = $('#qlIncubator div.possible').detach(); $sortedIncubatorPossibles = sortDomObjects($sortedIncubatorPossibles, 'data-reserved-spots'); $($sortedIncubatorPossibles).appendTo($('#qlIncubator')); }; -window.sortIncubatorPossiblesByPreviousSort = function () { +window.sortIncubatorPossiblesByPreviousSort = function() { let sort = State.variables.sortIncubatorList; if ('unsorted' !== sort) { if ('Name' === sort) { @@ -83,31 +83,31 @@ window.sortIncubatorPossiblesByPreviousSort = function () { } }; -window.sortNurseryPossiblesByName = function () { +window.sortNurseryPossiblesByName = function() { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-name'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPregnancyWeek = function () { +window.sortNurseryPossiblesByPregnancyWeek = function() { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-preg-week'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPregnancyCount = function () { +window.sortNurseryPossiblesByPregnancyCount = function() { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-preg-count'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByReservedSpots = function () { +window.sortNurseryPossiblesByReservedSpots = function() { let $sortedNurseryPossibles = $('#qlNursery div.possible').detach(); $sortedNurseryPossibles = sortDomObjects($sortedNurseryPossibles, 'data-reserved-spots'); $($sortedNurseryPossibles).appendTo($('#qlNursery')); }; -window.sortNurseryPossiblesByPreviousSort = function () { +window.sortNurseryPossiblesByPreviousSort = function() { let sort = State.variables.sortNurseryList; if ('unsorted' !== sort) { if ('Name' === sort) { diff --git a/src/js/rbuttonJS.js b/src/js/rbuttonJS.js index bceb15c6a9a9dec2bd0a7a5fb67ff997b98463b7..2f2df1d7ca5b21c6f159e1b82f9d82935ec337f0 100644 --- a/src/js/rbuttonJS.js +++ b/src/js/rbuttonJS.js @@ -65,7 +65,7 @@ Macro.add('rbutton', { tabindex: 0 // for accessibility }) .addClass(`macro-${this.name}`) - .on('change', function () { + .on('change', function() { if (this.checked) { Wikifier.setValue(varName, checkValue); @@ -78,7 +78,7 @@ Macro.add('rbutton', { } } }) - .ready(function () { + .ready(function() { // alert ("DOM finished"); if (el.checked && replaceID.length > 0 && replaceText.length > 0) { let replaceEl = document.getElementById(replaceID); diff --git a/src/js/relationshipChecks.js b/src/js/relationshipChecks.js index d1f94be6636fd1ac5d27b6a5fff4047fea196909..79e936e38a450cbaf9aeecb6e9d1dd9d34cf0dcd 100644 --- a/src/js/relationshipChecks.js +++ b/src/js/relationshipChecks.js @@ -2,7 +2,7 @@ * @param {{ rivalry: number; }} id * @returns {string} */ -window.rivalryTerm = function (id) { +window.rivalryTerm = function(id) { if (id.rivalry === 1) { return "growing rival"; } else if (id.rivalry === 2) { @@ -16,7 +16,7 @@ window.rivalryTerm = function (id) { * @param {{ relationship: number; }} id * @returns {string} */ -window.relationshipTerm = function (id) { +window.relationshipTerm = function(id) { if (id.relationship === 1) { return "friend"; } else if (id.relationship === 2) { @@ -34,7 +34,7 @@ window.relationshipTerm = function (id) { * @param {{ relationship: number; }} id * @returns {string} */ -window.relationshipTermShort = function (id) { +window.relationshipTermShort = function(id) { if (id.relationship === 1) { return "friend"; } else if (id.relationship === 2) { diff --git a/src/js/removeActiveSlave.js b/src/js/removeActiveSlave.js index d07be0a9658e3c963785c8049b769baa07f502df..c93d9435f7e2d9602c5dd62ab5319fe1201382ed 100644 --- a/src/js/removeActiveSlave.js +++ b/src/js/removeActiveSlave.js @@ -125,7 +125,7 @@ window.removeActiveSlave = function removeActiveSlave() { } if (Array.isArray(V.personalAttention)) { - const _rasi = V.personalAttention.findIndex(function (s) { return s.ID === AS_ID; }); + const _rasi = V.personalAttention.findIndex(function(s) { return s.ID === AS_ID; }); if (_rasi !== -1) { V.personalAttention.deleteAt(_rasi); if (V.personalAttention.length === 0) { @@ -195,7 +195,7 @@ window.removeActiveSlave = function removeActiveSlave() { } } - const _geneIndex = V.genePool.findIndex(function (s) { return s.ID === AS_ID; }); + const _geneIndex = V.genePool.findIndex(function(s) { return s.ID === AS_ID; }); if (_geneIndex !== -1) { let keep = false; if (V.traitor !== 0) { @@ -335,7 +335,7 @@ window.removeNonNGPSlave = function removeNonNGPSlave(removedSlave) { } }); - const _geneIndex = V.genePool.findIndex(function (s) { return s.ID === ID; }); + const _geneIndex = V.genePool.findIndex(function(s) { return s.ID === ID; }); if (_geneIndex !== -1) { let keep = false; if (isImpregnatedBy(V.PC, removedSlave)) { diff --git a/src/js/rulesAssistant.js b/src/js/rulesAssistant.js index 6b754d63534761aa4186bc78509011f76d78a82f..58dc828578e9ac4ddd2acfdba52ce7b310e6e7df 100644 --- a/src/js/rulesAssistant.js +++ b/src/js/rulesAssistant.js @@ -3,7 +3,7 @@ * @param {Object[]} rules * @returns {boolean} */ -window.hasSurgeryRule = function (slave, rules) { +window.hasSurgeryRule = function(slave, rules) { return rules.some( rule => ruleApplied(slave, rule) && rule.set.autoSurgery > 0); }; @@ -14,7 +14,7 @@ window.hasSurgeryRule = function (slave, rules) { * @param {string} what * @returns {boolean} */ -window.hasRuleFor = function (slave, rules, what) { +window.hasRuleFor = function(slave, rules, what) { return rules.some( rule => ruleApplied(slave, rule) && rule[what] !== "no default setting"); }; @@ -24,7 +24,7 @@ window.hasRuleFor = function (slave, rules, what) { * @param {Object[]} rules * @returns {boolean} */ -window.hasHColorRule = function (slave, rules) { +window.hasHColorRule = function(slave, rules) { return hasRuleFor(slave, rules, "hColor"); }; @@ -33,7 +33,7 @@ window.hasHColorRule = function (slave, rules) { * @param {Object[]} rules * @returns {boolean} * */ -window.hasHStyleRule = function (slave, rules) { +window.hasHStyleRule = function(slave, rules) { return hasRuleFor(slave, rules, "hStyle"); }; @@ -42,7 +42,7 @@ window.hasHStyleRule = function (slave, rules) { * @param {Object[]} rules * @returns {boolean} * */ -window.hasEyeColorRule = function (slave, rules) { +window.hasEyeColorRule = function(slave, rules) { return hasRuleFor(slave, rules, "eyeColor"); }; @@ -52,7 +52,7 @@ window.hasEyeColorRule = function (slave, rules) { * @param {Object[]} rules * @returns {boolean} */ -window.lastPregRule = function (slave, rules) { +window.lastPregRule = function(slave, rules) { return rules.some(rule => ruleApplied(slave, rule) && rule.set.preg === -1); }; @@ -85,7 +85,7 @@ window.mergeRules = function mergeRules(rules) { * @param {Object} rule * @returns {boolean} */ -window.ruleApplied = function (slave, rule) { +window.ruleApplied = function(slave, rule) { return slave.currentRules.includes(rule.ID); }; diff --git a/src/js/sexActsJS.js b/src/js/sexActsJS.js index 9ab9ceb09db484068c9f03b966dfce641835a5ab..a04a0817d6449180a81dcc98e5d47255e456eab1 100644 --- a/src/js/sexActsJS.js +++ b/src/js/sexActsJS.js @@ -1,4 +1,4 @@ -window.VCheck = (function () { +window.VCheck = (function() { "use strict"; let he; let him; diff --git a/src/js/slaveCostJS.js b/src/js/slaveCostJS.js index 0f956cd8966c7d86f64896f165a74d5e61f715a4..c89b7152d08a934f15d1fa0f4149b92b9d826495 100644 --- a/src/js/slaveCostJS.js +++ b/src/js/slaveCostJS.js @@ -1,4 +1,4 @@ -window.Beauty = (function () { +window.Beauty = (function() { "use strict"; let V; let arcology; @@ -1411,7 +1411,7 @@ window.Beauty = (function () { // it has been wrapped in a closure so as not to pollute the global namespace // and so that nested functions are only evaluated once -window.FResult = (function () { +window.FResult = (function() { "use strict"; // we can't initialize our global variables on load, because SugarCube.State isn't initialized // instead, declare them and initialize on run time @@ -1810,7 +1810,7 @@ window.FResult = (function () { return FResult; })(); -window.slaveCost = (function () { +window.slaveCost = (function() { "use strict"; let V; let arcology; diff --git a/src/js/slaveGenerationJS.js b/src/js/slaveGenerationJS.js index 5bb707929cbc3e32a843a4936587acd03d7cfdb2..653092227d1c7488268fe8a0f3252247d0800815 100644 --- a/src/js/slaveGenerationJS.js +++ b/src/js/slaveGenerationJS.js @@ -1532,7 +1532,7 @@ window.generatePronouns = function generatePronouns(slave) { /** * @param {App.Entity.SlaveState} slave */ -window.generatePuberty = function (slave) { +window.generatePuberty = function(slave) { if ((slave.ovaries === 1 || slave.mpreg === 1) && slave.physicalAge >= slave.pubertyAgeXX) { slave.pubertyXX = 1; } else { @@ -1548,7 +1548,7 @@ window.generatePuberty = function (slave) { /** * @param {App.Entity.SlaveState} slave */ -window.ageImplantAdjustment = function (slave) { +window.ageImplantAdjustment = function(slave) { if (slave.visualAge > 80) { slave.visualAge -= 40; } else if (slave.visualAge >= 70) { diff --git a/src/js/slaveListing.js b/src/js/slaveListing.js index 5999925f34908ca684dd3cb0ac5ece0faeaf8fb3..e74dab4987ff84d9398813b46fb3dd839e2186f7 100644 --- a/src/js/slaveListing.js +++ b/src/js/slaveListing.js @@ -13,7 +13,7 @@ App.UI.SlaveList = {}; * @param {number} index * @return {string} */ -App.UI.SlaveList.render = function () { +App.UI.SlaveList.render = function() { 'use strict'; let V; /** @type {string} */ @@ -75,8 +75,8 @@ App.UI.SlaveList.render = function () { res.push(`<div id="slave_${slave.ID}" style="clear:both">${rejectString}</div>`); } - $(document).one(':passagedisplay', function () { - $('[data-quick-index]').unbind().click(function () { + $(document).one(':passagedisplay', function() { + $('[data-quick-index]').unbind().click(function() { let which = this.attributes["data-quick-index"].value; let quick = $("div#list_index" + which); quick.toggleClass("hidden"); @@ -326,7 +326,7 @@ App.UI.SlaveList.SlaveInteract.retrieve = (slave, index) => * Adds/removes a slave with the given id to/from the personal attention array * @param {number} id slave id */ -App.UI.selectSlaveForPersonalAttention = function (id) { +App.UI.selectSlaveForPersonalAttention = function(id) { const V = State.variables; if (!Array.isArray(V.personalAttention)) { @@ -336,7 +336,7 @@ App.UI.selectSlaveForPersonalAttention = function (id) { trainingRegimen: "undecided" }]; } else { - const _pai = V.personalAttention.findIndex(function (s) { + const _pai = V.personalAttention.findIndex(function(s) { return s.ID === id; }); if (_pai === -1) { @@ -362,7 +362,7 @@ App.UI.selectSlaveForPersonalAttention = function (id) { * @param {string} passage The passage to link to * @returns {string} */ -App.UI.SlaveList.sortingLinks = function (passage) { +App.UI.SlaveList.sortingLinks = function(passage) { const V = State.variables; let r = ' Sort by: '; r += ["devotion", "name", "assignment", "seniority", "actualAge", "visualAge", "physicalAge"] @@ -385,7 +385,7 @@ App.UI.SlaveList.sortingLinks = function (passage) { * @param {{assign: string, remove: string, transfer: (string| undefined)}} [tabCaptions] * @returns {string} */ -App.UI.SlaveList.listSJFacilitySlaves = function (facility, facilityPassage, showTransfersTab = false, tabCaptions = undefined) { +App.UI.SlaveList.listSJFacilitySlaves = function(facility, facilityPassage, showTransfersTab = false, tabCaptions = undefined) { const V = State.variables; facilityPassage = facilityPassage || passage(); tabCaptions = tabCaptions || { @@ -463,7 +463,7 @@ App.UI.SlaveList.listSJFacilitySlaves = function (facility, facilityPassage, sho /** * @returns {string} */ -App.UI.SlaveList.listNGPSlaves = function () { +App.UI.SlaveList.listNGPSlaves = function() { const V = State.variables; const thisPassage = 'New Game Plus'; let r = this.sortingLinks(thisPassage) + '<br>'; @@ -507,7 +507,7 @@ App.UI.SlaveList.listNGPSlaves = function () { * @param {string} [selectionPassage] passage name for manager selection. "${Manager} Select" if omitted * @returns {string} */ -App.UI.SlaveList.displayManager = function (facility, selectionPassage) { +App.UI.SlaveList.displayManager = function(facility, selectionPassage) { const managerCapName = capFirstChar(facility.desc.manager.position); selectionPassage = selectionPassage || `${managerCapName} Select`; const manager = facility.manager.currentEmployee; @@ -526,11 +526,11 @@ App.UI.SlaveList.displayManager = function (facility, selectionPassage) { * @param {boolean} [showTransfersPage] * @returns {string} */ -App.UI.SlaveList.stdFacilityPage = function (facility, showTransfersPage) { +App.UI.SlaveList.stdFacilityPage = function(facility, showTransfersPage) { return this.displayManager(facility) + '<br><br>' + this.listSJFacilitySlaves(facility, passage(), showTransfersPage); }; -App.UI.SlaveList.penthousePage = function () { +App.UI.SlaveList.penthousePage = function() { const V = State.variables; const ph = App.Entity.facilities.penthouse; const listElementId = 'summarylist'; // for the untabbed mode only @@ -783,7 +783,7 @@ App.UI.SlaveList.penthousePage = function () { * @returns {boolean} */ -App.UI.SlaveList.slaveSelectionList = function () { +App.UI.SlaveList.slaveSelectionList = function() { const selectionElementId = "slaveSelectionList"; return selection; @@ -915,7 +915,7 @@ App.UI.SlaveList.slaveSelectionList = function () { * @param {string} [passage] one of the *Workaround passages. Will be composed from the position name if omitted * @returns {string} */ -App.UI.SlaveList.facilityManagerSelection = function (facility, passage) { +App.UI.SlaveList.facilityManagerSelection = function(facility, passage) { passage = passage || capFirstChar(facility.manager.desc.position) + " Workaround"; return this.slaveSelectionList(slave => facility.manager.canEmploy(slave), (slave, index) => App.UI.passageLink(SlaveFullName(slave), passage, `$i = ${index}`), diff --git a/src/js/slaveStatsChecker.js b/src/js/slaveStatsChecker.js index 905d4f8bd54f621d037ba1ce660a413c28180391..1c0b9811c4792d75120f8e2116ce271cfb98d0c6 100644 --- a/src/js/slaveStatsChecker.js +++ b/src/js/slaveStatsChecker.js @@ -1,4 +1,4 @@ -window.SlaveStatsChecker = (function () { +window.SlaveStatsChecker = (function() { return { checkForLisp: hasLisp, isModded: isModded, @@ -177,7 +177,7 @@ window.SlaveStatsChecker = (function () { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isSlim = function (slave) { +window.isSlim = function(slave) { let slim = false; const ArcologyZero = State.variables.arcologies[0]; @@ -209,7 +209,7 @@ window.isSlim = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.slimPass = function (slave) { +window.slimPass = function(slave) { let slimPass = 0; const ArcologyZero = State.variables.arcologies[0]; @@ -238,7 +238,7 @@ window.slimPass = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isStacked = function (slave) { +window.isStacked = function(slave) { return (slave.butt > 4) && (slave.boobs > 800); }; @@ -246,7 +246,7 @@ window.isStacked = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isXY = function (slave) { +window.isXY = function(slave) { return (slave.dick > 0); }; @@ -254,7 +254,7 @@ window.isXY = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isYoung = function (slave) { +window.isYoung = function(slave) { return (slave.visualAge < 30); }; @@ -262,7 +262,7 @@ window.isYoung = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isPreg = function (slave) { +window.isPreg = function(slave) { return ((slave.bellyPreg >= 5000) || (slave.bellyImplant >= 5000)); }; @@ -270,7 +270,7 @@ window.isPreg = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isNotPreg = function (slave) { +window.isNotPreg = function(slave) { return (!isPreg(slave) && (slave.belly < 100) && (slave.weight < 30) && !setup.fakeBellies.includes(slave.bellyAccessory)); }; @@ -278,7 +278,7 @@ window.isNotPreg = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isPure = function (slave) { +window.isPure = function(slave) { return ((slave.boobsImplant === 0) && (slave.buttImplant === 0) && (slave.waist >= -95) && (slave.lipsImplant === 0) && (slave.faceImplant < 30) && (slave.bellyImplant === -1) && (Math.abs(slave.shouldersImplant) < 2) && (Math.abs(slave.hipsImplant) < 2)); }; @@ -286,7 +286,7 @@ window.isPure = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isSurgicallyImproved = function (slave) { +window.isSurgicallyImproved = function(slave) { return ((slave.boobsImplant > 0) && (slave.buttImplant > 0) && (slave.waist < -10) && (slave.lipsImplant > 0)); }; @@ -294,7 +294,7 @@ window.isSurgicallyImproved = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isFullyPotent = function (slave) { +window.isFullyPotent = function(slave) { if (!slave) { return null; } else if (slave.dick > 0 && slave.balls > 0 && slave.ballType !== "sterile" && slave.hormoneBalance < 100 && slave.drugs !== "hormone blockers") { @@ -307,7 +307,7 @@ window.isFullyPotent = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canGetPregnant = function (slave) { +window.canGetPregnant = function(slave) { if (!slave) { return null; } else if (slave.preg === -1) { /* contraceptives check */ @@ -327,7 +327,7 @@ window.canGetPregnant = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isFertile = function (slave) { +window.isFertile = function(slave) { if (!slave) { return null; } @@ -375,7 +375,7 @@ window.isFertile = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canAchieveErection = function (slave) { +window.canAchieveErection = function(slave) { if (!slave) { return null; } else if (slave.dick <= 0) { @@ -400,7 +400,7 @@ window.canAchieveErection = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canPenetrate = function (slave) { +window.canPenetrate = function(slave) { if (!slave) { return null; } else if (!canAchieveErection(slave)) { @@ -417,7 +417,7 @@ window.canPenetrate = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canSee = function (slave) { +window.canSee = function(slave) { if (!slave) { return null; } @@ -428,7 +428,7 @@ window.canSee = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canHear = function (slave) { +window.canHear = function(slave) { if (!slave) { return null; } @@ -439,7 +439,7 @@ window.canHear = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canSmell = function (slave) { +window.canSmell = function(slave) { if (!slave) { return null; } @@ -450,7 +450,7 @@ window.canSmell = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canTaste = function (slave) { +window.canTaste = function(slave) { if (!slave) { return null; } @@ -461,7 +461,7 @@ window.canTaste = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canWalk = function (slave) { +window.canWalk = function(slave) { if (!slave) { return null; } else if (slave.amp === 1) { @@ -494,7 +494,7 @@ window.canWalk = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canTalk = function (slave) { +window.canTalk = function(slave) { if (!slave) { return null; } else if (slave.accent > 2) { @@ -519,7 +519,7 @@ window.canTalk = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canDoAnal = function (slave) { +window.canDoAnal = function(slave) { if (!slave) { return null; } else if (slave.chastityAnus === 1) { @@ -532,7 +532,7 @@ window.canDoAnal = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.canDoVaginal = function (slave) { +window.canDoVaginal = function(slave) { if (!slave) { return null; } else if (slave.vagina < 0) { @@ -547,7 +547,7 @@ window.canDoVaginal = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooFatSlave = function (slave) { +window.tooFatSlave = function(slave) { if (!slave) { return null; } else if (slave.weight > 190 + (slave.muscles / 5) && slave.physicalAge >= 18) { @@ -566,7 +566,7 @@ window.tooFatSlave = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBreasts = function (slave) { +window.tooBigBreasts = function(slave) { if (!slave) { return null; } else if (slave.boobs > 30000 + (slave.muscles * 100) && slave.physicalAge >= 18) { @@ -585,7 +585,7 @@ window.tooBigBreasts = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBelly = function (slave) { +window.tooBigBelly = function(slave) { if (!slave) { return null; } else if (slave.belly >= 450000 + (slave.muscles * 2000) && slave.physicalAge >= 18) { @@ -604,7 +604,7 @@ window.tooBigBelly = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigBalls = function (slave) { +window.tooBigBalls = function(slave) { if (!slave) { return null; } else if (slave.balls >= 30 + (slave.muscles * .3) && slave.physicalAge <= 3) { @@ -621,7 +621,7 @@ window.tooBigBalls = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigDick = function (slave) { +window.tooBigDick = function(slave) { if (!slave) { return null; } else if (slave.dick >= 20 + (slave.muscles * .1) && slave.physicalAge <= 3 && slave.dick !== 0) { @@ -638,7 +638,7 @@ window.tooBigDick = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.tooBigButt = function (slave) { +window.tooBigButt = function(slave) { if (!slave) { return null; } else if (slave.butt > 10 && slave.physicalAge <= 3) { @@ -653,7 +653,7 @@ window.tooBigButt = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.isVegetable = function (slave) { +window.isVegetable = function(slave) { if (!slave) { return false; } diff --git a/src/js/slaveSummaryWidgets.js b/src/js/slaveSummaryWidgets.js index 5e3f282e337d5a714663e115b09ed1ff42874573..d09a60f2585af5878e826d80b837641fa6e085ef 100644 --- a/src/js/slaveSummaryWidgets.js +++ b/src/js/slaveSummaryWidgets.js @@ -28,7 +28,7 @@ window.SlaveSummary = function SlaveSummary(slave) { return SlaveSummaryUncached(slave); }; -window.SlaveSummaryUncached = (function () { +window.SlaveSummaryUncached = (function() { "use strict"; let V; let r; @@ -4004,7 +4004,7 @@ window.SlaveSummaryUncached = (function () { function short_extended_family(slave) { let handled = 0; if (slave.mother > 0) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.mother; }); if (_ssj !== -1) { @@ -4030,7 +4030,7 @@ window.SlaveSummaryUncached = (function () { r += `${V.missingTable[slave.mother].fullName}'s daughter `; } if (slave.father > 0 && slave.father !== slave.mother) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.father; }); if (_ssj !== -1) { @@ -4056,7 +4056,7 @@ window.SlaveSummaryUncached = (function () { r += `${V.missingTable[slave.father].fullName}'s daughter`; } if (slave.daughters === 1) { - let _ssj = V.slaves.findIndex(function (s) { + let _ssj = V.slaves.findIndex(function(s) { return s.mother === slave.ID; }); if (_ssj !== -1) { @@ -4068,7 +4068,7 @@ window.SlaveSummaryUncached = (function () { } } r += " "; - _ssj = V.slaves.findIndex(function (s) { + _ssj = V.slaves.findIndex(function(s) { return s.father === slave.ID; }); if (_ssj !== -1) { @@ -4084,7 +4084,7 @@ window.SlaveSummaryUncached = (function () { r += `multiple daughters `; } if (slave.sisters === 1) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return areSisters(s, slave) > 0; }); if (_ssj !== -1) { @@ -4100,7 +4100,7 @@ window.SlaveSummaryUncached = (function () { r += `multiple sisters `; } if (slave.relationship > 0 && handled !== 1) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.relationshipTarget; }); if (_ssj !== -1) { @@ -4123,7 +4123,7 @@ window.SlaveSummaryUncached = (function () { */ function short_legacy_family(slave) { if (slave.relation !== 0) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.relationTarget; }); if (_ssj !== -1) { @@ -4131,7 +4131,7 @@ window.SlaveSummaryUncached = (function () { } } if (slave.relationship > 0) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.relationshipTarget; }); if (_ssj !== -1) { @@ -4167,7 +4167,7 @@ window.SlaveSummaryUncached = (function () { function short_rival(slave) { if (slave.rivalry !== 0) { r += ` `; - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.rivalryTarget; }); if (_ssj !== -1) { @@ -4190,7 +4190,7 @@ window.SlaveSummaryUncached = (function () { function long_extended_family(slave) { let handled = 0; if (slave.mother > 0) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.mother; }); if (_ssj !== -1) { @@ -4217,7 +4217,7 @@ window.SlaveSummaryUncached = (function () { r += `${V.missingTable[slave.mother].fullName}'s <span class="lightgreen">daughter.</span> `; } if (slave.father > 0 && slave.father !== slave.mother) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.father; }); if (_ssj !== -1) { @@ -4244,7 +4244,7 @@ window.SlaveSummaryUncached = (function () { r += `${V.missingTable[slave.father].fullName}'s <span class="lightgreen">daughter.</span> `; } if (slave.daughters === 1) { - let _ssj = V.slaves.findIndex(function (s) { + let _ssj = V.slaves.findIndex(function(s) { return s.mother === slave.ID; }); if (_ssj !== -1) { @@ -4256,7 +4256,7 @@ window.SlaveSummaryUncached = (function () { } r += `.</span> `; } - _ssj = V.slaves.findIndex(function (s) { + _ssj = V.slaves.findIndex(function(s) { return s.father === slave.ID; }); if (_ssj !== -1) { @@ -4278,7 +4278,7 @@ window.SlaveSummaryUncached = (function () { } } if (slave.sisters === 1) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return areSisters(s, slave) > 0; }); if (_ssj !== -1) { @@ -4300,7 +4300,7 @@ window.SlaveSummaryUncached = (function () { } } if (slave.relationship > 0 && handled !== 1) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.relationshipTarget; }); if (_ssj !== -1) { @@ -4322,7 +4322,7 @@ window.SlaveSummaryUncached = (function () { */ function long_legacy_family(slave) { if (slave.relation !== 0) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.relationTarget; }); if (_ssj !== -1) { @@ -4338,7 +4338,7 @@ window.SlaveSummaryUncached = (function () { } } if (slave.relationship > 0) { - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.relationshipTarget; }); if (_ssj !== -1) { @@ -4374,7 +4374,7 @@ window.SlaveSummaryUncached = (function () { function long_rival(slave) { if (slave.rivalry !== 0) { r += ` `; - const _ssj = V.slaves.findIndex(function (s) { + const _ssj = V.slaves.findIndex(function(s) { return s.ID === slave.rivalryTarget; }); if (_ssj !== -1) { diff --git a/src/js/storyJS.js b/src/js/storyJS.js index a58bc99bbe522b7a4e5f52977ff827be403c3447..18530af669e3933fc1b3dc666909212040e0a26a 100644 --- a/src/js/storyJS.js +++ b/src/js/storyJS.js @@ -8,7 +8,7 @@ * @param {number} maxValue * @returns {number} */ -window.variableAsNumber = function (x, defaultValue = 0, minValue, maxValue) { +window.variableAsNumber = function(x, defaultValue = 0, minValue, maxValue) { x = Number(x); if (isNaN(x)) { return defaultValue; @@ -26,7 +26,7 @@ window.variableAsNumber = function (x, defaultValue = 0, minValue, maxValue) { * @param {App.Entity.SlaveState} slave * @return {boolean} */ -window.isSexuallyPure = function (slave) { +window.isSexuallyPure = function(slave) { if (!slave) { return null; } @@ -34,7 +34,7 @@ window.isSexuallyPure = function (slave) { }; if (typeof interpolate === "undefined") { - const interpolate = function (x0, y0, x1, y1, x) { + const interpolate = function(x0, y0, x1, y1, x) { if (x <= x0) { return y0; } else if (x >= x1) { @@ -51,7 +51,7 @@ if (typeof interpolate === "undefined") { * @param {any} val * @returns {any[]} */ -window.removeFromArray = function (arr, val) { +window.removeFromArray = function(arr, val) { for (let i = 0; i < arr.length; i++) { if (val === arr[i]) { return arr.splice(i, 1); @@ -66,10 +66,10 @@ window.removeFromArray = function (arr, val) { * @param {any} thisArg * @returns {Array} */ -window.filterInPlace = function (arr, callback, thisArg) { +window.filterInPlace = function(arr, callback, thisArg) { let j = 0; - arr.forEach(function (e, i) { + arr.forEach(function(e, i) { if (callback.call(thisArg, e, i, arr)) { arr[j++] = e; } @@ -84,7 +84,7 @@ window.filterInPlace = function (arr, callback, thisArg) { * @param {App.Entity.SlaveState} slave2 * @returns {boolean} */ -window.canBreed = function (slave1, slave2) { +window.canBreed = function(slave1, slave2) { if (!slave1 || !slave2) { return null; } @@ -98,7 +98,7 @@ window.canBreed = function (slave1, slave2) { * @param {App.Entity.SlaveState} slave2 * @returns {boolean} */ -window.canImpreg = function (slave1, slave2) { +window.canImpreg = function(slave1, slave2) { if (!slave1 || !slave2) { return null; } else if (slave2.dick < 1) { @@ -144,7 +144,7 @@ window.canImpreg = function (slave1, slave2) { * @param {object} PC * @returns {boolean} */ -window.isPlayerFertile = function (PC) { +window.isPlayerFertile = function(PC) { if (!PC) { return null; } else if (PC.preg !== 0) { @@ -164,7 +164,7 @@ window.isPlayerFertile = function (PC) { * @param {App.Entity.SlaveState} slave * @returns {string|number} */ -window.relationTargetWord = function (slave) { +window.relationTargetWord = function(slave) { if (!slave) { return null; } else if (slave.relation === "daughter") { @@ -179,7 +179,7 @@ window.relationTargetWord = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.milkAmount = function (slave) { +window.milkAmount = function(slave) { let milk; let calcs; if (!slave) { @@ -229,7 +229,7 @@ window.milkAmount = function (slave) { * @param {App.Entity.SlaveState} slave * @returns {number} */ -window.cumAmount = function (slave) { +window.cumAmount = function(slave) { let cum = 0; let calcs = 0; if (!slave) { @@ -279,7 +279,7 @@ window.cumAmount = function (slave) { * @param {string} text * @returns {string} */ -window.lispReplace = function (text) { +window.lispReplace = function(text) { text = text.replace(/Sh/g, "Th"); text = text.replace(/SS/g, "Th"); text = text.replace(/Ss/g, "Th"); @@ -367,7 +367,7 @@ window.lispReplace = function (text) { * @param {Object} arcology * @returns {number} */ -window.repGainSacrifice = function (slave, arcology) { +window.repGainSacrifice = function(slave, arcology) { if (!slave || !arcology || arcology.FSAztecRevivalist === "unset" || arcology.FSAztecRevivalist <= 0) { return 0; } @@ -379,33 +379,33 @@ window.repGainSacrifice = function (slave, arcology) { * @param {App.Entity.SlaveState} slave * @returns {boolean} */ -window.bodyguardSuccessorEligible = function (slave) { +window.bodyguardSuccessorEligible = function(slave) { if (!slave) { return false; } return (slave.devotion > 50 && slave.muscles >= 0 && slave.weight < 100 && slave.boobs < 8000 && slave.butt < 10 && slave.belly < 5000 && slave.balls < 10 && slave.dick < 10 && slave.preg < 20 && slave.fuckdoll === 0 && slave.fetish !== "mindbroken" && canWalk(slave)); }; -window.ngUpdateGenePool = function (genePool) { +window.ngUpdateGenePool = function(genePool) { const transferredSlaveIds = (State.variables.slaves || []) - .filter(function (s) { + .filter(function(s) { return s.ID >= 1200000; }) - .map(function (s) { + .map(function(s) { return s.ID - 1200000; }); return (genePool || []) - .filter(function (s) { + .filter(function(s) { return transferredSlaveIds.indexOf(s.ID) >= 0; }) - .map(function (s) { + .map(function(s) { const result = jQuery.extend(true, {}, s); result.ID += 1200000; return result; }); }; -window.ngUpdateMissingTable = function (missingTable) { +window.ngUpdateMissingTable = function(missingTable) { const newTable = {}; (State.variables.slaves || []) @@ -423,7 +423,7 @@ window.ngUpdateMissingTable = function (missingTable) { * @param {any} obj * @returns {string} */ -window.toJson = function (obj) { +window.toJson = function(obj) { let jsontext = JSON.stringify(obj); jsontext = jsontext.replace(/^{/, ""); jsontext = jsontext.replace(/}$/, ""); @@ -434,7 +434,7 @@ window.toJson = function (obj) { * @param {App.Entity.SlaveState} slave * @returns {string} */ -window.nippleColor = function (slave) { +window.nippleColor = function(slave) { if (skinToneLevel(slave.skin) < 8) { if (slave.preg > slave.pregData.normalBirth / 4 || (slave.counter.birthsTotal > 0 && slave.lactation > 0)) { return "brown"; @@ -467,7 +467,7 @@ window.nippleColor = function (slave) { * @param {Object} PC * @returns {number} */ -window.overpowerCheck = function (slave, PC) { +window.overpowerCheck = function(slave, PC) { let strength; if (State.variables.arcologies[0].FSPhysicalIdealist !== "unset") { @@ -494,7 +494,7 @@ window.overpowerCheck = function (slave, PC) { * @param {App.Entity.SlaveState} slave * @returns {number[]} */ -window.impregnatedBy = function (slave) { +window.impregnatedBy = function(slave) { const IDArray = []; if (!Array.isArray(slave.womb)) { WombInit(slave); @@ -511,15 +511,15 @@ window.impregnatedBy = function (slave) { * @param {App.Entity.SlaveState} father * @returns {boolean} */ -window.isImpregnatedBy = function (mother, father) { +window.isImpregnatedBy = function(mother, father) { return impregnatedBy(mother).includes(father.ID); }; -window.jsAlert = function (obj) { +window.jsAlert = function(obj) { alert(obj); }; -window.jsConsoleInfo = function (obj) { +window.jsConsoleInfo = function(obj) { // eslint-disable-next-line no-console console.info(obj); }; @@ -599,7 +599,7 @@ window.SoftenSexualFlaw = function SoftenSexualFlaw(slave) { /** * @param {object} PC */ -window.generatePlayerPronouns = function (PC) { +window.generatePlayerPronouns = function(PC) { if (PC.title === 0) { PC.pronoun = "she"; PC.possessivePronoun = "hers"; @@ -617,7 +617,7 @@ window.generatePlayerPronouns = function (PC) { } }; -window.generateAssistantPronouns = function () { +window.generateAssistantPronouns = function() { const V = State.variables; if (V.assistant === 0) { V.assistantPronouns.pronoun = "it"; diff --git a/src/js/textInput.js b/src/js/textInput.js index 00bffdaac33247f9d888216acb26b32665d70f75..25c358be815f7e6991a0e09fd63c0a87eb040248 100644 --- a/src/js/textInput.js +++ b/src/js/textInput.js @@ -2,7 +2,7 @@ Macro.add("textinput", { // Signifies that the macro is a container macro. tags: null, - handler: function () { + handler: function() { if (this.args.length < 2) { const errors = []; if (this.args.length < 1) { @@ -38,7 +38,7 @@ Macro.add("textinput", { tabindex: 0 // for accessibility }) .addClass("macro-textarea") // "hijack" the .macro-textarea class - .on("input", function () { + .on("input", function() { Wikifier.setValue(varName, this.value); if (that.payload[0].contents !== "") { Wikifier.wikifyEval(that.payload[0].contents.trim()); diff --git a/src/js/textbox2.js b/src/js/textbox2.js index e5b8a222e7362df5ea7943db6f5c33eab85a3909..cebb01edecd516ec0c1e319a9e5a37ffac76051f 100644 --- a/src/js/textbox2.js +++ b/src/js/textbox2.js @@ -1,5 +1,5 @@ Macro.add("textbox2", { - handler: function () { + handler: function() { if (this.args.length < 2) { const e = []; return this.args.length < 1 && e.push("variable name"), this.args.length < 2 && e.push("default value"), this.error(`no ${e.join(" or ")} specified`); @@ -68,19 +68,19 @@ Macro.add("textbox2", { // type: isNumber ? "number" : "text", /* TODO - hide spinner if we do this */ tabindex: 0 }).addClass(`macro-${this.name}`) - .on("change", function () { + .on("change", function() { State.setVar(t, valueToNumberIfSame(this.value)); - }).on("blur", function () { + }).on("blur", function() { State.setVar(t, valueToNumberIfSame(this.value)); // eslint-disable-next-line eqeqeq if (this.value != a) { // If the value has actually changed, reload the page. Note != and not !== because types might be different gotoPassage(); } }) - .on("keypress", function (e) { + .on("keypress", function(e) { 13 === e.which && (e.preventDefault(), State.setVar(t, valueToNumberIfSame(this.value)), gotoPassage()); - }).appendTo(this.output), State.setVar(t, a), inputElement.value = a, autofocus && (inputElement.setAttribute("autofocus", "autofocus"), postdisplay[`#autofocus:${inputElement.id}`] = function (e) { - delete postdisplay[e], setTimeout(function () { + }).appendTo(this.output), State.setVar(t, a), inputElement.value = a, autofocus && (inputElement.setAttribute("autofocus", "autofocus"), postdisplay[`#autofocus:${inputElement.id}`] = function(e) { + delete postdisplay[e], setTimeout(function() { return inputElement.focus(); }, Engine.minDomActionDelay); }); diff --git a/src/js/textboxJS.js b/src/js/textboxJS.js index 4302fdafec66de22d2864335b6ec8104f65d393d..573fac9a376304f75ca63366eaed93e6af5e080a 100644 --- a/src/js/textboxJS.js +++ b/src/js/textboxJS.js @@ -1,5 +1,5 @@ /* Nicked off greyelf, works for replace textboxes */ -window.setReplaceTextboxMaxLength = function (storyVarName, maxLength) { +window.setReplaceTextboxMaxLength = function(storyVarName, maxLength) { const textboxId = `#textbox-${Util.slugify(storyVarName)}`; $(textboxId) .attr("maxlength", maxLength) @@ -11,9 +11,9 @@ window.setReplaceTextboxMaxLength = function (storyVarName, maxLength) { }; /* Nicked off TheMadExile, works for non-replace textboxes */ -window.setTextboxMaxLength = function (storyVarName, maxLength) { +window.setTextboxMaxLength = function(storyVarName, maxLength) { const textboxId = `#textbox-${Util.slugify(storyVarName)}`; - postdisplay[`${textboxId}-maxlength`] = function (taskName) { + postdisplay[`${textboxId}-maxlength`] = function(taskName) { delete postdisplay[taskName]; $(textboxId) .attr("maxlength", maxLength) diff --git a/src/js/utilJS.js b/src/js/utilJS.js index d9f92887d1afea8965062108d77036eb6cf84fbf..90ec4cc6d03b1b5ad2c6f487ae1c1bb57e6e6609 100644 --- a/src/js/utilJS.js +++ b/src/js/utilJS.js @@ -1830,7 +1830,7 @@ App.UI.tabbar = function() { function handlePreSelectedTab() { let selectedTab = State.variables.tabChoice[_tabChoiceVarName()]; if (!selectedTab) { selectedTab = "assign"; } - $(document).one(':passagedisplay', function () { + $(document).one(':passagedisplay', function() { let tabBtn = document.getElementById(`tab ${selectedTab}`); if (!tabBtn) { tabBtn = document.getElementsByClassName('tablinks').item(0); @@ -1893,7 +1893,7 @@ App.UI.passageLink = function(linkText, passage, setter, elementType = 'a') { * @param {string} selector * @param {string} newContent */ -App.UI.replace = function (selector, newContent) { +App.UI.replace = function(selector, newContent) { let ins = jQuery(document.createDocumentFragment()); ins.wiki(newContent); const target = $(selector); @@ -1918,7 +1918,7 @@ App.UI.replace = function (selector, newContent) { * @param {string} [tag='div'] * @returns {string} */ -App.UI.htag = function (text, attributes, tag = 'div') { +App.UI.htag = function(text, attributes, tag = 'div') { const payload = text.replace(/(^\n+|\n+$)/, ""); if ("object" === typeof attributes) { @@ -2532,6 +2532,6 @@ App.Utils.setActiveSlaveByIndex = function(index) { * @param {number} id slave ID * @returns {number} */ -App.Utils.slaveIndexForId = function (id) { +App.Utils.slaveIndexForId = function(id) { return State.variables.slaveIndices[id]; }; diff --git a/src/js/walkPastJS.js b/src/js/walkPastJS.js index 48fd6e6822d46f2465ff0da263a078cbe7267de2..ebcd24531c51ea03a8ff7a471abe483eb16db165 100644 --- a/src/js/walkPastJS.js +++ b/src/js/walkPastJS.js @@ -1,7 +1,7 @@ /* eslint-disable no-unused-vars */ /* temporary container until the entire thing is complete. No point in not deploying the working functions, you know? */ -window.primeSlave = function (activeSlave, seed) { +window.primeSlave = function(activeSlave, seed) { /* will be moved up once this becomes a single, contained function. */ const V = State.variables; const pronouns = getPronouns(activeSlave); @@ -21,7 +21,7 @@ window.primeSlave = function (activeSlave, seed) { return t; }; -window.rivalSlave = function (activeSlave, seed) { +window.rivalSlave = function(activeSlave, seed) { const V = State.variables; const pronouns = getPronouns(activeSlave); const he = pronouns.pronoun, him = pronouns.object, his = pronouns.possessive, hers = pronouns.possessivePronoun, himself = pronouns.objectReflexive, boy = pronouns.noun; @@ -50,7 +50,7 @@ window.rivalSlave = function (activeSlave, seed) { return t; }; -window.loverSlave = function (activeSlave) { +window.loverSlave = function(activeSlave) { /* will be moved up once this becomes a single, contained function. */ let _target = ""; let t = ""; @@ -1231,7 +1231,7 @@ window.loverSlave = function (activeSlave) { return t; }; -window.relatedSlave = function (activeSlave) { +window.relatedSlave = function(activeSlave) { const V = State.variables; const pronouns = getPronouns(activeSlave); const he = pronouns.pronoun, him = pronouns.object, his = pronouns.possessive, hers = pronouns.possessivePronoun, himself = pronouns.objectReflexive, boy = pronouns.noun; @@ -1274,7 +1274,7 @@ window.relatedSlave = function (activeSlave) { return t; }; -window.walkPasts = function (slave, _seed) { +window.walkPasts = function(slave, _seed) { /* will be moved up once this becomes a single, contained function. */ const V = State.variables; const pronouns = getPronouns(slave); @@ -1857,7 +1857,7 @@ window.walkPasts = function (slave, _seed) { return t; }; -window.boobWatch = function (slave) { +window.boobWatch = function(slave) { /* will be moved up once this becomes a single, contained function. */ let t = ""; let V = State.variables; @@ -2275,7 +2275,7 @@ window.boobWatch = function (slave) { return t; }; -window.buttWatch = function (slave) { +window.buttWatch = function(slave) { /* will be moved up once this becomes a single, contained function. */ let t = ""; let V = State.variables; @@ -2611,7 +2611,7 @@ window.buttWatch = function (slave) { return t; }; -window.anusWatch = function (slave) { +window.anusWatch = function(slave) { /* will be moved up once this becomes a single, contained function. */ let t = ""; let V = State.variables; @@ -2920,7 +2920,7 @@ window.anusWatch = function (slave) { }; -window.lipWatch = function (slave) { +window.lipWatch = function(slave) { /* will be moved up once this becomes a single, contained function. */ let t = ""; let V = State.variables;