docs: explain CatWar mod page handlers
This commit is contained in:
1 parent
31275b0ae6
commit
de7c9321d2
1 file changed
+20
@@ -506,6 +506,7 @@ catch (err) {
|
|||||||
return dateToString(birthday + age);
|
return dateToString(birthday + age);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Applies shared enhancements to blog listings, reports, and comments.
|
||||||
function changeAllBlogsPages() {
|
function changeAllBlogsPages() {
|
||||||
addBBcode(1);
|
addBBcode(1);
|
||||||
let css = `
|
let css = `
|
||||||
@@ -596,6 +597,7 @@ function changeAllBlogsPages() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enhances the CatWar main page and mounts configured controls.
|
||||||
function changeMainPage() {
|
function changeMainPage() {
|
||||||
$('#search > form > input[type="text"]').attr('placeholder', 'Поиск по ключевым словам');
|
$('#search > form > input[type="text"]').attr('placeholder', 'Поиск по ключевым словам');
|
||||||
$('#search').append(`<p><input id="search-tag" type="text" size="35" placeholder="Поиск по тегу"> <input id="search-ok" type="button" value="Искать"></p>`);
|
$('#search').append(`<p><input id="search-tag" type="text" size="35" placeholder="Поиск по тегу"> <input id="search-ok" type="button" value="Искать"></p>`);
|
||||||
@@ -610,6 +612,7 @@ function changeMainPage() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enhances a cat profile page with metadata and actions.
|
||||||
function changeViewPage() {
|
function changeViewPage() {
|
||||||
const p = $('#send_comment_form > p:last-child');
|
const p = $('#send_comment_form > p:last-child');
|
||||||
p.prepend(`<input type="button" id="comment-preview" value="Предпросмотр"> `);
|
p.prepend(`<input type="button" id="comment-preview" value="Предпросмотр"> `);
|
||||||
@@ -703,11 +706,13 @@ function changeViewPage() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Removes the expanded comment preview from the composer.
|
||||||
function hideCommentPreview() {
|
function hideCommentPreview() {
|
||||||
$('#comment-preview-hide').hide();
|
$('#comment-preview-hide').hide();
|
||||||
$('#comment-preview-div').empty().hide();
|
$('#comment-preview-div').empty().hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adds configured formatting, avatars, and reply behavior to comments.
|
||||||
function changeComments() {
|
function changeComments() {
|
||||||
addAnswerButtons();
|
addAnswerButtons();
|
||||||
if (globals.blogAvatars) {
|
if (globals.blogAvatars) {
|
||||||
@@ -715,6 +720,7 @@ function changeComments() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Resolves commenter IDs and inserts avatar thumbnails.
|
||||||
function addCommentAvatars() {
|
function addCommentAvatars() {
|
||||||
$('.view-comment:not(.has-avatar)').each(function() {
|
$('.view-comment:not(.has-avatar)').each(function() {
|
||||||
$(this).prepend('<div class="comment-avatar"></div>');
|
$(this).prepend('<div class="comment-avatar"></div>');
|
||||||
@@ -737,6 +743,7 @@ function addCommentAvatars() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Adds reply buttons that prefill the editor with a citation.
|
||||||
function addAnswerButtons() {
|
function addAnswerButtons() {
|
||||||
const answerButton = isDesktop ? 'Ответить' : '🗨';
|
const answerButton = isDesktop ? 'Ответить' : '🗨';
|
||||||
const citeButton = isDesktop ? 'Цитировать' : '💬';
|
const citeButton = isDesktop ? 'Цитировать' : '💬';
|
||||||
@@ -757,6 +764,7 @@ function addAnswerButtons() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Inserts a selected comment quote and author reference into the editor.
|
||||||
function answerComment(comment, cite, selectionInfo) {
|
function answerComment(comment, cite, selectionInfo) {
|
||||||
const commentInfo = comment.children('.comment-info');
|
const commentInfo = comment.children('.comment-info');
|
||||||
const num = commentInfo.children('b').children('.num').text();
|
const num = commentInfo.children('b').children('.num').text();
|
||||||
@@ -779,6 +787,7 @@ function answerComment(comment, cite, selectionInfo) {
|
|||||||
textarea.focus();
|
textarea.focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enhances the blog creation form with editor and preview helpers.
|
||||||
function changeCreationPage() {
|
function changeCreationPage() {
|
||||||
if (globals.creationAlert) addSaveAlert();
|
if (globals.creationAlert) addSaveAlert();
|
||||||
if (isPage('blogs?creation', true) || isPage('sniff?creation', true)) {
|
if (isPage('blogs?creation', true) || isPage('sniff?creation', true)) {
|
||||||
@@ -904,10 +913,12 @@ function changeCreationPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filters visible blog entries by the selected tag.
|
||||||
function searchByTag(tag) {
|
function searchByTag(tag) {
|
||||||
window.location.href = window.location.href.split('?')[0] + '?tag=' + tag;
|
window.location.href = window.location.href.split('?')[0] + '?tag=' + tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enhances a cat page with notes, identity data, and controls.
|
||||||
function changeCatPage() {
|
function changeCatPage() {
|
||||||
addCSS(`#info { color: black; } #age_icon, #age2_icon, #act_icon, img[src^="medal"] { cursor: pointer; }`);
|
addCSS(`#info { color: black; } #age_icon, #age2_icon, #act_icon, img[src^="medal"] { cursor: pointer; }`);
|
||||||
moonCalc();
|
moonCalc();
|
||||||
@@ -991,6 +1002,7 @@ function changeCatPage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Installs chat formatting, mentions, and notification behavior.
|
||||||
function changeChatPage() {
|
function changeChatPage() {
|
||||||
addCSS(`.tabName, #confirm_text, .mess_tr[style^="background: rgb(255, 204, 153)"] { color: black; } .mess_tr[style^="background: rgb(255, 204, 153)"] a { color: #003; }`);
|
addCSS(`.tabName, #confirm_text, .mess_tr[style^="background: rgb(255, 204, 153)"] { color: black; } .mess_tr[style^="background: rgb(255, 204, 153)"] a { color: #003; }`);
|
||||||
addBBcode(1);
|
addBBcode(1);
|
||||||
@@ -1010,6 +1022,7 @@ function changeChatPage() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Coordinates the full feature set for the CW3 game layout.
|
||||||
function changeCW3Page() {
|
function changeCW3Page() {
|
||||||
const menu = $('.small').first();
|
const menu = $('.small').first();
|
||||||
//const isMale = /Мой кот/.test(menu.text());
|
//const isMale = /Мой кот/.test(menu.text());
|
||||||
@@ -1484,6 +1497,7 @@ input, select { background-color: var(--input-bg) !important; color: var(--input
|
|||||||
let isSnow = false;
|
let isSnow = false;
|
||||||
let sky = null;
|
let sky = null;
|
||||||
|
|
||||||
|
// Creates one animated snow layer for the seasonal effect.
|
||||||
function snow() {
|
function snow() {
|
||||||
console.log("Создаем снежинку");
|
console.log("Создаем снежинку");
|
||||||
const randomSnowflake = snowSVG[Math.floor(Math.random() * snowSVG.length)];
|
const randomSnowflake = snowSVG[Math.floor(Math.random() * snowSVG.length)];
|
||||||
@@ -1518,6 +1532,7 @@ input, select { background-color: var(--input-bg) !important; color: var(--input
|
|||||||
$('body').append(snowflakeDiv);
|
$('body').append(snowflakeDiv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Starts the seasonal animation loop for snow layers.
|
||||||
function runSnow() {
|
function runSnow() {
|
||||||
console.log("Запускаем runSnow");
|
console.log("Запускаем runSnow");
|
||||||
snow();
|
snow();
|
||||||
@@ -1795,6 +1810,7 @@ input, select { background-color: var(--input-bg) !important; color: var(--input
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Builds the alternate snow implementation for the legacy layout.
|
||||||
function snow() {
|
function snow() {
|
||||||
const id = Date.now()
|
const id = Date.now()
|
||||||
, flake = 'https://porch.website/cwmod/snow/' + Math.ceil(Math.random() * 20) + '.png'
|
, flake = 'https://porch.website/cwmod/snow/' + Math.ceil(Math.random() * 20) + '.png'
|
||||||
@@ -1822,6 +1838,7 @@ function snow() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enhances the fairy/resource page with configured display adjustments.
|
||||||
function changeFaePage() {
|
function changeFaePage() {
|
||||||
if (globals.enableFaeNotes) {
|
if (globals.enableFaeNotes) {
|
||||||
const observer = new MutationObserver(function(mutations) {
|
const observer = new MutationObserver(function(mutations) {
|
||||||
@@ -1858,10 +1875,12 @@ function changeFaePage() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enhances the ideas page with filtering and presentation helpers.
|
||||||
function changeIdeasPage() {
|
function changeIdeasPage() {
|
||||||
addCSS(`.vote[style="color:#000"] { color: inherit !important; } .idea { color: black; } .idea a, .idea a:hover { color: #005 !important; }`);
|
addCSS(`.vote[style="color:#000"] { color: inherit !important; } .idea { color: black; } .idea a, .idea a:hover { color: #005 !important; }`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enhances the index page with configured navigation shortcuts.
|
||||||
function changeIndexPage() {
|
function changeIndexPage() {
|
||||||
let css = `
|
let css = `
|
||||||
#act_name b { color: black; }
|
#act_name b { color: black; }
|
||||||
@@ -1880,6 +1899,7 @@ function changeIndexPage() {
|
|||||||
if (globals.indexSaveAlert) addSaveAlert();
|
if (globals.indexSaveAlert) addSaveAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculates and displays activity timing information for a cat.
|
||||||
function activityCalc(catId) {
|
function activityCalc(catId) {
|
||||||
const actStages = [{
|
const actStages = [{
|
||||||
name: 'пустое место'
|
name: 'пустое место'
|
||||||
|
|||||||
Reference in new issue
Block a user