Hi. For the sake of future compatibility and fixes I think it would be best to add a some mw.uitls function for the flying toc. Having a function would be much easier to fix instead of changing 10s or 100s of custom JS pages.
So you should add a function that converts new ToC to a static ToC. Maybe something like `mw.util.tocMakeStatic();`.
Note that current suggestion is not a complete code snippet:
$('.mw-table-of-contents-container') .removeClass('mw-sticky-header-element' ) .removeClass('mw-table-of-contents-container') .appendTo(document.getElementsByTagName('mw:tocplace')[0])
Couple of problems there:
- When you decide to add another class to sticky toc another class would need to be removed.
- Even currently there is bug there. A class `vector-sticky-header-enabled` should be removed from `html` tag.
- When you run above code the ToC is not fully working as a sttic ToC. It has a scrollbar.
- You might decide to change the name of the tag from mw:tocplace to a div in future. In that case the code would just stop working and also brake new ToC. You don't check if `getElementsByTagName` is empty and so you would just remove classes.