docs: explain shared shed formatting helpers

This commit is contained in:
nyan404 committed 2026-08-25 04:31:49 +03:00
1 parent 097429359f
commit 173a086c6b
1 file changed
+4
+4
View File
@@ -269,6 +269,7 @@
$('head').append(`<style>${css}</style>`); $('head').append(`<style>${css}</style>`);
} }
// Pads a numeric time component to two characters.
function leadZero(num) { function leadZero(num) {
return (num < 10) ? '0' + num : num; return (num < 10) ? '0' + num : num;
} }
@@ -3046,6 +3047,7 @@
} }
} }
// Initializes the custom movement-notes panel used during training.
function cumoves() { function cumoves() {
const notes = getSettings('cuMovesNote') || ''; 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>`; const p = `<p>Заметки:<br><textarea id="cws_moves_note" placeholder="Заметки о добавленных переходах" style="width: 95%; max-width: 830px; height: 100px; margin: 0px;"></textarea></p>`;
@@ -3056,6 +3058,7 @@
}); });
} }
// Adds the in-game shortcut that opens the userscript settings view.
function sett() { 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>`); $('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), ' : ''; const pattern = globals.css_cp_pattern ? 'url(https://i.imgur.com/V4TX5Cv.png), ' : '';
@@ -4149,6 +4152,7 @@
return res; return res;
} }
// Normalizes a settings textarea and reports malformed IDs to the user.
function validateTextarea($textarea) { function validateTextarea($textarea) {
let pattern = new RegExp('^' + $textarea.attr('pattern') + '$'); let pattern = new RegExp('^' + $textarea.attr('pattern') + '$');
return $textarea.val().match(pattern); return $textarea.val().match(pattern);