![]() ![]() |
Audio Asylum Thread Printer Get a view of an entire thread on one page |
For Sale Ads |
207.244.166.107
Get the pop-up but nothing gets marked.
On MBP
Tried :
Chrome
Firefox
Safari
KP
Follow Ups:
Ah, it does work, but not immediately. If you click 'Mark Read', it seems like nothing happened. But, if you refresh, you should see the triangle bullet will turn red.
If I knew JavaScript, it could be done in real time. I'd also want to take some time to update some of the CSS to make the posts cleaners and at the same time, change the 'Mark Read' option to also change the text color instead of just the red triangle.
.
-Rod
No luck, I see there's a function confirmRead(ReadForum,ReadForum)
that is meant to change the window location after running something through the server, but the page is not reloading for me.
I poked a bit at the JS (done quite a bit of it a while back) but there's no way to dynamically set the a:visited tag for security/privacy reasons.
Writing some JS to change the color is doable, but it wont persists next time page is loaded.
Guessing the cgi/markread.mpl calls some function that writes to local storage or cookie and applies a class when page loads.
KP
Ok, I had to look up what it's doing. Basically, the JS calls markread.mpl which is a perl script that gets an array of the root topics children and writes the message numbers read for the forum.
Using the Threads view, the bullet will change as red using CSS, a class aa-d versus li class="new" for a blue bullet. Again, it won't change until you RELOAD the page. That does work on my PC.
Everything should persist. However, right now, only the bullet color changes. It's easy enough to change the text color for the link as well which would be better, but it only would work when it is re-processed with a new load for the page.
I don't know exactly how to it on the fly with JS. Perhaps a JS flag with the root topic number could do that. Any ideas?
-Rod
Well, I am a fool, I expected mark read to turn all the hyperlinks red, but what it does is change the little arrow!In that case this should get there, more or less.
I don't have a way to step through the code so had to hammer in consoleThe business end is this, you can type in browser console and add/remove the classes
anchorElement = document.querySelector('a[href*="185726.html"]');
nearestLiParent = anchorElement.closest('li');
nearestLiParent.classList.add("aa-d"); // or nearestLiParent.classList.remove("aa-d");full function:
function confirmRead(ReadForum, ReadThread) {
if (userID) {
if (userID != null) {
if (confirm("Are you sure you want to mark thread - test " + ReadThread + " as read?")) {//we dont have id's in elemetns so have to get creative
anchorElement = document.querySelector('a[href*="' + ReadThread + '.html"]');
nearestLiParent = anchorElement.closest('li'); // this grabs the parentnearestLiParent.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.")
}
}
Edits: 02/26/25
I get it. It'd be a lot easier to code with a test bed. JS is loaded and gets cookies for whatever. The Mark Read can just not there if you don't have a cookie login with the user id.
Then, the click would need to change the elements and also pass it over to perl to store the message numbers as read. It'd be easier using JSON to connect to the db. But, I haven't messed with JSON.
-Rod
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/25
//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
since this will not put any weight on the server.
KP
FAQ |
Post a Message! |
Forgot Password? |
|
||||||||||||||
|
This post is made possible by the generous support of people like you and our sponsors: