More javascript is almost never the best solution to any problem, particular when it’s shown that css can achieve the same result.
With the css solution it’s doable on a site that has no javascript.
JS should not be involved, and we don't need every site to have its own version of the switch, located in a different place and looking different.