mirror of
https://github.com/openvk/openvk
synced 2025-03-14 21:45:22 +03:00
Update loaders and add avtopodgruzka postov
This commit is contained in:
parent
9ff4ff4b4b
commit
be85edf4c2
5 changed files with 65 additions and 11 deletions
|
@ -12,15 +12,18 @@
|
||||||
{include "../components/error.xml", title => "", description => $type == "my" ? tr("no_suggested_posts_by_you") : tr("no_suggested_posts_by_people")}
|
{include "../components/error.xml", title => "", description => $type == "my" ? tr("no_suggested_posts_by_you") : tr("no_suggested_posts_by_people")}
|
||||||
{else}
|
{else}
|
||||||
<h4 id="cound">{if $type == "my"}{tr("suggested_posts_in_group_by_you", $count)}{else}{tr("suggested_posts_in_group", $count)}{/if}</h4>
|
<h4 id="cound">{if $type == "my"}{tr("suggested_posts_in_group_by_you", $count)}{else}{tr("suggested_posts_in_group", $count)}{/if}</h4>
|
||||||
{foreach $posts as $post}
|
<div id="postz">
|
||||||
{include "../components/post/microblogpost.xml", post => $post, commentSection => false, suggestion => true, forceNoCommentsLink => true, forceNoPinLink => true, forceNoLike => true, forceNoShareLink => true}
|
{foreach $posts as $post}
|
||||||
{/foreach}
|
{include "../components/post/microblogpost.xml", post => $post, commentSection => false, suggestion => true, forceNoCommentsLink => true, forceNoPinLink => true, forceNoLike => true, forceNoShareLink => true}
|
||||||
|
{/foreach}
|
||||||
|
|
||||||
|
{include "../components/paginator.xml", conf => (object) [
|
||||||
|
"page" => $page,
|
||||||
|
"count" => $count,
|
||||||
|
"amount" => sizeof($posts),
|
||||||
|
"perPage" => OPENVK_DEFAULT_PER_PAGE,
|
||||||
|
"atBottom" => true,
|
||||||
|
]}
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{include "../components/paginator.xml", conf => (object) [
|
|
||||||
"page" => $page,
|
|
||||||
"count" => $count,
|
|
||||||
"amount" => sizeof($posts),
|
|
||||||
"perPage" => OPENVK_DEFAULT_PER_PAGE,
|
|
||||||
"atBottom" => true,
|
|
||||||
]}
|
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
@ -2714,3 +2714,8 @@ body.article .floating_sidebar, body.article .page_content {
|
||||||
.suggestionControls {
|
.suggestionControls {
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button.loaded {
|
||||||
|
background: #595959 url("/assets/packages/static/openvk/img/loading_mini.gif") no-repeat 50% 50%;
|
||||||
|
padding: 16px 40px 6px 4px;
|
||||||
|
}
|
||||||
|
|
|
@ -277,6 +277,9 @@ $(document).on("click", "#publish_post", async (e) => {
|
||||||
let post;
|
let post;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
e.currentTarget.classList.add("loaded")
|
||||||
|
e.currentTarget.setAttribute("value", "")
|
||||||
|
e.currentTarget.setAttribute("id", "")
|
||||||
post = await API.Wall.acceptPost(id, document.getElementById("signatr").checked, document.getElementById("pooblish").value)
|
post = await API.Wall.acceptPost(id, document.getElementById("signatr").checked, document.getElementById("pooblish").value)
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
switch(ex.code) {
|
switch(ex.code) {
|
||||||
|
@ -297,12 +300,19 @@ $(document).on("click", "#publish_post", async (e) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.currentTarget.setAttribute("value", tr("publish_suggested"))
|
||||||
|
e.currentTarget.classList.remove("loaded")
|
||||||
|
e.currentTarget.setAttribute("id", "publish_post")
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NewNotification(tr("suggestion_succefully_published"), tr("suggestion_press_to_go"), null, () => {window.location.assign("/wall" + post.id)});
|
NewNotification(tr("suggestion_succefully_published"), tr("suggestion_press_to_go"), null, () => {window.location.assign("/wall" + post.id)});
|
||||||
document.getElementById("cound").innerHTML = tr("suggested_posts_in_group", post.new_count)
|
document.getElementById("cound").innerHTML = tr("suggested_posts_in_group", post.new_count)
|
||||||
e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = ""
|
e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = ""
|
||||||
|
|
||||||
|
if(document.querySelectorAll(".post.post-divider").length < 1 && post.new_count > 0) {
|
||||||
|
loadMoreSuggestedPosts()
|
||||||
|
}
|
||||||
}), Function.noop]);
|
}), Function.noop]);
|
||||||
|
|
||||||
document.getElementById("pooblish").innerHTML = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.querySelector(".really_text").innerHTML.replace(/(<([^>]+)>)/gi, '')
|
document.getElementById("pooblish").innerHTML = e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.querySelector(".really_text").innerHTML.replace(/(<([^>]+)>)/gi, '')
|
||||||
|
@ -314,7 +324,9 @@ $(document).on("click", "#decline_post", async (e) => {
|
||||||
let post;
|
let post;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
e.currentTarget.parentNode.parentNode.insertAdjacentHTML("afterbegin", `<img id="deleteMe" src="/assets/packages/static/openvk/img/loading_mini.gif">`)
|
e.currentTarget.classList.add("loaded")
|
||||||
|
e.currentTarget.setAttribute("value", "")
|
||||||
|
e.currentTarget.setAttribute("id", "")
|
||||||
post = await API.Wall.declinePost(id)
|
post = await API.Wall.declinePost(id)
|
||||||
} catch(ex) {
|
} catch(ex) {
|
||||||
switch(ex.code) {
|
switch(ex.code) {
|
||||||
|
@ -335,6 +347,9 @@ $(document).on("click", "#decline_post", async (e) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e.currentTarget.setAttribute("value", tr("decline_suggested"))
|
||||||
|
e.currentTarget.setAttribute("id", "decline_post")
|
||||||
|
e.currentTarget.classList.remove("loaded")
|
||||||
return 0;
|
return 0;
|
||||||
} finally {
|
} finally {
|
||||||
u("#deleteMe").remove()
|
u("#deleteMe").remove()
|
||||||
|
@ -343,4 +358,31 @@ $(document).on("click", "#decline_post", async (e) => {
|
||||||
NewNotification(tr("suggestion_succefully_declined"), "", null);
|
NewNotification(tr("suggestion_succefully_declined"), "", null);
|
||||||
e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = ""
|
e.currentTarget.parentNode.parentNode.parentNode.parentNode.parentNode.outerHTML = ""
|
||||||
document.getElementById("cound").innerHTML = tr("suggested_posts_in_group", post)
|
document.getElementById("cound").innerHTML = tr("suggested_posts_in_group", post)
|
||||||
|
|
||||||
|
if(document.querySelectorAll(".post.post-divider").length < 1 && post > 0) {
|
||||||
|
loadMoreSuggestedPosts()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
function loadMoreSuggestedPosts()
|
||||||
|
{
|
||||||
|
let xhr = new XMLHttpRequest
|
||||||
|
xhr.open("GET", location.href)
|
||||||
|
|
||||||
|
xhr.onloadstart = () => {
|
||||||
|
document.getElementById("postz").innerHTML = `<img src="/assets/packages/static/openvk/img/loading_mini.gif">`
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.onload = () => {
|
||||||
|
let parser = new DOMParser()
|
||||||
|
let body = parser.parseFromString(xhr.responseText, "text/html").getElementById("postz")
|
||||||
|
|
||||||
|
document.getElementById("postz").innerHTML = body.innerHTML
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.onerror = () => {
|
||||||
|
document.getElementById("postz").innerHTML = tr("error_loading_suggest")
|
||||||
|
}
|
||||||
|
|
||||||
|
xhr.send()
|
||||||
|
}
|
||||||
|
|
|
@ -326,6 +326,8 @@
|
||||||
"publish_suggested" = "Accept";
|
"publish_suggested" = "Accept";
|
||||||
"decline_suggested" = "Decline";
|
"decline_suggested" = "Decline";
|
||||||
|
|
||||||
|
"error_loading_suggest" = "Error when loading new posts";
|
||||||
|
|
||||||
"publishing_suggested_post" = "Publishing suggested post";
|
"publishing_suggested_post" = "Publishing suggested post";
|
||||||
"suggested_posts_in_group_zero" = "You've looked at all the suggested posts, congratulations!";
|
"suggested_posts_in_group_zero" = "You've looked at all the suggested posts, congratulations!";
|
||||||
"suggested_posts_in_group_one" = "This group has one suggested post";
|
"suggested_posts_in_group_one" = "This group has one suggested post";
|
||||||
|
|
|
@ -310,6 +310,8 @@
|
||||||
"publish_suggested" = "Опубликовать запись";
|
"publish_suggested" = "Опубликовать запись";
|
||||||
"decline_suggested" = "Отклонить";
|
"decline_suggested" = "Отклонить";
|
||||||
|
|
||||||
|
"error_loading_suggest" = "Не удалось подгрузить новые посты";
|
||||||
|
|
||||||
"publishing_suggested_post" = "Публикация предложенной записи";
|
"publishing_suggested_post" = "Публикация предложенной записи";
|
||||||
"suggested_posts_in_group_zero" = "Вы посмотрели всю предложку, поздравляю!";
|
"suggested_posts_in_group_zero" = "Вы посмотрели всю предложку, поздравляю!";
|
||||||
"suggested_posts_in_group_one" = "В эту группу предложили одну запись";
|
"suggested_posts_in_group_one" = "В эту группу предложили одну запись";
|
||||||
|
|
Loading…
Reference in a new issue