Skip to content

Commit 0255406

Browse files
committed
removed window.Plotly check and removed extra conditions on optional require lines
1 parent 2461711 commit 0255406

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

plotly/offline/offline.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,15 @@ def init_notebook_mode(connected=False):
6767
script_inject = (
6868
''
6969
'<script>'
70-
'if(!window.Plotly) {{'
71-
'require([\'https://cdn.plot.ly/plotly-latest.min.js\'],'
70+
# 'if(!window.Plotly) {{'
71+
'requirejs.config({'
72+
'paths: { '
73+
'\'plotly\': [\'https://cdn.plot.ly/plotly-latest.min\']},'
74+
'});'
75+
'require([\'plotly\'],'
7276
'function(plotly) {window.Plotly=plotly;});'
73-
'}} </script>'
77+
# '}}'
78+
'</script>'
7479
)
7580
else:
7681
# Inject plotly.js into the output cell
@@ -142,9 +147,8 @@ def _plot_html(figure_or_data, show_link, link_text,
142147
config=jconfig)
143148

144149
optional_line1 = ('require(["plotly"], function(Plotly) {{ '
145-
if (global_requirejs and (not __PLOTLY_USE_CDN)) else '')
146-
optional_line2 = ('}});' if (global_requirejs and (not __PLOTLY_USE_CDN))
147-
else '')
150+
if global_requirejs else '')
151+
optional_line2 = ('}});' if global_requirejs else '')
148152

149153
plotly_html_div = (
150154
''

0 commit comments

Comments
 (0)