sphinx_rtd_theme icon indicating copy to clipboard operation
sphinx_rtd_theme copied to clipboard

Refactor the enable() function in theme.js

Open nienn opened this issue 3 years ago • 0 comments

Problem

The enable() function in theme.js is called by the application to initialize the versions flyout menu that is used in all versions.

This function, however, is also performing DOM operations that are specific to sphinx_rtd_theme.

Details

The functions inserts html elements and adds several classes that are used by the sphinx_rtd_theme.

Solution

Refactor this function to use two separate methods. One for all versions/builds and one that is only executed when the theme is a derivative of sphinx_rtd_theme. The code that adds wy-table-responsive would be an example of code that should only be executed when the theme is a sphinx_rtd_theme derivative.

Related issues

The conversation about this problem started here:

  • https://github.com/readthedocs/readthedocs.org/issues/8497

nienn avatar Sep 29 '21 18:09 nienn