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