docs: explain CatWar utility and page handlers
This commit is contained in:
1 parent
b7a06edef6
commit
c4f8648866
1 file changed
+14
@@ -226,6 +226,7 @@
|
||||
audioGlobal.autoplay = false;
|
||||
audioGlobal.loop = false;
|
||||
|
||||
// Creates and plays a short notification sound at the requested volume.
|
||||
function playAudio(src, vlm) {
|
||||
let audio = audioGlobal;
|
||||
audio.src = src;
|
||||
@@ -233,6 +234,7 @@
|
||||
audio.play();
|
||||
}
|
||||
|
||||
// Reads one user preference, falling back to defaults when unset.
|
||||
function getSettings(key) { //Получение настроек
|
||||
let setting = 'cws_sett_' + key;
|
||||
let val = window.localStorage.getItem(setting);
|
||||
@@ -249,6 +251,7 @@
|
||||
}
|
||||
var error_tm;
|
||||
|
||||
// Displays a transient in-game error message in the shared notification area.
|
||||
function error(t) {
|
||||
$("#error").text(t).show();
|
||||
clearTimeout(error_tm);
|
||||
@@ -257,25 +260,30 @@
|
||||
}, 10000);
|
||||
}
|
||||
|
||||
// Hides the currently displayed error without changing stored settings.
|
||||
function hideError() {
|
||||
clearTimeout(error_tm);
|
||||
$("#error").fadeOut(500);
|
||||
}
|
||||
|
||||
// Persists one preference and updates the in-memory settings cache.
|
||||
function setSettings(key, val) {
|
||||
let setting = 'cws_sett_' + key;
|
||||
window.localStorage.setItem(setting, val);
|
||||
}
|
||||
|
||||
// Removes a preference so subsequent reads use its default value.
|
||||
function removeSettings(key) {
|
||||
let setting = 'cws_sett_' + key;
|
||||
window.localStorage.removeItem(setting);
|
||||
}
|
||||
|
||||
// Injects a style block into the page and returns the created element.
|
||||
function addCSS(css) {
|
||||
$('head').append(`<style>${css}</style>`);
|
||||
}
|
||||
|
||||
// Formats a numeric component with a leading zero for clock-like displays.
|
||||
function leadZero(num) {
|
||||
return (num < 10) ? '0' + num : num;
|
||||
}
|
||||
@@ -357,6 +365,7 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
// Initializes helpers that only apply to the main game page.
|
||||
function cw3() { //Игровая
|
||||
if (globals.on_settLink) {
|
||||
$('.small').first().append(` | <a href="/settings">Настройки модов</a>`); //Настройки мода
|
||||
@@ -1954,6 +1963,7 @@ ${globals.on_treeTechies?`<div><input id="on_treeTechies" type="checkbox" checke
|
||||
}
|
||||
}
|
||||
|
||||
// Enhances the current player's profile and related identity links.
|
||||
function myCat() {
|
||||
$(document).ready(function () {
|
||||
let id = $('#pr table tr:first-child td:last-child a').attr('href').replace('cat', '');
|
||||
@@ -2001,6 +2011,7 @@ ${globals.on_treeTechies?`<div><input id="on_treeTechies" type="checkbox" checke
|
||||
}
|
||||
}
|
||||
|
||||
// Adds navigation and metadata helpers to another player's profile page.
|
||||
function profile() {
|
||||
$.getJSON("https://cat.nyan404.ru/data/river_achievements.json?" + Date.now(), function (data) {
|
||||
const achievements = data,
|
||||
@@ -2048,6 +2059,7 @@ ${globals.on_treeTechies?`<div><input id="on_treeTechies" type="checkbox" checke
|
||||
});
|
||||
}
|
||||
|
||||
// Enhances direct-message pages with IDs and conversation conveniences.
|
||||
function dm() { //ЛС игрока
|
||||
if (globals.on_idDM) {
|
||||
function add_id() {
|
||||
@@ -2068,6 +2080,7 @@ ${globals.on_treeTechies?`<div><input id="on_treeTechies" type="checkbox" checke
|
||||
}
|
||||
}
|
||||
|
||||
// Applies hunting-page controls, timers, and mobile interaction fixes.
|
||||
function hunt() {
|
||||
if (globals.on_css_bghuntpic) {
|
||||
$('head').append(`<style id="cwsstyle_on_css_bghuntpic">html { background: url('${globals.css_huntbgpicURL}') !important; }</style>`);
|
||||
@@ -2253,6 +2266,7 @@ height: 2.3em;
|
||||
}
|
||||
}
|
||||
|
||||
// Enhances blog/report pages with the configured report tools.
|
||||
function blog() {
|
||||
if (globals.on_reports) {
|
||||
$(document).ready(function () {
|
||||
|
||||
Reference in new issue
Block a user