«
{for $j = $conf->page - ($space-1); $j <= $conf->page + ($space-1); $j++}
{$j}
diff --git a/Web/static/js/al_music.js b/Web/static/js/al_music.js
index 7ee1f035..9aeab1f8 100644
--- a/Web/static/js/al_music.js
+++ b/Web/static/js/al_music.js
@@ -641,6 +641,35 @@ class bigPlayer {
duration: this.tracks["currentTrack"].length
})
}
+
+ loadContextPage(page, lesser = false) {
+ const formdata = new FormData()
+ formdata.append("context", this.context["context_type"])
+ formdata.append("context_entity", this.context["context_id"])
+ formdata.append("hash", u("meta[name=csrf]").attr("value"))
+ formdata.append("page", page)
+
+ ky.post("/audios/context", {
+ hooks: {
+ afterResponse: [
+ async (_request, _options, response) => {
+ const newArr = await response.json()
+
+ if(lesser)
+ this.tracks["tracks"] = newArr["items"].concat(this.tracks["tracks"])
+ else
+ this.tracks["tracks"] = this.tracks["tracks"].concat(newArr["items"])
+
+ this.context["playedPages"].push(String(newArr["page"]))
+
+ this.updateButtons()
+ console.info("Loaded context for page " + page)
+ }
+ ]
+ },
+ body: formdata
+ })
+ }
}
document.addEventListener("DOMContentLoaded", function() {
diff --git a/Web/static/js/al_suggestions.js b/Web/static/js/al_suggestions.js
index 1c3da3e8..befe78b7 100644
--- a/Web/static/js/al_suggestions.js
+++ b/Web/static/js/al_suggestions.js
@@ -201,7 +201,7 @@ $(document).on("click", ".sugglist a", (e) => {
})
// нажатие на пагинатор у постов предложки
-$(document).on("click", "#postz .paginator a", (e) => {
+/*$(document).on("click", "#postz .paginator a", (e) => {
e.preventDefault()
ky(e.currentTarget.href, {
@@ -228,4 +228,4 @@ $(document).on("click", "#postz .paginator a", (e) => {
]
}
})
-})
+})*/
diff --git a/Web/static/js/al_wall.js b/Web/static/js/al_wall.js
index 3278810d..8b516f11 100644
--- a/Web/static/js/al_wall.js
+++ b/Web/static/js/al_wall.js
@@ -1643,3 +1643,76 @@ $(document).on("click", ".avatarDelete", (e) => {
}),
]);
})
+
+async function __processPaginatorNextPage(page)
+{
+ const container = u('.scroll_container')
+ const container_node = '.scroll_node'
+ const parser = new DOMParser
+
+ const replace_url = new URL(location.href)
+ replace_url.searchParams.set('p', page)
+
+ const new_content = await fetch(replace_url.href)
+ const new_content_response = await new_content.text()
+ const parsed_content = parser.parseFromString(new_content_response, 'text/html')
+
+ const nodes = parsed_content.querySelectorAll(container_node)
+ nodes.forEach(node => {
+ container.append(node)
+ })
+
+ u(`.paginator:not(.paginator-at-top)`).html(parsed_content.querySelector('.paginator:not(.paginator-at-top)').innerHTML)
+ // fffffuck
+ if(u(`.paginator:not(.paginator-at-top)`).nodes[0].closest('.scroll_container')) {
+ container.nodes[0].append(u(`.paginator:not(.paginator-at-top)`).nodes[0].parentNode)
+ }
+
+ if(window.player) {
+ window.player.loadContextPage(page)
+ }
+
+ if(typeof __scrollHook != 'undefined') {
+ __scrollHook(page)
+ }
+}
+
+const showMoreObserver = new IntersectionObserver(entries => {
+ entries.forEach(async x => {
+ if(x.isIntersecting) {
+ if(u('.scroll_container').length < 1) {
+ return
+ }
+
+ const target = u(x.target)
+ if(target.length < 1 || target.hasClass('paginator-at-top')) {
+ return
+ }
+
+ const current_url = new URL(location.href)
+ if(current_url.searchParams && !isNaN(parseInt(current_url.searchParams.get('p')))) {
+ return
+ }
+
+ target.addClass('lagged')
+ const active_tab = target.find('.active')
+ const next_page = u(active_tab.nodes[0] ? active_tab.nodes[0].nextElementSibling : null)
+ if(next_page.length < 1) {
+ u('.paginator:not(.paginator-at-top)').removeClass('lagged')
+ return
+ }
+
+ const page_number = Number(next_page.html())
+ await __processPaginatorNextPage(page_number)
+ u('.paginator:not(.paginator-at-top)').removeClass('lagged')
+ }
+ })
+}, {
+ root: null,
+ rootMargin: '0px',
+ threshold: 0,
+})
+
+if(u('.paginator:not(.paginator-at-top)').length > 0) {
+ showMoreObserver.observe(u('.paginator:not(.paginator-at-top)').nodes[0])
+}
diff --git a/Web/static/js/openvk.cls.js b/Web/static/js/openvk.cls.js
index 64700084..5878945e 100644
--- a/Web/static/js/openvk.cls.js
+++ b/Web/static/js/openvk.cls.js
@@ -90,7 +90,7 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN
});
/* @rem-pai why this func wasn't named as "#_deleteDialog"? It looks universal IMO */
- u("#_noteDelete").on("click", function(e) {
+ u(document).on("click", "#_noteDelete", function(e) {
var formHtml = "
";
@@ -167,7 +167,7 @@ document.addEventListener("DOMContentLoaded", function() { //BEGIN
return false;
});
- u("#_submitUserSubscriptionAction").handle("submit", async function(e) {
+ u(document).handle("submit", "#_submitUserSubscriptionAction", async function(e) {
u(this).nodes[0].parentElement.classList.add('loading');
u(this).nodes[0].parentElement.classList.add('disable');
console.log(e.target);
@@ -518,7 +518,7 @@ function highlightText(searchText, container_selector, selectors = []) {
node.parentNode.insertBefore(tempDiv.firstChild, node)
}
node.parentNode.removeChild(node)
- } else if(node.nodeType === 1 && node.tagName !== 'SCRIPT' && node.tagName !== 'BR' && node.tagName !== 'STYLE') {
+ } else if(node.nodeType === 1 && node.tagName !== 'SCRIPT' && node.tagName !== 'BR' && node.tagName !== 'STYLE' && !node.classList.contains('highlight')) {
Array.from(node.childNodes).forEach(highlightNode);
}
}