diff --git a/devNotes/VersionChangeLog-Premod+LoliMod.txt b/devNotes/VersionChangeLog-Premod+LoliMod.txt index d14b2d97c4eb369423b166948540754caebf0718..3c31b0d4e4a7922d602a3326055462d0500142a6 100644 --- a/devNotes/VersionChangeLog-Premod+LoliMod.txt +++ b/devNotes/VersionChangeLog-Premod+LoliMod.txt @@ -2,6 +2,13 @@ 0.10.7.1-0.1.x +5/12/2018 + + 94 + -slaves may now birth identical twins + -anon's quick find slave index ui now works on tabbed penthouse and supports sort boxes + -fixes + 5/10/2018 93 diff --git a/devNotes/twine CSS b/devNotes/twine CSS index ff811dbe2e625af3a4d9238f87cf314f404ab3e5..54d41b71a390b25659e3d0244c65eae228f9bbff 100644 --- a/devNotes/twine CSS +++ b/devNotes/twine CSS @@ -406,3 +406,108 @@ button.accordion.active:before { /* end extended family css */ config.history.tracking = false; + +/*:: Quick List stylesheet [stylesheet]*/ + +.hidden +{ + display:none; +} + +div.quicklist.devotion button.mindbroken +{ + background-color:red; +} +div.quicklist.devotion button.very-hateful +{ + background-color:darkviolet; +} +div.quicklist.devotion button.hateful +{ + background-color:darkviolet; +} +div.quicklist.devotion button.resistant +{ + background-color:mediumorchid; +} +div.quicklist.devotion button.ambivalent +{ + background-color: yellow; + color: #444444; +} +div.quicklist.devotion button.accepting +{ + background-color: hotpink; +} +div.quicklist.devotion button.devoted +{ + background-color: deeppink; +} +div.quicklist.devotion button.worshipful +{ + background-color: magenta; +} +div.quicklist.trust button.mindbroken +{ + background-color:red; +} +div.quicklist.trust button.extremely-terrified +{ + background-color: darkgoldenrod; +} +div.quicklist.trust button.terrified +{ + background-color: goldenrod; +} +div.quicklist.trust button.frightened +{ + background-color: gold; + color: coral; +} +div.quicklist.trust button.fearful +{ + background-color: yellow; + color: green; +} +div.quicklist.trust button.hate-careful +{ + background-color: orange; +} +div.quicklist.trust button.careful +{ + background-color: mediumaquamarine; + color: forestgreen; +} +div.quicklist.trust button.bold +{ + background-color: orangered; +} +div.quicklist.trust button.trusting +{ + background-color: mediumseagreen; +} +div.quicklist.trust button.defiant +{ + background-color: darkred; +} +div.quicklist.trust button.profoundly-trusting +{ + background-color: seagreen; +} +div.quicklist +{ + table-layout: fixed; + text-align: center; + border-collapse: separate; + border-spacing: 2px; + border-style: hidden; + empty-cells: hide; + width: 70%; +} +div.quicklist button +{ + margin-top: 15px; + margin-right: 20px; + white-space: nowrap; +} + diff --git a/devNotes/twine JS b/devNotes/twine JS index 8b0b29aff4397ad7e6f04e1c22be8e39dfd32562..84080ca0d175917f02ab0f111d0d3d8a4bf08c12 100644 --- a/devNotes/twine JS +++ b/devNotes/twine JS @@ -3692,6 +3692,79 @@ window.capFirstChar = function capFirstChar(string) { return string.charAt(0).toUpperCase() + string.substr(1); } +window.getSlaveDisplayName = function (slave) +{ + if ( (!slave) + || (!State) + ) + { + return undefined; + } + var surnamesFirstCountries = [ "Cambodian", "Chinese", "Hungarian", "Japanese", "Korean", + "Mongolian", "Taiwanese", "Vietnamese" + ] + , names = [ slave.slaveName, slave.slaveSurname || "" + ]; + ; + if ( (1 != State.variables.surnameOrder) + && (surnamesFirstCountries.includes(slave.nationality)) + ) + { + names.reverse(); + } + return names.join(" ").trim(); +} + +window.getSlaveDevotionClass = function (slave) +{ + if ( (!slave) + || (!State) + ) + { + return undefined; + } + if ('mindbroken' == slave.fetish) return 'mindbroken'; + + if (-95 > slave.devotion) return 'very-hateful'; + else if (-50 > slave.devotion) return 'hateful'; + else if (-20 > slave.devotion) return 'resistant'; + else if (20 >= slave.devotion) return 'ambivelent'; + else if (50 >= slave.devotion) return 'accepting'; + else if (95 >= slave.devotion) return 'devoted'; + else return 'worshipful'; +} + +window.getSlaveTrustClass = function (slave) +{ + if ( (!slave) + || (!State) + ) + { + return undefined; + } + if ('mindbroken' == slave.fetish) return ''; + + if (-95 > slave.trust) return 'extremely-terrified'; + else if (-50 > slave.trust) return 'terrified'; + else if (-20 > slave.trust) return 'frightened'; + else if (20 >= slave.trust) return 'fearful'; + else if (50 >= slave.trust) + { + if (-20 > slave.devotion) return 'hate-careful'; + else return 'careful'; + } + else if (95 >= slave.trust) + { + if (-20 > slave.devotion) return 'bold'; + else return 'trusting'; + } + else + { + if (-20 > slave.devotion) return 'defiant'; + else return 'profoundly-trusting'; + } +} + /*:: Span Macro JS [script]*/ /* @@ -9394,29 +9467,39 @@ window.setColors = function(colorMap){ * Usage: <<htag atributes>>...<</htag>> * Usage: <<htag atributes tag>>...<</htag>> */ -Macro.add('htag', { - tags : null, - - munge(val, key) { return key + '="' + val + '"'; }, - handler() { +Macro + .add( + 'htag', + { tags : null + , handler() + { const payload = this.payload[0].contents.replace(/(^\n+|\n+$)/, ''); let htag = 'div'; let attributes; + + var munge = function (val, key) + { + return key + '="' + val + '"'; + }; - if (1 > this.args.length) { - return this.error('invalid syntax, format: <<htag [id [ tag ] | attributes [ tag ] >>'); - } - if (1 < this.args.length) { - htag = String(this.args[1]).trim(); + if (1 > this.args.length) + { + return + this.error( + 'invalid syntax, format: <<htag [id [ tag ] | attributes [ tag ] >>' + ); + } + if (1 < this.args.length) + { + htag = String(this.args[1]).trim(); + } + if ("object" === typeof this.args[0]) + { + attributes = $.map(this.args[0], munge).join(" "); } - if (typeof this.args[0] === "object") { - attributes = //$.map(this.args[0], munge).join(" "); - $.map( - this.args[0], - function (val, key) { return key + '="' + val + '"'; }) - .join(" "); - } else { - attributes = 'id="' + String(this.args[0]).trim() + '"'; + else + { + attributes = 'id="' + String(this.args[0]).trim() + '"'; } Config.debug && this.debugView.modes({block: true}); @@ -9425,3 +9508,57 @@ Macro.add('htag', { .appendTo(this.output); } }); + +/*:: Quick List [script]*/ + +window.sortDomObjects = function (objects, attrName) +{ + var sortingByAttr = function (a, b) + { + var aVal = parseInt(a.getAttribute(attrName)) + , bVal = parseInt(b.getAttribute(attrName)) + ; + return bVal - aVal; + }; + return objects.toArray().sort(sortingByAttr); +}; + +window.sortButtonsByDevotion = function () +{ + var $sortedButtons = $('#qlWrapper button').remove(); + + $sortedButtons = sortDomObjects($sortedButtons, 'data-devotion'); + + $($sortedButtons).appendTo($('#qlWrapper')); + quickListBuildLinks(); +}; + +window.sortButtonsByTrust = function () +{ + var $sortedButtons = $('#qlWrapper button').remove(); + + $sortedButtons = sortDomObjects($sortedButtons, 'data-trust'); + + $($sortedButtons).appendTo($('#qlWrapper')); + quickListBuildLinks(); +}; + +window.quickListBuildLinks = function () +{ + $("[data-scroll-to]").click(function() { + var $this = $(this), $toElement = $this.attr('data-scroll-to'), + /* + * note the * 1 enforces $offset to be an integer, without + * it we scroll to True, which goes nowhere fast. + */ + $offset = $this.attr('data-scroll-offset') * 1 || 0, + $speed = $this.attr('data-scroll-speed') * 1 || 500 + ; + /* + * Use javascript scrollTop animation for in page navigation. + */ + $('html, body').animate({ + scrollTop: $($toElement).offset().top + $offset + }, $speed); + }); +};