This commit is contained in:
mrilyew 2024-11-01 13:52:39 +00:00 committed by GitHub
commit f05b993947
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
28 changed files with 120 additions and 89 deletions

View file

@ -34,7 +34,7 @@ final class SearchPresenter extends OpenVKPresenter
$order = $this->queryParam("order") ?? "id"; $order = $this->queryParam("order") ?? "id";
$invert = (int) ($this->queryParam("invert") ?? 0) == 1; $invert = (int) ($this->queryParam("invert") ?? 0) == 1;
$page = (int) ($this->queryParam("p") ?? 1); $page = (int) ($this->queryParam("p") ?? 1);
# https://youtu.be/pSAWM5YuXx8 # https://youtu.be/pSAWM5YuXx8
# https://youtu.be/FfNZRhIn2Vk # https://youtu.be/FfNZRhIn2Vk

View file

@ -544,6 +544,9 @@ final class UserPresenter extends OpenVKPresenter
if(in_array($this->postParam("main_page"), [0, 1])) if(in_array($this->postParam("main_page"), [0, 1]))
$user->setMain_Page((int) $this->postParam("main_page")); $user->setMain_Page((int) $this->postParam("main_page"));
if(in_array($this->postParam("paginator"), [0, 1]))
$user->setPaginator_type((int) $this->postParam("paginator"));
} else if($_GET['act'] === "lMenu") { } else if($_GET['act'] === "lMenu") {
$settings = [ $settings = [
"menu_bildoj" => "photos", "menu_bildoj" => "photos",

View file

@ -19,7 +19,7 @@
{ifset specpage} {ifset specpage}
{include specpage, x => $dat} {include specpage, x => $dat}
{else} {else}
<div class="container_gray"> <div class="container_gray infContainer">
{var $data = is_array($iterator) ? $iterator : iterator_to_array($iterator)} {var $data = is_array($iterator) ? $iterator : iterator_to_array($iterator)}
{ifset top} {ifset top}
@ -27,7 +27,7 @@
{/ifset} {/ifset}
{if sizeof($data) > 0} {if sizeof($data) > 0}
<div class="content" n:foreach="$data as $dat"> <div class="content infObj" n:foreach="$data as $dat">
<table> <table>
<tbody n:attr="id => is_null($table_body_id) ? NULL : $table_body_id"> <tbody n:attr="id => is_null($table_body_id) ? NULL : $table_body_id">
<tr> <tr>

View file

@ -17,9 +17,9 @@
</div> </div>
{if sizeof($corresps) > 0} {if sizeof($corresps) > 0}
<div class="crp-list"> <div class="crp-list infContainer">
<div n:foreach="$corresps as $coresp" <div n:foreach="$corresps as $coresp"
class="crp-entry" class="crp-entry infObj"
onmousedown="window.location.href = {$coresp->getURL()};" > onmousedown="window.location.href = {$coresp->getURL()};" >
{var $recipient = $coresp->getCorrespondents()[1]} {var $recipient = $coresp->getCorrespondents()[1]}
{var $lastMsg = $coresp->getPreviewMessage()} {var $lastMsg = $coresp->getPreviewMessage()}

View file

@ -60,12 +60,12 @@
} }
</style> </style>
<div class="container_gray" style="background: white; border-top: none;"> <div class="container_gray infContainer" style="background: white; border-top: none;">
{var $data = is_array($iterator) ? $iterator : iterator_to_array($iterator)} {var $data = is_array($iterator) ? $iterator : iterator_to_array($iterator)}
{if sizeof($data) > 0} {if sizeof($data) > 0}
<div n:foreach="$data as $dat"> <div n:foreach="$data as $dat" class="infObj">
<div class="profile_thumb"> <div class="profile_thumb">
<a href="{$owner->getURL()}"> <a href="{$owner->getURL()}">
<img src="{$owner->getAvatarUrl('miniscule')}" style="width: 50px;"> <img src="{$owner->getAvatarUrl('miniscule')}" style="width: 50px;">
@ -105,7 +105,15 @@
</div> </div>
</div> </div>
</article> </article>
</div> </div>
{include "../components/paginator.xml", conf => (object) [
"page" => $page,
"count" => $count,
"amount" => sizeof($data),
"perPage" => $perPage ?? OPENVK_DEFAULT_PER_PAGE,
"atBottom" => true,
]}
{else} {else}
{if isset($thisUser) && $thisUser->getId() == $owner->getId()} {if isset($thisUser) && $thisUser->getId() == $owner->getId()}

View file

@ -77,6 +77,7 @@
page => $cPage, page => $cPage,
model => "notes", model => "notes",
parent => $note, parent => $note,
showTitle => false} showTitle => false,
fromPost => true}
</div> </div>
{/block} {/block}

