Skip to content

Commit 497d790

Browse files
committed
Simply how to define the type of hover (tooltip, modal)
1 parent 44e732a commit 497d790

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

docs/conf.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@
7171
hoverxref_sphinxtabs = True
7272
hoverxref_mathjax = True
7373

74-
hoverxref_tooltip = False
75-
hoverxref_modal = True
74+
hoverxref_type = 'modal'
7675

7776
versionwarning_messages = {
7877
'latest': 'This extension is currently in Beta state. '

hoverxref/_static/js/hoverxref.js_t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ function reLoadSphinxTabs() {
5555

5656

5757
$(document).ready(function() {
58-
{% if hoverxref_tooltip or not hoverxref_modal %}
58+
{% if hoverxref_type == 'tooltip' %}
5959
$('.hoverxref').tooltipster({
6060
theme: {{ hoverxref_tooltip_theme }},
6161
interactive: {{ 'true' if hoverxref_tooltip_interactive else 'false' }},
@@ -104,7 +104,7 @@ $(document).ready(function() {
104104
})
105105
{% endif %}
106106

107-
{% if hoverxref_modal and not hoverxref_tooltip %}
107+
{% if hoverxref_type == 'modal' %}
108108
var modalHtml = `
109109
<div class="modal micromodal-slide {{ hoverxref_modal_class }}" id="micromodal" aria-hidden="true">
110110
<div class="modal__overlay" tabindex="-1" data-micromodal-close>

hoverxref/extension.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ def setup_theme(app, exception):
100100
Add a small custom CSS file for a specific theme and set hoverxref configs
101101
(if not overwritten by the user) with better defaults for these themes.
102102
"""
103+
if app.config.hoverxref_type != 'modal':
104+
return
105+
103106
css_file = None
104107
theme = app.config.html_theme
105108
default, rebuild, types = app.config.values.get('hoverxref_modal_class')
@@ -139,9 +142,9 @@ def setup(app):
139142
app.add_config_value('hoverxref_sphinxtabs', False, 'env')
140143
app.add_config_value('hoverxref_roles', [], 'env')
141144
app.add_config_value('hoverxref_domains', [], 'env')
145+
app.add_config_value('hoverxref_type', 'tooltip', 'env')
142146

143147
# Tooltipster settings
144-
app.add_config_value('hoverxref_tooltip', False, 'env')
145148
app.add_config_value('hoverxref_tooltip_api_host', 'https://readthedocs.org', 'env')
146149
app.add_config_value('hoverxref_tooltip_theme', ['tooltipster-shadow', 'tooltipster-shadow-custom'], 'env')
147150
app.add_config_value('hoverxref_tooltip_interactive', True, 'env')
@@ -153,7 +156,6 @@ def setup(app):
153156
app.add_config_value('hoverxref_tooltip_class', 'rst-content', 'env')
154157

155158
# MicroModal settings
156-
app.add_config_value('hoverxref_modal', False, 'env')
157159
app.add_config_value('hoverxref_modal_hover_delay', 350, 'env')
158160
app.add_config_value('hoverxref_modal_class', 'rst-content', 'env')
159161
app.add_config_value('hoverxref_modal_onshow_function', None, 'env')

0 commit comments

Comments
 (0)