Using Ossn hooks and callbacks
This component is not only meant to be just another little showcase, but dedicated to Dominik L in first place who contributed a lot of helpful and interesting new stuff lately. Thank you!
While following the development of his DeactivateWall component I became of course aware of all those little javascript glitches the early releases came with.
Indeed, Javascript can be a real pain sometimes, and that's why I'm trying to find a workaround whenever possible because ....
Let's imagine your site has 50 pages displaying black characters on a white background by default. Some time later your idea is to use blue characters on page 3, 10 and 21 for some reason. One solution could be to add a script to check for page 3, 10 and 21 and if so, change the already displayed black characters to blue ones. Okay, admittedly today's devices are powerful and fast, and visitors may not notice the change at all. But that script rests in your browser just for post-processing 3 of 50 pages. Not really brilliant, right?
Talking about Dominik's component, the task seems very much the same: There may be 3 members who were blocked, and again there's a script to change Ossn's default output when they log in. The major difference: This time not only one color needs to be changed, but the complete structure of the page needs to be examined, to find comment fields, links, buttons ... whatever. And even more nasty: the page will change whenever Ossn's Autopagination triggers the insertion of the next 10 posts. So he had to add that beast named mutation observer taking care of that.
Congrats, he got it all done with release 1.9 in the end. ;) But wouldn't it be much smarter to let the server do all these checks in advance and provide that special HTML for blocked users right in place, instead of providing a not fitting view first and then make it fit by a script in a second step?
In fact, Ossn's plugin design accompanied by numerous hooks and callbacks is allowing just that. And hopefully this component will motivate new developers having a closer into https://www.opensource-socialnetwork.org/documentation/dashboard and getting a little inspired which way javascript can be completely circumvented in some cases.