add posts scrolling function and ability to disabl

This commit is contained in:
mrilyew 2024-11-17 16:08:15 +03:00
parent e3b5d60f89
commit c77a6cc54f
14 changed files with 50 additions and 22 deletions

View file

@ -53,9 +53,9 @@ class Posts
$offset--; $offset--;
} }
} }
} else if(!is_null($offset)) { } /*else if(!is_null($offset)) {
$offset--; $offset--;
} }*/
$sel = $this->posts->where([ $sel = $this->posts->where([
"wall" => $user, "wall" => $user,

View file

@ -391,6 +391,7 @@
{script "js/al_polls.js"} {script "js/al_polls.js"}
{script "js/al_suggestions.js"} {script "js/al_suggestions.js"}
{script "js/al_navigation.js"} {script "js/al_navigation.js"}
{script "js/al_comments.js"}
{ifset $thisUser} {ifset $thisUser}
{script "js/al_notifs.js"} {script "js/al_notifs.js"}

View file

@ -29,7 +29,7 @@
</div> </div>
<div class='page_wrap_content' id='search_page'> <div class='page_wrap_content' id='search_page'>
<div n:class='page_wrap_content_main, $section != "posts" ? scroll_container, $section == "audios" && $count > 0 ? audios_padding'> <div n:class='page_wrap_content_main, scroll_container, $section == "audios" && $count > 0 ? audios_padding'>
{if $count > 0} {if $count > 0}
{if $section === 'users'} {if $section === 'users'}
<div class='scroll_node search_content content def_row_content' n:foreach="$data as $dat"> <div class='scroll_node search_content content def_row_content' n:foreach="$data as $dat">

View file

@ -122,8 +122,8 @@
<h4>{_search_group}</h4> <h4>{_search_group}</h4>
<span>{_search_group_desc}</span> <span>{_search_group_desc}</span>
<form action="/search"> <form action="/search">
<input name="type" type="hidden" value="groups"> <input name="section" type="hidden" value="groups">
<input name="query" class="header_search_input" value="" style="background: none; width: 155px; padding-left: 3px;"> <input name="q" class="header_search_input" value="" style="background: none; width: 155px; padding-left: 3px;">
<button class="button">{_search_by_groups}</button> <button class="button">{_search_by_groups}</button>
</form> </form>
</div> </div>

View file

@ -23,10 +23,12 @@
{include "../components/textArea.xml", route => "/wall" . $thisUser->getId() . "/makePost", graffiti => true, polls => true, notes => true, hasSource => true} {include "../components/textArea.xml", route => "/wall" . $thisUser->getId() . "/makePost", graffiti => true, polls => true, notes => true, hasSource => true}
</div> </div>
{foreach $posts as $post} <div class='scroll_container'>
<div class='scroll_node' n:foreach='$posts as $post'>
<a name="postGarter={$post->getId()}"></a> <a name="postGarter={$post->getId()}"></a>
{include "../components/post.xml", post => $post, onWallOf => true, commentSection => true} {include "../components/post.xml", post => $post, onWallOf => true, commentSection => true}
{/foreach} </div>
</div>
<div class="postFeedBottom"> <div class="postFeedBottom">
<div class="postFeedPaginator"> <div class="postFeedPaginator">

View file

@ -31,13 +31,13 @@
{include "../components/textArea.xml", route => "/wall$owner/makePost", hasSource => true} {include "../components/textArea.xml", route => "/wall$owner/makePost", hasSource => true}
</div> </div>
<div class="content"> <div class="content scroll_container">
{if sizeof($posts) > 0} {if sizeof($posts) > 0}
{foreach $posts as $post} <div class='scroll_node' n:foreach='$posts as $post'>
<a name="postGarter={$post->getId()}"></a> <a name="postGarter={$post->getId()}"></a>
{include "../components/post.xml", post => $post, commentSection => true} {include "../components/post.xml", post => $post, commentSection => true}
{/foreach} </div>
{include "../components/paginator.xml", conf => $paginatorConf} {include "../components/paginator.xml", conf => $paginatorConf}
{else} {else}
{_no_posts_abstract} {_no_posts_abstract}

View file

@ -20,5 +20,3 @@
{else} {else}
{_comments_tip} {_comments_tip}
{/if} {/if}
{script "js/al_comments.js"}

View file

@ -13,13 +13,13 @@
{include "../components/textArea.xml", route => "/wall$owner/makePost", graffiti => true, polls => true, notes => true, hasSource => true} {include "../components/textArea.xml", route => "/wall$owner/makePost", graffiti => true, polls => true, notes => true, hasSource => true}
</div> </div>
<div class="content"> <div class="content scroll_container">
{if sizeof($posts) > 0} {if sizeof($posts) > 0}
{foreach $posts as $post} <div class='scroll_node' n:foreach='$posts as $post'>
<a name="postGarter={$post->getId()}"></a> <a name="postGarter={$post->getId()}"></a>
{include "../components/post.xml", post => $post, commentSection => true} {include "../components/post.xml", post => $post, commentSection => true}
{/foreach} </div>
{include "../components/paginator.xml", conf => $paginatorConf} {include "../components/paginator.xml", conf => $paginatorConf}
{else} {else}
{_no_posts_abstract} {_no_posts_abstract}

View file

@ -8,6 +8,8 @@ u(document).on("click", ".comment-reply", function(e) {
let mention = ("[" + (fromGroup ? "club" : "id") + authorId + "|" + authorNm + "], "); let mention = ("[" + (fromGroup ? "club" : "id") + authorId + "|" + authorNm + "], ");
// Substitute pervious mention if present, prepend otherwise // Substitute pervious mention if present, prepend otherwise
inputbox.nodes[0].value = inputbox.nodes[0].value.replace(/(^\[([A-Za-z0-9]+)\|([\p{L} 0-9@]+)\], |^)/u, mention); inputbox.nodes.forEach(node => {
node.value = node.value.replace(/(^\[([A-Za-z0-9]+)\|([\p{L} 0-9@]+)\], |^)/u, mention);
})
inputbox.trigger("focusin"); inputbox.trigger("focusin");
}); });

View file

@ -84,6 +84,7 @@ u(document).on('click', '#__feed_settings_link', (e) => {
const CURRENT_PERPAGE = Number(__temp_url.searchParams.get('posts') ?? 10) const CURRENT_PERPAGE = Number(__temp_url.searchParams.get('posts') ?? 10)
const CURRENT_PAGE = Number(__temp_url.searchParams.get('p') ?? 1) const CURRENT_PAGE = Number(__temp_url.searchParams.get('p') ?? 1)
const CURRENT_RETURN_BANNED = Number(__temp_url.searchParams.get('return_banned') ?? 0) const CURRENT_RETURN_BANNED = Number(__temp_url.searchParams.get('return_banned') ?? 0)
const CURRENT_AUTO_SCROLL = Number(localStorage.getItem('ux.auto_scroll') ?? 1)
const COUNT = [1, 5, 10, 20, 30, 40, 50] const COUNT = [1, 5, 10, 20, 30, 40, 50]
u('#_feed_settings_container #__content').html(` u('#_feed_settings_container #__content').html(`
<table cellspacing="7" cellpadding="0" border="0" align="center"> <table cellspacing="7" cellpadding="0" border="0" align="center">
@ -107,11 +108,21 @@ u(document).on('click', '#__feed_settings_link', (e) => {
<tr> <tr>
<td width="120" valign="top"> <td width="120" valign="top">
<span class="nobold"> <span class="nobold">
<input type='checkbox' id="showIgnored" ${CURRENT_RETURN_BANNED == 1 ? 'checked' : ''}> <input type='checkbox' name='showIgnored' id="showIgnored" ${CURRENT_RETURN_BANNED == 1 ? 'checked' : ''}>
</span> </span>
</td> </td>
<td> <td>
${tr('show_ignored_sources')} <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' name='ux.auto_scroll' id="ux.auto_scroll" ${CURRENT_AUTO_SCROLL == 1 ? 'checked' : ''}>
</span>
</td>
<td>
<label for='ux.auto_scroll'>${tr('auto_scroll')}</label>
</td> </td>
</tr> </tr>
<tr> <tr>
@ -268,3 +279,7 @@ u(document).on('click', '#__feed_settings_link', (e) => {
__switchTab('main') __switchTab('main')
}) })
u(document).on('change', `input[data-act='localstorage_item']`, (e) => {
localStorage.setItem(e.target.name, Number(e.target.checked))
})

View file

@ -19,7 +19,8 @@ var tooltipTemplate = Handlebars.compile(`
</table> </table>
`); `);
tippy(".mention", { tippy.delegate("body", {
target: '.mention',
theme: "light vk", theme: "light vk",
content: "⌛", content: "⌛",
allowHTML: true, allowHTML: true,

View file

@ -399,6 +399,7 @@ async function OpenVideo(video_arr = [], init_player = true)
details.find('.media-page-wrapper-description b').remove() details.find('.media-page-wrapper-description b').remove()
u('#ovk-player-info').html(details.html()) u('#ovk-player-info').html(details.html())
bsdnHydrate()
} }
}) })
@ -542,7 +543,8 @@ var tooltipClientNoInfoTemplate = Handlebars.compile(`
</table> </table>
`); `);
tippy(".client_app", { tippy.delegate("body", {
target: '.client_app',
theme: "light vk", theme: "light vk",
content: "⌛", content: "⌛",
allowHTML: true, allowHTML: true,
@ -2039,6 +2041,10 @@ async function __processPaginatorNextPage(page)
const showMoreObserver = new IntersectionObserver(entries => { const showMoreObserver = new IntersectionObserver(entries => {
entries.forEach(async x => { entries.forEach(async x => {
if(x.isIntersecting) { if(x.isIntersecting) {
if(Number(localStorage.getItem('ux.auto_scroll') ?? 1) == 0) {
return
}
if(u('.scroll_container').length < 1) { if(u('.scroll_container').length < 1) {
return return
} }
@ -2063,6 +2069,7 @@ const showMoreObserver = new IntersectionObserver(entries => {
const page_number = Number(next_page.html()) const page_number = Number(next_page.html())
await __processPaginatorNextPage(page_number) await __processPaginatorNextPage(page_number)
bsdnHydrate()
u('.paginator:not(.paginator-at-top)').removeClass('lagged') u('.paginator:not(.paginator-at-top)').removeClass('lagged')
} }
}) })

View file

@ -220,6 +220,7 @@
"all_news" = "All news"; "all_news" = "All news";
"posts_per_page" = "Number of posts per page"; "posts_per_page" = "Number of posts per page";
"show_ignored_sources" = "Show ignored sources"; "show_ignored_sources" = "Show ignored sources";
"auto_scroll" = "Autoscroll";
"attachment" = "Attachment"; "attachment" = "Attachment";
"post_as_group" = "Post as group"; "post_as_group" = "Post as group";

View file

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