View file

@ -30,10 +30,10 @@
{/if} {/if}
<br/><br/> <br/><br/>
{if $album->getPhotosCount() > 0} {if $album->getPhotosCount() > 0}
<div class="container_gray album-flex"> <div class="container_gray album-flex infContainer">
{foreach $photos as $photo} {foreach $photos as $photo}
{php if($photo->isDeleted()) continue; } {php if($photo->isDeleted()) continue; }
<div class="album-photo"> <div class="album-photo infObj">
<a <a
n:if="!is_null($thisUser) && $album->canBeModifiedBy($thisUser)" n:if="!is_null($thisUser) && $album->canBeModifiedBy($thisUser)"
href="/album{$album->getPrettyId()}/remove_photo/{$photo->getId()}" class="album-photo--delete"> href="/album{$album->getPrettyId()}/remove_photo/{$photo->getId()}" class="album-photo--delete">

View file

@ -122,62 +122,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div> </div
<script n:if='$count > 0 && !empty($query)'>
highlightText({$query}, '.page_wrap_content_main', ['text'])
</script>
{elseif $section === 'groups'}
<div class='search_content content def_row_content' n:foreach="$data as $dat">
<table>
<tbody>
<tr>
<td valign="top">
<a href="{$dat->getURL()}">
<img src="{$dat->getAvatarUrl('tiny')}" width="75" alt="{_photo}" loading='lazy' />
</a>
</td>
<td valign="top" style="width: 100%">
<a href="{$dat->getURL()}">
<b>
<text style="overflow: hidden;">&nbsp;{$dat->getCanonicalName()}
{if $order == "id"}
(id{$dat->getId()})
{/if}
</text>
<img n:if="$dat->isVerified()"
class="name-checkmark"
src="/assets/packages/static/openvk/img/checkmark.png"
/>
</b>
</a>
<table class="ugc-table">
<tbody>
{if !empty($dat->getDescription())}
<tr>
<td>
<span class="nobold">{_description}:</span>
</td>
<td data-highlight='_clubDesc'>
{$dat->getDescription() ?? '(' . tr("none") . ')'}
</td>
</tr>
{/if}
<td>
<span class="nobold">{_size}:</span>
</td>
<td>
{tr("participants", $dat->getFollowersCount())}
</td>
</tbody>
</table>
<br/>
</td>
</tr>
</tbody>
</table>
</div>
<script n:if='$count > 0 && !empty($query)'> <script n:if='$count > 0 && !empty($query)'>
highlightText({$query}, '.page_wrap_content_main', ['text', "td[data-highlight='_clubDesc']"]) highlightText({$query}, '.page_wrap_content_main', ['text', "td[data-highlight='_clubDesc']"])

View file

@ -57,7 +57,8 @@
{/if} {/if}
{if $isList} {if $isList}
<table n:foreach="$tickets as $ticket" border="0" style="font-size: 11px; width: 610px;" class="post"> <div class="infContainer">
<table n:foreach="$tickets as $ticket" border="0" style="font-size: 11px; width: 610px;" class="post infObj">
<tbody> <tbody>
<tr> <tr>
<td width="54" valign="top"> <td width="54" valign="top">
@ -78,6 +79,7 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
</div>
{if $count < 1} {if $count < 1}
{include "../components/nothing.xml"} {include "../components/nothing.xml"}

View file

@ -584,6 +584,17 @@
</select> </select>
</td> </td>
</tr> </tr>
<tr>
<td width="120" valign="top">
<span class="nobold">{_ui_settings_paginator}</span>
</td>
<td>
<select name="paginator">
<option value="0" {if $user->getPaginatorType() == 0}selected{/if}>{_ui_settings_paginator_old}</option>
<option value="1" {if $user->getPaginatorType() == 1}selected{/if}>{_ui_settings_paginator_new}</option>
</select>
</td>
</tr>
<tr> <tr>
<td width="120" valign="top" align="right"> <td width="120" valign="top" align="right">
<input type="checkbox" name="theme_for_session" value="1"> <input type="checkbox" name="theme_for_session" value="1">

