feat(ajax): add ability to turn off ajax routing

there is no logic in this checkbox place but i didnt knew where to put it.
This commit is contained in:
mrilyew 2025-01-05 19:19:50 +03:00
parent 3f2fbd94f0
commit f66dd0c7bd
4 changed files with 19 additions and 1 deletions

View file

@ -457,7 +457,7 @@
"audio_genres": {\openvk\Web\Models\Entities\Audio::genres},
"at_search": {$atSearch ?? false},
"max_attachments": {\OPENVK_ROOT_CONF["openvk"]["preferences"]["wall"]["postSizes"]["maxAttachments"] ?? 10},
"max_filesize_mb": 5,
"max_filesize_mb": 100,
"current_id": {$thisUser ? $thisUser->getId() : 0},
"disable_ajax": {$disable_ajax ? $disable_ajax : 0},
"max_add_fields": {ovkGetQuirk("users.max-fields")},

View file

@ -85,6 +85,7 @@ u(document).on('click', '#__feed_settings_link', (e) => {
const CURRENT_PAGE = Number(__temp_url.searchParams.get('p') ?? 1)
const CURRENT_RETURN_BANNED = Number(__temp_url.searchParams.get('return_banned') ?? 0)
const CURRENT_AUTO_SCROLL = Number(localStorage.getItem('ux.auto_scroll') ?? 1)
const CURRENT_DISABLE_AJAX = Number(localStorage.getItem('ux.disable_ajax_routing') ?? 0)
const COUNT = [1, 5, 10, 20, 30, 40, 50]
u('#_feed_settings_container #__content').html(`
<table cellspacing="7" cellpadding="0" border="0" align="center">
@ -115,6 +116,16 @@ u(document).on('click', '#__feed_settings_link', (e) => {
<label for='showIgnored'>${tr('show_ignored_sources')}</label>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">
<input type='checkbox' data-act='localstorage_item' data-inverse="1" name='ux.disable_ajax_routing' id="ux.disable_ajax_routing" ${CURRENT_DISABLE_AJAX == 0 ? 'checked' : ''}>
</span>
</td>
<td>
<label for='ux.disable_ajax_routing'>${tr('ajax_routing')}</label>
</td>
</tr>
<tr>
<td width="120" valign="top">
<span class="nobold">
@ -281,5 +292,10 @@ u(document).on('click', '#__feed_settings_link', (e) => {
})
u(document).on('change', `input[data-act='localstorage_item']`, (e) => {
if(e.target.dataset.inverse) {
localStorage.setItem(e.target.name, Number(!e.target.checked))
return
}
localStorage.setItem(e.target.name, Number(e.target.checked))
})

View file

@ -237,6 +237,7 @@
"posts_per_page" = "Number of posts per page";
"show_ignored_sources" = "Show ignored sources";
"auto_scroll" = "Autoscroll";
"ajax_routing" = "AJAX-transitions";
"attachment" = "Attachment";
"post_as_group" = "Post as group";

View file

@ -222,6 +222,7 @@
"posts_per_page" = "Количество записей на странице";
"show_ignored_sources" = "Показывать игнорируемые источники";
"auto_scroll" = "Автоматическая прокрутка";
"ajax_routing" = "AJAX-переходы";
"attachment" = "Вложение";
"post_as_group" = "От имени сообщества";
"comment_as_group" = "От имени сообщества";