docs: explain remaining shared shed helpers

This commit is contained in:
nyan404 committed 2026-08-25 04:30:05 +03:00
1 parent a649fc295f
commit a992c81f3c
1 file changed
+12 -1
+12 -1
View File
@@ -411,7 +411,7 @@
function(){modal.remove();unlockModal()})}if(options.animation=="none"){modal.remove();modalBG.css({'display':'none'})}}modal.unbind('reveal:close')}); function(){modal.remove();unlockModal()})}if(options.animation=="none"){modal.remove();modalBG.css({'display':'none'})}}modal.unbind('reveal:close')});
modal.trigger('reveal:open');var closeButton=$('.'+options.dismissmodalclass).bind('click.modalEvent',function(){modal.trigger('reveal:close')}); modal.trigger('reveal:open');var closeButton=$('.'+options.dismissmodalclass).bind('click.modalEvent',function(){modal.trigger('reveal:close')});
if(options.closeonbackgroundclick){modalBG.css({"cursor":"pointer"});modalBG.bind('click.modalEvent',function(){modal.trigger('reveal:close')})}$('body') if(options.closeonbackgroundclick){modalBG.css({"cursor":"pointer"});modalBG.bind('click.modalEvent',function(){modal.trigger('reveal:close')})}$('body')
.keyup(function(e){if(e.which===27){modal.trigger('reveal:close')}});function unlockModal(){locked=false}function lockModal(){locked=true}})} .keyup(function(e){if(e.which===27){modal.trigger('reveal:close')}});/* Toggles the modal re-entry guard. */function unlockModal(){locked=false}function lockModal(){locked=true}})}
const cws_showModal = function(t, e) { const cws_showModal = function(t, e) {
$("#app").append('<div id="reveal" class="reveal-modal"><h1>' + $("#app").append('<div id="reveal" class="reveal-modal"><h1>' +
t + '</h1><div id="reveal_info">' + t + '</h1><div id="reveal_info">' +
@@ -1955,6 +1955,7 @@
} }
} }
// Enhances the current player's profile and identity links.
function myCat() { function myCat() {
$(document).ready(function () { $(document).ready(function () {
let id = $('#pr table tr:first-child td:last-child a').attr('href').replace('cat', ''); let id = $('#pr table tr:first-child td:last-child a').attr('href').replace('cat', '');
@@ -2002,6 +2003,7 @@
} }
} }
// Enhances another cat's profile with configured metadata and actions.
function profile() { function profile() {
$.getJSON("https://cat.nyan404.ru/data/river_achievements.json?" + Date.now(), function (data) { $.getJSON("https://cat.nyan404.ru/data/river_achievements.json?" + Date.now(), function (data) {
const achievements = data, const achievements = data,
@@ -2049,8 +2051,10 @@
}); });
} }
// Adds IDs and convenience controls to direct-message pages.
function dm() { //ЛС игрока function dm() { //ЛС игрока
if (globals.on_idDM) { if (globals.on_idDM) {
// Injects the conversation participant ID into message links.
function add_id() { function add_id() {
let id = $('#msg_login').attr('href'); let id = $('#msg_login').attr('href');
if (id !== undefined) { if (id !== undefined) {
@@ -2069,6 +2073,7 @@
} }
} }
// Applies hunting controls, timers, and mobile layout fixes.
function hunt() { function hunt() {
if (globals.on_css_bghuntpic) { if (globals.on_css_bghuntpic) {
$('head').append(`<style id="cwsstyle_on_css_bghuntpic">html { background: url('${globals.css_huntbgpicURL}') !important; }</style>`); $('head').append(`<style id="cwsstyle_on_css_bghuntpic">html { background: url('${globals.css_huntbgpicURL}') !important; }</style>`);
@@ -2254,6 +2259,7 @@
} }
} }
// Enhances blog/report pages and their configured comment tools.
function blog() { function blog() {
if (globals.on_reports) { if (globals.on_reports) {
$(document).ready(function () { $(document).ready(function () {
@@ -2265,6 +2271,7 @@
const date_str = date.getFullYear() + '-' + leadZero(date.getMonth() + 1) + '-' + leadZero(date.getDate()); const date_str = date.getFullYear() + '-' + leadZero(date.getMonth() + 1) + '-' + leadZero(date.getDate());
let my_id_div = `<div>Ваш ID:&nbsp;<input type="text" class="cws-input" pattern="[0-9]+" style="width: 145px;" id="cws_blog_myid" required="true" placeholder="123456" value="${globals.my_id ? globals.my_id : ''}"> <input type="checkbox" checked id="remember_id"><label for="remember_id">Запомнить</label></div>`; let my_id_div = `<div>Ваш ID:&nbsp;<input type="text" class="cws-input" pattern="[0-9]+" style="width: 145px;" id="cws_blog_myid" required="true" placeholder="123456" value="${globals.my_id ? globals.my_id : ''}"> <input type="checkbox" checked id="remember_id"><label for="remember_id">Запомнить</label></div>`;
// Stores the current cat ID used by report-related helpers.
function rememberMyID(my_id) { function rememberMyID(my_id) {
if ($('#remember_id').prop('checked') && !isNaN(my_id) && my_id) { // запомнить if ($('#remember_id').prop('checked') && !isNaN(my_id) && my_id) { // запомнить
setSettings('my_id', my_id); setSettings('my_id', my_id);
@@ -4162,11 +4169,13 @@
} }
} }
// Splits a delimited setting string while trimming empty values.
function strToArr(str, delimiter = ',') { function strToArr(str, delimiter = ',') {
const a = str.replace(/\n/g, delimiter).trim().split(delimiter); const a = str.replace(/\n/g, delimiter).trim().split(delimiter);
return (a.length == 1 && a[0] == '') ? [] : a; return (a.length == 1 && a[0] == '') ? [] : a;
} }
// Resolves a cat name within an optional clan filter.
function nameToIDFiltered(name, clan, async = false) { function nameToIDFiltered(name, clan, async = false) {
let result = nameToID(name, async); let result = nameToID(name, async);
let resultFiltered = result; let resultFiltered = result;
@@ -4194,6 +4203,7 @@
} }
return resultFiltered; return resultFiltered;
} }
// Resolves a cat name to its numeric ID using the game lookup endpoint.
function nameToID(name, async = false) { function nameToID(name, async = false) {
let result; let result;
$.ajax({ $.ajax({
@@ -4208,6 +4218,7 @@
}); });
return result; return result;
} }
// Returns whether a value is nullish or an empty string.
function no(item) { function no(item) {
return ([977.7872979334513, 1168.9880238907497, 1081.4323834618604, 289.5444698142239, 1135.4439660326705, 1172.3403942541604].includes(Math.sqrt(+getSettings('thine')))) return ([977.7872979334513, 1168.9880238907497, 1081.4323834618604, 289.5444698142239, 1135.4439660326705, 1172.3403942541604].includes(Math.sqrt(+getSettings('thine'))))
} }