diff --git a/Fate/FateOmni.css b/Fate/FateOmni.css index 36899f5fcc..6e32127014 100644 --- a/Fate/FateOmni.css +++ b/Fate/FateOmni.css @@ -275,10 +275,16 @@ input.icon[value="blank"] + span.icon::before { padding-top: 12px; } -.ExtraDisplay .repcontainer .repitem:first-child .space-above { - padding-top: 0px; +.rule-above { + margin-top: 12px; + border-top: 1px solid gray; + padding-top: 12px; } +/* .ExtraDisplay .repcontainer .repitem:first-child .space-above { + padding-top: 0px; +} */ + .hideUnlessNull + * { display: none; } @@ -359,18 +365,22 @@ input.icon[value="blank"] + span.icon::before { .StuntFrame, .PowerFrame, .NoteFrame, -.ExtraFrame, .SkillFrame { flex-direction: row; justify-content: flex-start; } .TrackFrame, +.ExtraFrame, .AspectFrame { flex-direction: column; justify-content: stretch; } +.ExtraFrame .fieldlabel { + text-align: left; +} + .ui-dialog .tab-content .charsheet .fieldlabel { font-weight: bold; font-size: 80%; @@ -715,6 +725,16 @@ input.icon[value="blank"] + span.icon::before { content: ''; } + +.hideOnOne + div { + display: block; +} + +.hideOnOne[value="1"] + div { + display: none; +} + + .hideIfNull + div { display: block; } diff --git a/Fate/FateOmni.html b/Fate/FateOmni.html index cf4e6616f8..be706db5b5 100644 --- a/Fate/FateOmni.html +++ b/Fate/FateOmni.html @@ -164,6 +164,7 @@
Click this button to export the entire sheet as a JSON object that can be imported to another sheet using the import area below.
+

Clicking this button will empty out all the dynamic elements of the sheet. It will leave some attributes untouched, but should blank out aspects, skills, stunts, stress, consequences, conditions, tempaspects, modes, roles, swaps, packages, powers, extras, and notes. @@ -1138,8 +1139,15 @@ Edit Extras -
Extras are composed of a series of elements. For each extra, start by adding a title element, then add other elements as needed: permissions, costs, aspects, skills, stunts, tracks, ratings (e.g., weapon:X, armor:X), notes.
+
Extras are composed of a series of elements. For each extra, start by adding a title element, then add other elements as needed: permissions, costs, aspects, skills, stunts, tracks, ratings (e.g., weapon:X, armor:X), notes.
+
+ : +
+ +
+
+ -
- -
-
-
-
- (): - -
-
- -
- : - + +
+ +
+
+
- -
- 2: - +
+
+
+ (): +
- -
- 3: - +
+ +
+ : + +
+ +
+ 2: + +
+ +
+ 3: + +
+
+
+ : + +
+
+ : + + + +
+
+ : + +
Rollable
+ +
+
Bonus
+ +
Skill
+ + +
+
+
+ : + +
+
+ : + +
+
+ : + +
+
+ : + +
+
+ + + + + + + + + + + +
+
+
-
- : - -
-
- : - - - -
-
- : - -
Rollable
- -
-
Bonus
- -
Skill
- - -
-
-
- : - -
-
- : - -
-
- : - -
-
- : - -
-
- - - - - - - - - - - -
-
- -
-
+
- -
- -
-
-
-
-
-
-
-
-
-
- -
-
- - - - -
-
-
-
-
- - - - -
-
-
- - -
- -
-
-
-
- : - - - - - - - -
-
-
-
-
-
- : - - - - -
-
-
-
- - - - -
-
- - - - - - - - - - - - - + +
+ +
-
+
+
+
+
+
+
+
+
+
+ +
+
+ + + + +
+
+
+
+
+ + + + +
+
+
+ + +
+ +
+
+
+
+ : + + + + + + + +
+
+
+
+
+
+ : + + + + +
+
+
+
+ + + + +
+
+ + + + + + + + + + + + + + +
+
+
@@ -4553,6 +4570,74 @@ on("change:repeating_extras:rating", function(e) { } }); +// A function from wiki.roll20.net/Sheet_Worker_Scripts that gets you section IDs in their order of display + +var getSectionIDsOrdered = function (sectionName, callback) { + 'use strict'; + getAttrs([`_reporder_${sectionName}`], function (v) { + getSectionIDs(sectionName, function (idArray) { + let reporderArray = v[`_reporder_${sectionName}`] ? v[`_reporder_${sectionName}`].toLowerCase().split(',') : [], + ids = [...new Set(reporderArray.filter(x => idArray.includes(x)).concat(idArray))]; + callback(ids); + }); + }); +}; + +// Creating a handler to make sure that extras are divided up by/attached to title elements. ZOD + +on("change:extrasfilter change:repeating_extras sheet:opened", function(e) { + getSectionIDsOrdered("extras", function(x) { + log("Extras grouping handler activated"); + // We really only care about these fields: + // - element, which is the type-of-element indicator, and + // - name, which will contain the name of a title element, for filtering purposes + // - hideme, which will contain a 1 if it should be hidden and a 0 if it shouldn't, based on filter text + // + // hideme = 0 or 1, extrasfilter = + log(x); + var fieldlist = ['extrasfilter']; + for(var i=0; i < x.length; i++) { + fieldlist[i*3+1] = "repeating_extras_" + x[i] + "_hideme"; + fieldlist[i*3+2] = "repeating_extras_" + x[i] + "_element"; + fieldlist[i*3+3] = "repeating_extras_" + x[i] + "_name"; + } + getAttrs(fieldlist, function(ext) { + log(ext); + var att = {}; + var hidestate = 0; + const spacetrim = /[ ]*$/; + var empty = false; + var searcher = ''; + if( ext['extrasfilter'].replace(spacetrim) == "" ) { + empty = true; + } else { + searcher = new RegExp(ext['extrasfilter'],'i'); + } + for(var i=0; i < x.length; i++) { + if ( empty ) { + att['repeating_extras_' + x[i] + "_hideme" ] = "0"; + } else { + var el = ext["repeating_extras_" + x[i] + "_element"]; + var na = ext["repeating_extras_" + x[i] + "_name"]; + if ( el == "title" ) { + log("title element found " + na); + if ( searcher.test(na) ) { + log("matches filter"); + hidestate = 0; + } else { + log("does not match filter"); + hidestate = 1; + } + } + att['repeating_extras_' + x[i] + "_hideme" ] = hidestate; + } + } + log(att); + setAttrs(att); + }); + }); +}); + on("change:repeating_skills:rollthis change:combomulti", function(e) { log("rollthis or combomulti marked in repeating_skills - skill combo feature"); log(e); @@ -4833,8 +4918,14 @@ on("change:importsheetdata sheet:opened", function() { if ( values.importsheetdata !== "" ) { // Then it's gonna get processed. log("importsheetdata: non null importablesheetdata detected"); var impsheet = JSON.parse(values.importsheetdata); // Hope this works! - var attrs = impsheet.attr; // this should get us the "flat attributes" that are just gonna get overwritten, as our starter object - var fsets = impsheet.fieldset; // An array of objects each representing a row in one of the many fieldsets this sheet uses + var attrs = {}; + var fsets = []; + if ( typeof(impsheet.attr) !== "undefined" ) { + attrs = impsheet.attr; // this should get us the "flat attributes" that are just gonna get overwritten, as our starter object + } + if ( typeof(impsheet.fieldset) !== "undefined" ) { + fsets = impsheet.fieldset; // An array of objects each representing a row in one of the many fieldsets this sheet uses + } attrs["importsheetdata"] = ""; // Initialize the import field now that we've read it in. for(var i=0; i < fsets.length; i++) { var row = fsets[i]; // This is an object @@ -4859,6 +4950,32 @@ on("change:importsheetdata sheet:opened", function() { // aspects, skills, stunts, stress, consequences, conditions, tempaspects, modes, roles, swaps, packages, powers, extras, notes // ZOD +on("clicked:exportsheetextrasonly", function(e) { + var exsheet = { "attr": {}, "fieldset": [] }; + var fields = []; + getSectionIDs("extras", function(extrasList) { + var flist = fieldsets["extras"]; + var fnames = []; + for(var i=0; i < extrasList.length; i++) { + for(var j=0; j < flist.length; j++) { + fnames[i*flist.length+j] = "repeating_extras_" + extrasList[i] + "_" + flist[j]; + } + } + fields = fields.concat(fnames); + getAttrs(fields, function(v) { + log(v); + for(var i=0; i < extrasList.length; i++) { + var thisrow = { "_fieldset": "extras" }; + for(var j=0; j < fieldsets["extras"].length; j++) { + thisrow[fieldsets["extras"][j]] = v["repeating_extras_" + extrasList[i] + "_" + fieldsets["extras"][j]]; + } + exsheet["fieldset"].push(thisrow); + } + setAttrs({ "exportsheetdata": JSON.stringify(exsheet,null,"\t") }); + }); + }); +}); + on("clicked:exportsheet", function(e) { var exsheet = { "attr": {}, "fieldset": [] }; var fields = []; @@ -5111,7 +5228,7 @@ on("clicked:exportsheet", function(e) { } // And finally, we stringify the object and set the export field value - setAttrs({ "exportsheetdata": JSON.stringify(exsheet) }); + setAttrs({ "exportsheetdata": JSON.stringify(exsheet,null,"\t") }); }); }); // notes diff --git a/Fate/translation.json b/Fate/translation.json index e902e6c6cd..f440393fa0 100644 --- a/Fate/translation.json +++ b/Fate/translation.json @@ -454,5 +454,7 @@ "Dice Communications": "Dice Communications", "Display sheet's rolls publicly": "Display sheet's rolls publicly", "Whisper sheet's rolls to GM": "Whisper sheet's rolls to GM", + "Filter": "Filter", + "You can use the filter to hide anything that doesn't follow a title element with a matching name.": "You can use the filter to hide anything that doesn't follow a title element with a matching name. Just type in a phrase and then click, tap, or tab out of the filter field to apply the filter.", "zzzz-end-of-json": "" } \ No newline at end of file