@@ -4,6 +4,7 @@ import 'script-loader!../vpython_libraries/glow.min.js';
4
4
import 'script-loader!../vpython_libraries/plotly.min.js' ;
5
5
import '../style/jquery-ui.custom.css'
6
6
import '../style/ide.css'
7
+ import img from '../vpython_data/flower_texture.jpg' // use this to get the path to vpython_data
7
8
8
9
// Ensure downstream JupyterLab webpack places the fonts and images in predictable locations
9
10
import '!!file-loader?name=/vpython_data/[name].[ext]!../vpython_data/earth_texture.jpg'
@@ -41,12 +42,7 @@ export function createWebsocket(msg, serviceUrl) {
41
42
var uri = msg . content . data . wsuri
42
43
var url ;
43
44
44
- if ( document . location . hostname . includes ( "localhost" ) ) {
45
- url = "ws://localhost:" + port + uri ;
46
- }
47
- else {
48
- url = serviceUrl + port + uri ;
49
- }
45
+ url = serviceUrl + port + uri ;
50
46
ws = new WebSocket ( url ) ;
51
47
ws . binaryType = "arraybuffer" ;
52
48
@@ -84,13 +80,11 @@ export function setupWebsocket(msg,serviceUrl) {
84
80
wscheckfontsloaded ( msg , serviceUrl )
85
81
}
86
82
87
- // Old datadir value for a source extension npm package. (used prior to JupyterLab 3.0)
88
- //var datadir = '/static/lab/vpython_data/'
89
- //window.Jupyter_VPython = "/static/lab/vpython_data/" // prefix used by glow.min.js for textures
90
-
91
83
// New datadir value for a prebuilt extension (new in JupyterLab 3.0)
92
- var datadir = '/lab/extensions/vpython/static/vpython_data/'
93
- window . Jupyter_VPython = "/lab/extensions/vpython/static/vpython_data/" // prefix used by glow.min.js for textures
84
+ var url = new URL ( img ) ;
85
+ var datadir = url . pathname . substring ( 0 , url . pathname . lastIndexOf ( '/' ) ) + "/vpython_data/" ; // path to vpython_data dir
86
+ window . Jupyter_VPython = datadir // prefix used by glow.min.js for textures
87
+ url = null
94
88
95
89
function fontloading ( ) {
96
90
"use strict" ;
0 commit comments