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; }`);
|
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() {
|
function changeIndexPage() {
|
||||||
let css = `
|
let css = `
|
||||||
#act_name b { color: black; }
|
#act_name b { color: black; }
|
||||||
@@ -1868,6 +1869,7 @@
|
|||||||
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: 'пустое место'
|
||||||
@@ -2172,10 +2174,12 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Applies helpers specific to the KNS page and its dynamic controls.
|
||||||
function changeKnsPage() {
|
function changeKnsPage() {
|
||||||
if (globals.knsAlert) addSaveAlert();
|
if (globals.knsAlert) addSaveAlert();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Applies helpers specific to the private-message list page.
|
||||||
function changeLsPage() {
|
function changeLsPage() {
|
||||||
addCSS(`
|
addCSS(`
|
||||||
.msg_header { font-size: 1.2rem; text-align: center; }
|
.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) {
|
function addSearchFunc(enableSaving) {
|
||||||
const lastSearch = globals.lsLastSearch;
|
const lastSearch = globals.lsLastSearch;
|
||||||
const lastFolder = lastSearch.folder;
|
const lastFolder = lastSearch.folder;
|
||||||
@@ -2369,6 +2374,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reveals the message search controls and focuses the query field.
|
||||||
function showSearch() {
|
function showSearch() {
|
||||||
$('.active').removeClass('active');
|
$('.active').removeClass('active');
|
||||||
$('#s').addClass('active');
|
$('#s').addClass('active');
|
||||||
@@ -2376,11 +2382,13 @@
|
|||||||
$('#search').show();
|
$('#search').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hides the message search controls and clears transient results.
|
||||||
function hideSearch() {
|
function hideSearch() {
|
||||||
$('#main').show();
|
$('#main').show();
|
||||||
$('#search').hide();
|
$('#search').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Opens the saved-message list panel.
|
||||||
function showSavedLsList() {
|
function showSavedLsList() {
|
||||||
$('.active').removeClass('active');
|
$('.active').removeClass('active');
|
||||||
$('#f3').addClass('active');
|
$('#f3').addClass('active');
|
||||||
@@ -2388,11 +2396,13 @@
|
|||||||
$('#saved').show();
|
$('#saved').show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Closes the saved-message list panel.
|
||||||
function hideSavedLsList() {
|
function hideSavedLsList() {
|
||||||
$('#main').show();
|
$('#main').show();
|
||||||
$('#saved').hide();
|
$('#saved').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initializes message search, saving, and navigation enhancements.
|
||||||
function changeMessagePage() {
|
function changeMessagePage() {
|
||||||
// if ($('#delete-saved-ls').length) return;
|
// if ($('#delete-saved-ls').length) return;
|
||||||
// if ($('.bbcode').length) addBBcode();
|
// if ($('.bbcode').length) addBBcode();
|
||||||
@@ -2448,6 +2458,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Renders one saved message entry and its optional delete button.
|
||||||
function insertSavedLs(main, lsId, ls, btnDelete) {
|
function insertSavedLs(main, lsId, ls, btnDelete) {
|
||||||
const info = `
|
const info = `
|
||||||
${ls.type ? 'Получатель' : 'Отправитель'}: <span id="msg_login" href="/cat${ls.catId}">${ls.catName}</span>
|
${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() {
|
function searchLs() {
|
||||||
const folder = parseInt($('[name="search-folder"]:checked').val(), 10);
|
const folder = parseInt($('[name="search-folder"]:checked').val(), 10);
|
||||||
const searchAll = $('#search-all').is(':checked');
|
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) {
|
function searchAllLs(type, cat, text) {
|
||||||
getCatIdByName(cat, function(catId) {
|
getCatIdByName(cat, function(catId) {
|
||||||
$.post('/ajax/mess_folder', {
|
$.post('/ajax/mess_folder', {
|
||||||
@@ -2583,6 +2596,7 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filters saved messages locally using the same search criteria.
|
||||||
function searchSavedLs(type, cat, text) {
|
function searchSavedLs(type, cat, text) {
|
||||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
||||||
if (savedLs) {
|
if (savedLs) {
|
||||||
@@ -2631,6 +2645,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rebuilds the saved-message list from current persistent settings.
|
||||||
function updateSavedLsList() {
|
function updateSavedLsList() {
|
||||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
||||||
if (savedLs) {
|
if (savedLs) {
|
||||||
@@ -2672,6 +2687,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stores the selected message in the saved-message collection.
|
||||||
function saveLs() {
|
function saveLs() {
|
||||||
try {
|
try {
|
||||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls') || '{}');
|
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) {
|
function deleteSavedLs(lsId) {
|
||||||
try {
|
try {
|
||||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
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) {
|
function getSavedLsById(lsId) {
|
||||||
try {
|
try {
|
||||||
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
const savedLs = JSON.parse(window.localStorage.getItem('cwmod_ls'));
|
||||||
|
|||||||
Reference in new issue
Block a user