docs: explain shared message page helpers
This commit is contained in:
1 parent
80b107cad3
commit
c3603692a2
1 file changed
+18
@@ -1850,6 +1850,7 @@
|
||||
addCSS(`.vote[style="color:#000"] { color: inherit !important; } .idea { color: black; } .idea a, .idea a:hover { color: #005 !important; }`);
|
||||
}
|
||||
|
||||
// Enhances the CatWar index page with configured navigation shortcuts.
|
||||
function changeIndexPage() {
|
||||
let css = `
|
||||
#act_name b { color: black; }
|
||||
@@ -1868,6 +1869,7 @@
|
||||
if (globals.indexSaveAlert) addSaveAlert();
|
||||
}
|
||||
|
||||
// Calculates and displays activity timing information for a cat.
|
||||
function activityCalc(catId) {
|
||||
const actStages = [{
|
||||
name: 'пустое место'
|
||||
@@ -2172,10 +2174,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Applies helpers specific to the KNS page and its dynamic controls.
|
||||
function changeKnsPage() {
|
||||
if (globals.knsAlert) addSaveAlert();
|
||||
}
|
||||
|
||||
// Applies helpers specific to the private-message list page.
|
||||
function changeLsPage() {
|
||||
addCSS(`
|
||||
.msg_header { font-size: 1.2rem; text-align: center; }
|
||||
@@ -2322,6 +2326,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Builds the message search UI and optionally enables saved-search actions.
|
||||
function addSearchFunc(enableSaving) {
|
||||
const lastSearch = globals.lsLastSearch;
|
||||
const lastFolder = lastSearch.folder;
|
||||
@@ -2369,6 +2374,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Reveals the message search controls and focuses the query field.
|
||||
function showSearch() {
|
||||
$('.active').removeClass('active');
|
||||
$('#s').addClass('active');
|
||||
@@ -2376,11 +2382,13 @@
|
||||
$('#search').show();
|
||||
}
|
||||
|
||||
// Hides the message search controls and clears transient results.
|
||||
function hideSearch() {
|
||||
$('#main').show();
|
||||
$('#search').hide();
|
||||
}
|
||||
|
||||
// Opens the saved-message list panel.
|
||||
function showSavedLsList() {
|
||||
$('.active').removeClass('active');
|
||||
$('#f3').addClass('active');
|
||||
@@ -2388,11 +2396,13 @@
|
||||
$('#saved').show();
|
||||
}
|
||||
|
||||
// Closes the saved-message list panel.
|
||||
function hideSavedLsList() {
|
||||
$('#main').show();
|
||||
$('#saved').hide();
|
||||
}
|
||||
|
||||
// Initializes message search, saving, and navigation enhancements.
|
||||
function changeMessagePage() {
|
||||
// if ($('#delete-saved-ls').length) return;
|
||||
// if ($('.bbcode').length) addBBcode();
|
||||
@@ -2448,6 +2458,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Renders one saved message entry and its optional delete button.
|
||||
function insertSavedLs(main, lsId, ls, btnDelete) {
|
||||
const info = `
|
||||
${ls.type ? 'Получатель' : 'Отправитель'}: <span id="msg_login" href="/cat${ls.catId}">${ls.catName}</span>
|
||||
@@ -2512,6 +2523,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Searches the currently loaded message list using active filter fields.
|
||||
function searchLs() {
|
||||
const folder = parseInt($('[name="search-folder"]:checked').val(), 10);
|
||||
const searchAll = $('#search-all').is(':checked');
|
||||
@@ -2540,6 +2552,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Searches all server-side messages matching type, cat, and text filters.
|
||||
function searchAllLs(type, cat, text) {
|
||||
getCatIdByName(cat, function(catId) {
|
||||
$.post('/ajax/mess_folder', {
|
||||
@@ -2583,6 +2596,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
// Filters saved messages locally using the same search criteria.
|
||||
function searchSavedLs(type, cat, text) {
|
||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
||||
if (savedLs) {
|
||||
@@ -2631,6 +2645,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Rebuilds the saved-message list from current persistent settings.
|
||||
function updateSavedLsList() {
|
||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
||||
if (savedLs) {
|
||||
@@ -2672,6 +2687,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Stores the selected message in the saved-message collection.
|
||||
function saveLs() {
|
||||
try {
|
||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls') || '{}');
|
||||
@@ -2711,6 +2727,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Removes one saved message and refreshes the visible list.
|
||||
function deleteSavedLs(lsId) {
|
||||
try {
|
||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
||||
@@ -2723,6 +2740,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Returns a saved message by identifier, or null when absent.
|
||||
function getSavedLsById(lsId) {
|
||||
try {
|
||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
||||
|
||||
Reference in new issue
Block a user