![]() ![]() |
Audio Asylum Thread Printer Get a view of an entire thread on one page |
For Sale Ads |
207.244.166.107
In Reply to: RE: Mark as Read not working? posted by Rod M on February 26, 2025 at 19:28:18
shoot, I just realized we need to set every chil li to the aa-d classI'll take a peek tomorrow.
I'd also be much easier to play with teh DOM using JQuery, never really done much with vanilla JS.
KP
Edits: 02/26/25Follow Ups:
//you can paste into Chrome console and try it, have to be in Thread View
//it's meant as a drop-in replacement for current function, no need to re-do anything else, within aa.js file
//once I save here it will lose all the formatting, you can paste into https://beautifier.io/ linked below
function confirmRead(ReadForum, ReadThread)
{
if (userID)
{
if (userID != null)
{
if (confirm("Are you sure you want to mark toggle - test " + ReadThread + " as read/unread?"))
{
var anchorElement = document.querySelector('a[href*="' + ReadThread + '.html"]');
var nearestLiParent = anchorElement.parentNode.closest('li');
toggleElement = nearestLiParent;
toggleElement.classList.add('aa-d');
var nextSib = nearestLiParent.nextElementSibling;
if (anchorElement)
{
var count = 0;
var ulChildren;
var children = nearestLiParent.nextElementSibling.querySelectorAll('*');
children = nextSib.querySelectorAll('li');
for (let i = 0; i < children.length; i++)
{
var toggleElement = children[i];
toggleElement.classList.add('aa-d');
}
}
}
}
else
{
alert("You must log in to Mark Threads as read.")
}
}
else
{
alert("You must log in to Mark Threads as read.")
}
}
Thanks, I get the function, but nothing happens. I've guessing that I need to modify the code to add the root number in each child.
Take a look at the test forum:
https://www.audioasylum.com/cgi/tv.mpl?forum=test
What I need is to grab some of the source for the first topic and the changes to make it work immediately. I tried the console and it didn't do anything, but that's because the link does a perl function and isn't using the JS.
-Rod
It will just add the new function to the browser session, you can then click the existing 'Mark as Read' Link and it will run the new code.
The current link is JS, that JS then calls a server side function.
The new function does all the work on the client side.
![]()
It also does nothing new for me when I run click, still have to refresh pagebest approach is to rename that
confirmRead_ooldand paste the new code into aa.js
Edits: 02/27/25
![]()
Hum, not sure what is running in Test, I will see if I can snag the JS
It is diff that my code though
it shows
Are you sure you want to mark thread 1251 as read?
vs
Are you sure you want to mark toggle - test 1234 as read/unread?
(I stuk 'toggle - test' in there)
I dropped the script int consoles and run as expected
FAQ |
Post a Message! |
Forgot Password? |
|
||||||||||||||
|
This post is made possible by the generous support of people like you and our sponsors: