view index.html @ 4:068da7f7cd83 draft default tip

planemo upload for repository https://github.com/goeckslab/tools-mti/tree/main/tools/vitessce commit bc4c0bb6784a55399241f99a29b176541a164a18
author goeckslab
date Thu, 20 Feb 2025 19:47:16 +0000
parents 9f60ef2d586e
children
line wrap: on
line source

<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>Vitessce</title>
  </head>
  <body style="background-color:#666666">
    <div id="root"></div>
    <noscript>
        <div>
          This Galaxy visualization uses JavaScript -- to view this an admin must allow the tool to execute JS in it's HTML output
        </div>
    </noscript>
    <script type="importmap">
      {
        "imports": {
          "react": "https://esm.sh/react@18.2.0?dev",
          "react-dom": "https://esm.sh/react-dom@18.2.0?dev",
          "react-dom/client": "https://esm.sh/react-dom@18.2.0/client?dev",
          "vitessce": "https://unpkg.com/vitessce@3.5.1"
        }
      }
    </script>
    <script type="module">
      import React from 'react';
      import { createRoot } from 'react-dom/client';
      import { Vitessce } from 'vitessce';
      import { config } from './config.js';

      console.log('here be url: '+window.location.href);
      var current_url = window.location.href.replace(new RegExp('\/[^\/]*$'), '');
      console.log(current_url);
      function rewriteURL(input) {
        for (let k in input) {
        if (typeof input[k] === 'string' || input[k] instanceof String) {
            input[k] = input[k].replace('http://localhost', current_url)
        }
        else {
            input[k] = rewriteURL(input[k])
        }
        }
        return input;
      };
      var fixed_conf = {...config};
      fixed_conf = rewriteURL(fixed_conf);
      console.log('conf fixed:');
      console.log(fixed_conf);
      function MyApp() {
        return React.createElement(
          Vitessce,
          {
            height: 1000,
            theme: 'dark',
            config: fixed_conf,
          }
        );
      }

      const container = document.getElementById('root');
      const root = createRoot(container);
      root.render(React.createElement(MyApp));
    </script>
  </body>
</html>