View file

@ -35,7 +35,8 @@
count => $cCount, count => $cCount,
page => $cPage, page => $cPage,
model => "videos", model => "videos",
parent => $video} parent => $video,
fromPost => true}
</div> </div>
<div style="float: left; min-height: 100px; width: 30%; overflow: hidden; overflow-wrap: break-word;"> <div style="float: left; min-height: 100px; width: 30%; overflow: hidden; overflow-wrap: break-word;">
<div> <div>

View file

@ -21,12 +21,16 @@
{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="infContainer">
<a name="postGarter={$post->getId()}"></a> {foreach $posts as $post}
{include "../components/post.xml", post => $post, onWallOf => true, commentSection => true} <div class="infObj">
{/foreach} <a name="postGarter={$post->getId()}"></a>
{include "../components/post.xml", post => $post, onWallOf => true, commentSection => true}
</div>
{/foreach}
</div>
<div class="postFeedBottom"> <div class="postFeedBottom" n:if="$thisUser->getPaginatorType() == 0">
<div class="postFeedPaginator"> <div class="postFeedPaginator">
{include "../components/paginator.xml", conf => $paginatorConf} {include "../components/paginator.xml", conf => $paginatorConf}
</div> </div>
@ -45,7 +49,11 @@
</div> </div>
</div> </div>
<script> {if $thisUser->getPaginatorType() == 1}
{include "../components/paginator.xml", conf => $paginatorConf}
{/if}
<script n:if="$thisUser->getPaginatorType() == 0">
u("#pageSelect").nodes[0].value = {$paginatorConf->perPage}; u("#pageSelect").nodes[0].value = {$paginatorConf->perPage};
u("#pageSelect").on("change", function(e) { u("#pageSelect").on("change", function(e) {

View file

@ -6,7 +6,7 @@
{/block} {/block}
{block content} {block content}
<center> <center class="infContainer">
{foreach $posts as $post} {foreach $posts as $post}
<a name="postGarter={$post->getId()}"></a> <a name="postGarter={$post->getId()}"></a>

View file

@ -36,7 +36,8 @@
count => $cCount, count => $cCount,
page => $cPage, page => $cPage,
model => "posts", model => "posts",
parent => $post } parent => $post,
fromPost => true }
</div> </div>
<div style="float: left; min-height: 100px; width: 32%;"> <div style="float: left; min-height: 100px; width: 32%;">
<h4>{_actions}</h4> <h4>{_actions}</h4>

View file

@ -31,7 +31,7 @@
{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 infContainer">
{if sizeof($posts) > 0} {if sizeof($posts) > 0}
{foreach $posts as $post} {foreach $posts as $post}
<a name="postGarter={$post->getId()}"></a> <a name="postGarter={$post->getId()}"></a>

View file

@ -8,15 +8,19 @@
{/if} {/if}
</div> </div>
<div class="infContainer">
{if sizeof($comments) > 0} {if sizeof($comments) > 0}
<div class="{if ($fromPost ?? false)}infObj{/if}">
{foreach $comments as $comment} {foreach $comments as $comment}
{include "comment.xml", comment => $comment} {include "comment.xml", comment => $comment}
{/foreach} {/foreach}
</div>
<div style="margin-top: 11px;"> <div style="margin-top: 11px;">
{include "paginator.xml", conf => (object) ["page" => $page, "count" => $count, "amount" => sizeof($comments), "perPage" => 10]} {include "paginator.xml", conf => (object) ["page" => $page, "count" => $count, "amount" => sizeof($comments), "perPage" => 10]}
</div> </div>
{else} {else}
{_comments_tip} {_comments_tip}
{/if} {/if}
</div>
{script "js/al_comments.js"} {script "js/al_comments.js"}

View file

@ -0,0 +1,5 @@
{var $pageCount = ceil($conf->count / $conf->perPage)}
<div n:if="!($conf->page === 1 && $conf->count <= $conf->perPage) && $conf->page < $pageCount" class="showMore" data-pageсount="{$pageCount}" data-page="{$conf->page}">
{_show_more}
</div>

View file

@ -0,0 +1,12 @@
{var $space = 3}
{var $pageCount = ceil($conf->count / $conf->perPage)}
<div n:if="!($conf->page === 1 && $conf->count <= $conf->perPage)" style="padding: 8px;">
<div n:class="paginator, ($conf->atBottom ?? false) ? paginator-at-bottom">
<a n:if="$conf->page > $space" n:attr="class => ($conf->page === 1 ? 'active')" href="?{http_build_query(array_merge($_GET, ['p' => 1]), 'k', '&', PHP_QUERY_RFC3986)}">&laquo;</a>
{for $j = $conf->page - ($space-1); $j <= $conf->page + ($space-1); $j++}
<a n:if="$j > 0 && $j <= $pageCount" n:attr="class => ($conf->page === $j ? 'active')" href="?{http_build_query(array_merge($_GET, ['p' => $j]), 'k', '&', PHP_QUERY_RFC3986)}">{$j}</a>
{/for}
<a n:if="$conf->page <= $pageCount-$space" n:attr="class => ($conf->page === $pageCount ? 'active')" href="?{http_build_query(array_merge($_GET, ['p' => $pageCount]), 'k', '&', PHP_QUERY_RFC3986)}">&raquo;</a>
</div>
</div>

View file

@ -4,7 +4,7 @@
<div id="write" style="padding: 5px 0;" onfocusin="expand_wall_textarea({$textAreaId});"> <div id="write" style="padding: 5px 0;" onfocusin="expand_wall_textarea({$textAreaId});">
<form action="{$route}" method="post" enctype="multipart/form-data" style="margin:0;"> <form action="{$route}" method="post" enctype="multipart/form-data" style="margin:0;">
<textarea id="wall-post-input{$textAreaId}" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea> <textarea id="wall-post-input{$textAreaId}" data-id="{$textAreaId}" placeholder="{_write}" name="text" style="width: 100%;resize: none;" class="small-textarea"></textarea>
<div> <div>
<!-- padding to fix <br/> bug --> <!-- padding to fix <br/> bug -->
</div> </div>

View file

@ -13,12 +13,14 @@
{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 infContainer">
{if sizeof($posts) > 0} {if sizeof($posts) > 0}
{foreach $posts as $post} {foreach $posts as $post}
<a name="postGarter={$post->getId()}"></a> <div class="infObj">
<a name="postGarter={$post->getId()}"></a>
{include "../components/post.xml", post => $post, commentSection => true}
{include "../components/post.xml", post => $post, commentSection => true}
</div>
{/foreach} {/foreach}
{include "../components/paginator.xml", conf => $paginatorConf} {include "../components/paginator.xml", conf => $paginatorConf}
{else} {else}

View file

@ -2531,7 +2531,6 @@ a.poll-retract-vote {
background-image: url(/assets/packages/static/openvk/img/videoico.png); background-image: url(/assets/packages/static/openvk/img/videoico.png);
display: none; display: none;
} }
/* Da search */ /* Da search */
/* Header part */ /* Header part */

View file

@ -1,4 +1,4 @@
u(".comment-reply").on("click", function(e) { $(document).on("click", ".comment-reply", function(e) {
let comment = u(e.target).closest(".post"); let comment = u(e.target).closest(".post");
let authorId = comment.data("owner-id"); let authorId = comment.data("owner-id");
let authorNm = u(".post-author > a > b", comment.first()).text().trim(); let authorNm = u(".post-author > a > b", comment.first()).text().trim();

View file

@ -19,6 +19,8 @@ var tooltipTemplate = Handlebars.compile(`
</table> </table>
`); `);
function initMentions() {
tippy(".mention", { tippy(".mention", {
theme: "light vk", theme: "light vk",
content: "⌛", content: "⌛",
@ -40,3 +42,6 @@ tippy(".mention", {
that.setContent(tooltipTemplate(res)); that.setContent(tooltipTemplate(res));
} }
}); });
}
initMentions()

View file

@ -378,7 +378,7 @@ function OpenMiniature(e, photo, post, photo_id, type = "post") {
return u(".ovk-photo-view-dimmer"); return u(".ovk-photo-view-dimmer");
} }
u("#write > form").on("keydown", function(event) { $(document).on("keydown", "#write > form", function(event) {
if(event.ctrlKey && event.keyCode === 13) if(event.ctrlKey && event.keyCode === 13)
this.submit(); this.submit();
}); });
@ -412,6 +412,8 @@ var tooltipClientNoInfoTemplate = Handlebars.compile(`
</table> </table>
`); `);
function initTooltips() {
tippy(".client_app", { tippy(".client_app", {
theme: "light vk", theme: "light vk",
content: "⌛", content: "⌛",
@ -449,6 +451,10 @@ tippy(".client_app", {
} }
}); });
}
initTooltips()
function addNote(textareaId, nid) function addNote(textareaId, nid)
{ {
if(nid > 0) { if(nid > 0) {

View file

@ -90,7 +90,7 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN
}); });
/* @rem-pai why this func wasn't named as "#_deleteDialog"? It looks universal IMO */ /* @rem-pai why this func wasn't named as "#_deleteDialog"? It looks universal IMO */
u("#_noteDelete").on("click", function(e) { $(document).on("click", "#_noteDelete", function(e) {
var formHtml = "<form id='tmpPhDelF' action='" + u(this).attr("href") + "' >"; var formHtml = "<form id='tmpPhDelF' action='" + u(this).attr("href") + "' >";
formHtml += "<input type='hidden' name='hash' value='" + u("meta[name=csrf]").attr("value") + "' />"; formHtml += "<input type='hidden' name='hash' value='" + u("meta[name=csrf]").attr("value") + "' />";
formHtml += "</form>"; formHtml += "</form>";
@ -111,7 +111,7 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN
return e.preventDefault(); return e.preventDefault();
}); });
u("#_pinGroup").on("click", async function(e) { $(document).on("click", "#_pinGroup", async function(e) {
e.preventDefault(); e.preventDefault();
let link = u(this).attr("href"); let link = u(this).attr("href");
@ -549,4 +549,4 @@ $(document).on("scroll", () => {
$(".floating_sidebar")[0].classList.remove("hide_anim"); $(".floating_sidebar")[0].classList.remove("hide_anim");
}, 250); }, 250);
} }
}) })

View file

@ -0,0 +1 @@
ALTER TABLE `profiles` ADD `paginator_type` TINYINT(1) NOT NULL DEFAULT '0' AFTER `client_name`;

View file

@ -711,6 +711,10 @@
"ui_settings_view_of_posts_old" = "Old"; "ui_settings_view_of_posts_old" = "Old";
"ui_settings_view_of_posts_microblog" = "Microblog"; "ui_settings_view_of_posts_microblog" = "Microblog";
"ui_settings_main_page" = "Main page"; "ui_settings_main_page" = "Main page";
"ui_settings_paginator" = "Paginator";
"ui_settings_paginator_old" = "Old (pages)";
"ui_settings_paginator_new" = "New (infinite scroll)";
"ui_settings_sessions" = "Sessions"; "ui_settings_sessions" = "Sessions";
"additional_links" = "Additional links"; "additional_links" = "Additional links";
@ -1720,6 +1724,11 @@
"paginator_page" = "Page $1"; "paginator_page" = "Page $1";
"paginator_next" = "Next"; "paginator_next" = "Next";
/* Paginator (new) */
"show_more" = "show more";
"error_loading_objects" = "Error when loading new objects. Try to reload page";
/* About */ /* About */
"about_openvk" = "About OpenVK"; "about_openvk" = "About OpenVK";

View file

@ -681,6 +681,9 @@
"ui_settings_view_of_posts_old" = "Старый"; "ui_settings_view_of_posts_old" = "Старый";
"ui_settings_view_of_posts_microblog" = "Микроблог"; "ui_settings_view_of_posts_microblog" = "Микроблог";
"ui_settings_main_page" = "Главная страница"; "ui_settings_main_page" = "Главная страница";
"ui_settings_paginator" = "Пагинатор";
"ui_settings_paginator_old" = "Старый (постраничный)";
"ui_settings_paginator_new" = "Новый (бесконечная прокрутка)";
"ui_settings_sessions" = "Сессии"; "ui_settings_sessions" = "Сессии";
"additional_links" = "Дополнительные ссылки"; "additional_links" = "Дополнительные ссылки";
"ad_poster" = "Рекламный плакат"; "ad_poster" = "Рекламный плакат";
@ -1608,6 +1611,11 @@
"paginator_page" = "Страница $1"; "paginator_page" = "Страница $1";
"paginator_next" = "Дальше"; "paginator_next" = "Дальше";
/* Paginator (new) */
"show_more" = "показать больше";
"error_loading_objects" = "Не удалось загрузить новые объекты. Попробуйте обновить страницу";
/* About */ /* About */
"about_openvk" = "Об OpenVK"; "about_openvk" = "Об OpenVK";