Recent Posts
Please use this thread to report posts violating r...
Suggestions
Test Post
how to donate anonymously?
Thank you Dyaush
Accepting submissions for State Flags and other cu...
Thread moving request
why webp isn't supported?
Thank you for cleaning up my thread Dyaus
test
saar,
Why don't you do something about the annoying spoi...
WTF DOES THIS EVEN MEAN?
Sir, can you please dalit 164578 on gen, I just had a nightmare that I was still unemployed and got doxxed
!XShledrwphaLWim
XfKiuS
No.184619
DGH here. Lost my tripcode because my dumbass deleted all site data while experimenting.
Anyway, the website has some dead logic in it.
Picrel is the function that handles bookmarks. It is supposed to show users an alert if there are no bookmarks, but there's a harmless bug in its logic.
You see, when a user bookmarks a post, the site stores the code of that post in his browser's local storage as a list (see picrel).
If you take a gander to the if condition in the function, it will execute if either the bookmarks list doesn't exist in the local storage, or if the list is empty (the buggy part).
The bookmarks list the browser returns from the local storage isn't of the list class, so the length attribute doesn't exist for it.
The implication of it is that if the user deletes all his bookmarks, the bookmarks object would still be in the local storage, albeit as an empty list.
And thus this condition will always be false, even if the user has no bookmarks.
The bug itself isn't serious.
It can be solved. Just check if the bookmarks list exists in local storage, if it doesn't then make an empty list for it. Fix the condition that checks for empty bookmark list show it shows the alert correctly.
I will be looking out for more bugs in the website's logic.
No.185223
>>184619(OP)
Thanks and yeah agreed though there are few points about this,
> So usually when user visits the homepage for the first time, there's no instance for bookmarks in the local storage, in that case we don't want to proceed at all. This was an adhoc condition added later for that specific case - not for empty bookmarks list.
> I agree about bookmarks.length; we could have just used `!bookmarks?.bookmarks?.length` and display the message.
let bookmarks = JSON.parse(localStorage.getItem('bookmarks'));
if (!bookmarks || bookmarks.length == 0) {
showAlert('No Current Bookmarks!', false, 5000);
return;
}
>In case of empty bookmarks, i just let the request pass and request is processed with page showing 'no posts' in bookmarks section.
---
> i will be looking out for more bugs
cool though i would say that most of these are very old files, new codes are significantly changed. Hidden posts page is no longer available since it's been merged with catalog view and filters.
Bookmarks has been changed to support pagination etc.
Looking forward to any updates. Keep those in this threads since it will be easier to track. Good day!