docs: explain CatWar notes and formatting helpers

This commit is contained in:
nyan404 committed 2026-08-25 04:26:50 +03:00
1 parent 58ef9f6ae2
commit 67eed5d6ac
1 file changed
+6
+6
View File
@@ -3052,6 +3052,7 @@ ${my_id_div}
}
}
// Initializes the custom movement-notes panel used during training.
function cumoves() {
const notes = getSettings('cuMovesNote') || '';
const p = `<p>Заметки:<br><textarea id="cws_moves_note" placeholder="Заметки о добавленных переходах" style="width: 95%; max-width: 830px; height: 100px; margin: 0px;"></textarea></p>`;
@@ -3062,6 +3063,7 @@ ${my_id_div}
});
}
// Adds the in-game shortcut that opens the userscript settings view.
function sett() {
$('head').append(`<style id="css_cellshade_example">#cages td {box-shadow: inset 0px ${globals.css_cellshadeOpacity}px 0px ${globals.css_cellshadeOpacity}px ${globals.css_cellshadeColor};}</style>`);
const pattern = globals.css_cp_pattern ? 'url(https://i.imgur.com/V4TX5Cv.png), ' : '';
@@ -4130,10 +4132,12 @@ Y: <input type=number id="tt_window_top" class="cws-number" min=0 max=9999 value
}
/*functions*/
// Applies ID placeholders in a display mask to one cat identifier.
function masking(catID, maskStr) { // 123, '[cat%ID%] [%ID%]' => [cat123] [123]
return maskStr.replace(/%ID%/g, catID);
}
// Converts a whitespace-separated ID list into masked display labels.
function toMaskedArr(str, maskStr) { // '123 456', '[catID] [ID]' => [cat123] [123], [cat456] [456]
str = str.replace(/\n/g, ' ');
let tmp_arr = [];
@@ -4155,11 +4159,13 @@ Y: <input type=number id="tt_window_top" class="cws-number" min=0 max=9999 value
return res;
}
// Normalizes a settings textarea and reports malformed IDs to the user.
function validateTextarea($textarea) {
let pattern = new RegExp('^' + $textarea.attr('pattern') + '$');
return $textarea.val().match(pattern);
}
// Parses an ISO date string into numeric calendar components for reports.
function splitDateStr(datestr) { // yyyy-MM-dd => dt = {year: yyyy, month: MM, day: dd, shortYear: YY}
if (datestr) {
let dt = {};