Open slime73 opened 2 years ago
Even with a working wrapSections it doesn't seem to do hide the available since tags.
function wrapSections () {
var list = document.querySelectorAll('h2');
var wrapper;
for (let element of list) {
wrapper = makeWrapper();
element.parentNode.insertBefore(wrapper, element);
wrapper.appendChild(element);
}
}
Not having made the original script, I'm not sure how it works or what would be required to fix it.
I've been referencing archive.org for how things used to behave - if that change fixes the "removed in" sections which should be hidden then it's better than before at least, but I can continue poking at it to see if I can find the causes of other issues as well.
[For reference, I don't have the ability/permissions to update the script on the wiki on my own.]
Ah, I completely misunderstood the purpose of wrapSections. It wasn't just gathering all the h2s, it was actually iterating over the elements in between them as well.
The reason the code broke is because the no table of contents plugin broke and I'm hiding it with CSS now, and that's the h2 it's jumping to. I just updated it to pick a specific h2 and it's behaving correctly now.
I notice that there's a bug with functions that have been added and then later removed. https://github.com/love2d/love-wiki-version-picker/commit/cf8dc9f5235a5473cffdd1b8d391fa4f3ffbca67#diff-58417e0f781b6656949d37258c8b9052ed266e2eb7a5163cad7b0863e6b2916a This looks like the culprit.
For now, they'll be appearing when they shouldn't be, but the main issue has been fixed. Do a hard refresh if you need to.
Thanks! the newMesh page is working as expected for me now.
I think those added+removed functions had flaky support with the version picker even when they worked with it.
Something about this broke again apparently. I tried using the version selector on the newMesh page from the original post and it's not doing anything (using Chrome on Windows, if that matters).
I haven't investigated more than that, yet.
EDIT: Firefox seems to work. Strange.
For example on this page https://love2d.org/wiki/love.graphics.newMesh if you select Latest Version in the version selector it should hide the "Available since" tags, and hide the entire variant sections for the removed variants, but it doesn't right now.
I did a bit of debugging (despite not knowing JS or SMW very well) and I think I found at least one problem: this code finds the first h2 and wraps it as well as all its immediate siblings. In old cached versions of the wiki from before recent upgrades, the h2's were all around the top level of the hierarchy. But now there's one that's a child of a "toctitle" class so I think it's finding that and then exiting the loop since it has no siblings.
Maybe it'll work to change that code to use
document.querySelectorAll
instead of iterating throughdocument.querySelector
's siblings?