mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
finished quote behavior for mobile
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
function handleQuoteClick(reply, parentCid, threadCid) {
|
||||
const cid = parentCid ? parentCid : reply.shortCid;
|
||||
const isMobile = window.innerWidth <= 480;
|
||||
|
||||
if (threadCid && cid === threadCid) {
|
||||
const highlightedElements = document.querySelectorAll('.highlighted');
|
||||
@@ -7,19 +8,22 @@ function handleQuoteClick(reply, parentCid, threadCid) {
|
||||
highlightedElements.forEach(el => {
|
||||
el.classList.remove('highlighted');
|
||||
});
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const targetElement = [...document.querySelectorAll('.post-reply')]
|
||||
const targetElementSelector = isMobile ? '.post-reply-mobile' : '.post-reply-desktop';
|
||||
const postNumberSelector = isMobile ? '.post-number-mobile' : '.post-number-desktop';
|
||||
|
||||
const targetElement = [...document.querySelectorAll(targetElementSelector)]
|
||||
.find(el => {
|
||||
const postNumberElement = el.querySelector('.post-number');
|
||||
const postNumberElement = el.querySelector(postNumberSelector);
|
||||
return postNumberElement && postNumberElement.innerHTML.includes(cid);
|
||||
});
|
||||
|
||||
if (targetElement) {
|
||||
const highlightedElements = document.querySelectorAll('.highlighted');
|
||||
|
||||
|
||||
highlightedElements.forEach(el => {
|
||||
el.classList.remove('highlighted');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user