diff --git a/src/js/findSlave.js b/src/js/findSlave.js index 0e5b447910136478d2e386764ad3ec676c1fd9c9..84450f192f6f012ab8038f70fb89acb0518d7159 100644 --- a/src/js/findSlave.js +++ b/src/js/findSlave.js @@ -7,8 +7,8 @@ App.FindSlave = {}; * @returns {boolean} */ App.FindSlave._fragmentSearch = function(haystacks, needles) { - const hs = haystacks.join(" "); - return needles.every((needle) => { return needle.test(hs); }); + const hs = haystacks.join(" "); + return needles.every((needle) => { return needle.test(hs); }); }; /** @@ -17,12 +17,12 @@ App.FindSlave._fragmentSearch = function(haystacks, needles) { * @returns {number[]} */ App.FindSlave._slaveIndices = function(predicate) { - return V.slaves.reduce((acc, slave, ind) => { - if (predicate(createReadonlyProxy(slave))) { - acc.push(ind); - } - return acc; - }, []); + return V.slaves.reduce((acc, slave, ind) => { + if (predicate(createReadonlyProxy(slave))) { + acc.push(ind); + } + return acc; + }, []); }; /** @@ -31,9 +31,9 @@ App.FindSlave._slaveIndices = function(predicate) { * @returns {DocumentFragment} */ App.FindSlave.searchByName = function(query) { - const needles = query.split(" ").map((needle) => { return new RegExp(needle, "i"); }); - const indices = this._slaveIndices((slave) => { return this._fragmentSearch([slave.slaveName, slave.slaveSurname, slave.birthName, slave.birthSurname], needles); }); - return App.UI.SlaveList.render.listDOM(indices, [], App.UI.SlaveList.SlaveInteract.stdInteract); + const needles = query.split(" ").map((needle) => { return new RegExp(needle, "i"); }); + const indices = this._slaveIndices((slave) => { return this._fragmentSearch([slave.slaveName, slave.slaveSurname, slave.birthName, slave.birthSurname], needles); }); + return App.UI.SlaveList.render.listDOM(indices, [], App.UI.SlaveList.SlaveInteract.stdInteract); }; /** @@ -42,9 +42,9 @@ App.FindSlave.searchByName = function(query) { * @returns {DocumentFragment} */ App.FindSlave.searchByBackground = function(query) { - const needles = query.split(" ").map((needle) => { return new RegExp(needle, "i"); }); - const indices = this._slaveIndices((slave) => { return this._fragmentSearch([slave.career, slave.origin], needles); }); - return App.UI.SlaveList.render.listDOM(indices, [], App.UI.SlaveList.SlaveInteract.stdInteract); + const needles = query.split(" ").map((needle) => { return new RegExp(needle, "i"); }); + const indices = this._slaveIndices((slave) => { return this._fragmentSearch([slave.career, slave.origin], needles); }); + return App.UI.SlaveList.render.listDOM(indices, [], App.UI.SlaveList.SlaveInteract.stdInteract); }; /** @@ -53,7 +53,7 @@ App.FindSlave.searchByBackground = function(query) { * @returns {DocumentFragment} */ App.FindSlave.searchByExpression = function(query) { - const pred = new Function("slave", "return (" + query + ");"); - const indices = runWithReadonlyProxy(() => { return this._slaveIndices(pred); }); - return App.UI.SlaveList.render.listDOM(indices, [], App.UI.SlaveList.SlaveInteract.stdInteract); + const pred = new Function("slave", "return (" + query + ");"); + const indices = runWithReadonlyProxy(() => { return this._slaveIndices(pred); }); + return App.UI.SlaveList.render.listDOM(indices, [], App.UI.SlaveList.SlaveInteract.stdInteract); }; diff --git a/src/uncategorized/findSlave.tw b/src/uncategorized/findSlave.tw index 991d56cb61dea865aa93a15d36472e3396e5e589..e61fae8de3c45bc1ef640553f4193ed36566e61f 100644 --- a/src/uncategorized/findSlave.tw +++ b/src/uncategorized/findSlave.tw @@ -4,29 +4,29 @@ After spending a minute trying to remember some details about one of your slaves, you sit down behind your desk and tell $assistantName that you need to locate a particular slave's records.<br><br> -"Certainly, <<= properMaster()>>. What can you tell me about them?"<br><br> +"Certainly, <<= properMaster()>>. What can you tell me about them?"<br><br> "They're called something like: <<textbox "_nameSearch" "" autofocus>> <<link "Locate">> - <<script>>$('#slaveList').empty().append(App.FindSlave.searchByName(State.temporary.nameSearch));<</script>> + <<script>>$('#slaveList').empty().append(App.FindSlave.searchByName(State.temporary.nameSearch));<</script>> <</link>> <br>//(Enter a fragment of their nickname, name, surname, birth name, or birth surname)//<br><br> "In the past, they were: <<textbox "_backgroundSearch" "">> <<link "Locate">> - <<script>>$('#slaveList').empty().append(App.FindSlave.searchByBackground(State.temporary.backgroundSearch));<</script>> + <<script>>$('#slaveList').empty().append(App.FindSlave.searchByBackground(State.temporary.backgroundSearch));<</script>> <</link>> <br>//(Enter a fragment of their origin or past job, for example, "shelter" or "lawyer")//<br><br> "Their data should meet this condition: <<textbox "_dataSearch" "">> <<link "Locate">> - <<script>>$('#slaveList').empty().append(App.FindSlave.searchByExpression(State.temporary.dataSearch));<</script>> + <<script>>$('#slaveList').empty().append(App.FindSlave.searchByExpression(State.temporary.dataSearch));<</script>> <</link>> <br>//(Enter a conditional expression which evaluates to true for the slave you want to find, such as "slave.physicalAge >= 18 && slave.physicalAge < 21")// <br><br> <span id="slaveList"> - /* results list gets populated here by jQuery */ + /* results list gets populated here by jQuery */ </span> diff --git a/src/uncategorized/persBusiness.tw b/src/uncategorized/persBusiness.tw index d8cfd352ad7c604ffc6660b1b258badfab6eb496..c54d799f36d83737603cf14c8742356e03b60c4c 100644 --- a/src/uncategorized/persBusiness.tw +++ b/src/uncategorized/persBusiness.tw @@ -93,9 +93,9 @@ <<set $enduringRep *= .5>> <<elseif ($personalAttention == "upkeep")>> <<if $PC.belly >= 5000>> - You spend your free time hustling around your penthouse, cleaning and making sure everything is in order. You manage to reduce your upkeep by 20%. Your <<if $PC.preg > 0>>pregnancy<<else>>big belly<</if>> slows you down some<<if $PC.counter.birthMaster > 0>>, but you're used to working around it.<</if>> + You spend your free time hustling around your penthouse, cleaning and making sure everything is in order. You manage to reduce your upkeep by 20%. Your <<if $PC.preg > 0>>pregnancy<<else>>big belly<</if>> slows you down some<<if $PC.counter.birthMaster > 0>>, but you're used to working around it<</if>>. <<else>> - You spend your free time hustling around your penthouse, cleaning and making sure everything is in order. You manage to reduce your upkeep by 25%. <<if $PC.counter.birthMaster > 0>>This is much easier to do without a big baby bump in the way.<</if>> + You spend your free time hustling around your penthouse, cleaning and making sure everything is in order. You manage to reduce your upkeep by 25%.<<if $PC.counter.birthMaster > 0>> This is much easier to do without a big baby bump in the way.<</if>> <</if>> <<elseif ($personalAttention == "proclamation")>> /* handled after this if chain */ @@ -407,7 +407,7 @@ <</if>> <<set $SecExp.proclamation.cooldown = 4, $personalAttention = "business">> <<else>> - As you currently lack the minimum amount of your chosen proclamation currency, $SecExp.proclamation.currency, it woudld be unwise to attempt execution of your $SecExp.proclamation.type this week. + As you currently lack the minimum amount of your chosen proclamation currency, $SecExp.proclamation.currency, it would be unwise to attempt execution of your $SecExp.proclamation.type this week. <</if>> <</if>>