|
1 | 1 | var mathjax = {{ 'true' if hoverxref_mathjax else 'false' }};
|
2 | 2 | var sphinxtabs = {{ 'true' if hoverxref_sphinxtabs else 'false' }};
|
| 3 | +{% set sphinx_rtd_theme = 'true' if html_theme == 'sphinx_rtd_theme' else 'false' %} |
| 4 | + |
3 | 5 |
|
4 | 6 | function reRenderTooltip (instance, helper) {
|
5 | 7 | // Check if the content is the same as the default content until
|
@@ -124,23 +126,23 @@ $(document).ready(function() {
|
124 | 126 | `
|
125 | 127 | $('body').append(modalHtml);
|
126 | 128 |
|
| 129 | + {% if sphinx_rtd_theme %} |
127 | 130 | function onShow(modal, element) {
|
128 |
| - if (typeof READTHEDOCS_DATA !== 'undefined' && READTHEDOCS_DATA.theme == 'sphinx_rtd_theme') { |
129 |
| - // This is a HACK to get some "smart" left position of the |
130 |
| - // modal depending its size. |
131 |
| - var container = $('#micromodal .modal__container') |
132 |
| - var maxWidth = $('.wy-nav-content').innerWidth() - 150; |
133 |
| - var contentLeft = $('.wy-nav-content').position().left; |
134 |
| - if (container.width() >= maxWidth) { |
135 |
| - var left = contentLeft - 150; |
136 |
| - } |
137 |
| - else { |
138 |
| - var left = contentLeft + 150; |
139 |
| - } |
140 |
| - console.debug('Container left position: ' + left); |
141 |
| - container.css('left', left); |
| 131 | + // This is a HACK to get some "smart" left position of the |
| 132 | + // modal depending its size. |
| 133 | + var container = $('#micromodal .modal__container') |
| 134 | + var maxWidth = $('.wy-nav-content').innerWidth() - 150; |
| 135 | + var contentLeft = $('.wy-nav-content').position().left; |
| 136 | + if (container.width() >= maxWidth) { |
| 137 | + var left = contentLeft - 150; |
| 138 | + } |
| 139 | + else { |
| 140 | + var left = contentLeft + 150; |
142 | 141 | }
|
| 142 | + console.debug('Container left position: ' + left); |
| 143 | + container.css('left', left); |
143 | 144 | }
|
| 145 | + {% endif %} |
144 | 146 |
|
145 | 147 | function showModal(element) {
|
146 | 148 | var project = element.data('project');
|
@@ -168,7 +170,9 @@ $(document).ready(function() {
|
168 | 170 | $('#micromodal-title').html(a);
|
169 | 171 | $('#micromodal-content').html(content);
|
170 | 172 | MicroModal.show('micromodal', {
|
| 173 | + {% if sphinx_rtd_theme or hoverxref_modal_onshow_function %} |
171 | 174 | onShow: {{ hoverxref_modal_onshow_function|default('onShow', true) }},
|
| 175 | + {% endif %} |
172 | 176 | openClass: '{{ hoverxref_modal_openclass }}',
|
173 | 177 | disableScroll: {{ 'true' if hoverxref_modal_disable_scroll else 'false' }},
|
174 | 178 | disableFocus: {{ 'true' if hoverxref_modal_disable_focus else 'false' }},
|
|
0 commit comments