diff --git a/config.js b/config.js index 9d779cef924c92582868a1ea46762df72293bdcc..e1c17d8234348b6cd6f6144ab94e9fc188f7271c 100644 --- a/config.js +++ b/config.js @@ -7,3 +7,6 @@ export const COLOR_PALETTE = [ "rgb(239, 65, 35)", "rgb(255, 255, 255)", ]; + +// Just renaming a variable which is given by the PHP script. This avoids errors in all other files. +export const PLUGIN_PATH = plugin_path; diff --git a/display/graph.js b/display/graph.js index d088c4ba50acd6167b2010339a00c2224af3ba3b..dfa21833f5cffe879914a012a78f8be0bcdb6d3c 100644 --- a/display/graph.js +++ b/display/graph.js @@ -257,7 +257,9 @@ class Graph { const loader = new THREE.TextureLoader(); //const planeMaterial = new THREE.MeshLambertMaterial({color: 0xFF0000, side: THREE.DoubleSide}); //THREE.BackSide const planeMaterial = new THREE.MeshBasicMaterial({ - map: loader.load(plugin_path + "backgrounds/background_4.jpg"), + map: loader.load( + Config.PLUGIN_PATH + "backgrounds/background_4.jpg" + ), side: THREE.DoubleSide, }); //THREE.BackSide const mesh = new THREE.Mesh(sphereGeometry, planeMaterial); @@ -294,17 +296,17 @@ class Graph { // Draw node circle image const textureLoader = new THREE.TextureLoader(); const imageAlpha = textureLoader.load( - plugin_path + "datasets/images/alpha.png" + Config.PLUGIN_PATH + "datasets/images/alpha.png" ); let imageTexture = null; if ("image" in node) { imageTexture = textureLoader.load( - plugin_path + "datasets/images/" + node.image + Config.PLUGIN_PATH + "datasets/images/" + node.image ); } else { imageTexture = textureLoader.load( - plugin_path + "datasets/images/default.jpg" + Config.PLUGIN_PATH + "datasets/images/default.jpg" ); } @@ -353,7 +355,7 @@ function createFullScreenButton() { sceneNode.appendChild(overlayNode); } -const dataUrl = plugin_path + "datasets/aud1.json"; +const dataUrl = Config.PLUGIN_PATH + "datasets/aud1.json"; const G = new Graph(dataUrl); const linkoverlay = new LinkOverlay(G); const infooverlay = new InfoOverlay(G); diff --git a/display/infooverlay.js b/display/infooverlay.js index 8da19c39d0894ac316c6b15618786140091ade7a..a8213275ac70dbfcc9bc82ac5b4b32b54d9a6b6e 100644 --- a/display/infooverlay.js +++ b/display/infooverlay.js @@ -1,5 +1,6 @@ import * as Helpers from "./helpers"; import jQuery from "jquery"; +import * as Config from "../config"; export { InfoOverlay }; @@ -104,7 +105,7 @@ class InfoOverlay { const nodeImage = document.createElement("img"); nodeImage.id = "infoOverlayImage"; - nodeImage.src = plugin_path + "datasets/images/default.jpg"; + nodeImage.src = Config.PLUGIN_PATH + "datasets/images/default.jpg"; nodeImage.className = "detail-view-image"; topArea.appendChild(nodeImage); @@ -130,12 +131,12 @@ class InfoOverlay { if ("image" in node) { jQuery("#infoOverlayImage").attr( "src", - plugin_path + "datasets/images/" + node.image + Config.PLUGIN_PATH + "datasets/images/" + node.image ); } else { jQuery("#infoOverlayImage").attr( "src", - plugin_path + "datasets/images/default.jpg" + Config.PLUGIN_PATH + "datasets/images/default.jpg" ); } @@ -162,7 +163,8 @@ class InfoOverlay { if ("image" in target) { const linkImage = document.createElement("img"); - linkImage.src = plugin_path + "datasets/images/" + target.image; + linkImage.src = + Config.PLUGIN_PATH + "datasets/images/" + target.image; linkDiv.appendChild(linkImage); }