{% extends 'page.html' %}


{% block maincss %}overflow-hidden{% endblock %}


{% block js %}

  <script src="/js/models/kf25.js"></script>
  <script src="/js/models/viewport.js"></script>
  <script src="/js/models/multiport.js"></script>
  <script src="/js/models/chamber.js"></script>
  <script src="/js/models/k526s-body.js"></script>
  <script src="/js/models/k526s-head.js"></script>
  <script src="/js/models/k526s-fixture.js"></script>
  <script src="/js/models/k526s-adapter.js"></script>
  <script src="/js/models/k526s-adapter-assy.js"></script>

  <script>
    (function () {

      function findBootstrapEnvironment() {
        let envs = ['xs', 'sm', 'md', 'lg', 'xl'];

        let el = document.createElement('div');
        document.body.appendChild(el);

        let curEnv = envs.shift();

        for (let env of envs.reverse()) {
          el.classList.add(`d-${env}-none`);

          if (window.getComputedStyle(el).display === 'none') {
            curEnv = env;
            break;
          }
        }

        document.body.removeChild(el);
        return curEnv;
      }

      var bootstrap_env = findBootstrapEnvironment();
      var params_chamber = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 200, scale: 1} : {width: 800, height: 600, scale: 3};
      var params_kf25 = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 300, scale: 10, offset: new THREE.Vector3(-8, 0, 0)} : {width: 400, height: 300, scale: 10, offset: new THREE.Vector3(-8, 0, 0)};
      var params_viewport = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 300, scale: 3} : {width: 400, height: 300, scale: 3};
      var params_multiport = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 300, scale: 3} : {width: 400, height: 300, scale: 3};
      var params_k526s_body = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 300, scale: 6, offset: new THREE.Vector3(-10, -15, 0)} : {width: 400, height: 300, scale: 6, offset: new THREE.Vector3(-10, -15, 0)};
      var params_k526s_head = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 300, scale: 8, offset: new THREE.Vector3(25, 0, 0)} : {width: 400, height: 300, scale: 8, offset: new THREE.Vector3(25, 0, 0)};
      var params_k526s_fixture = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 200, scale: 6} : {width: 800, height: 400, scale: 12};
      var params_k526s_adapter = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 300, scale: 8, offset: new THREE.Vector3(-8, 0, 0)} : {width: 400, height: 300, scale: 8, offset: new THREE.Vector3(-8, 0, 0)};
      var params_k526s_assy = (bootstrap_env === 'xs' || bootstrap_env == 'sm') ? {width: 310, height: 300, scale: 8} : {width: 400, height: 300, scale: 8};

      var nodes = [{
        id: 'kf25',
        model: solvespace_model_kf25,
        params: params_kf25,
      }, {
        id: 'viewport',
        model: solvespace_model_viewport,
        params: params_viewport,
      }, {
        id: 'multiport',
        model: solvespace_model_multiport,
        params: params_multiport,
      }, {
        id: 'chamber',
        model: solvespace_model_chamber,
        params: params_chamber,
      }, {
        id: 'k526s-body',
        model: solvespace_model_k526s_body,
        params: params_k526s_body,
      }, {
        id: 'k526s-head',
        model: solvespace_model_k526s_head,
        params: params_k526s_head,
      }, {
        id: 'k526s-fixture',
        model: solvespace_model_k526s_fixture,
        params: params_k526s_fixture,
      }, {
        id: 'k526s-adapter',
        model: solvespace_model_k526s_adapter,
        params: params_k526s_adapter,
      }, {
        id: 'k526s-adapter-assy',
        model: solvespace_model_k526s_adapter_assy,
        params: params_k526s_assy,
      }];

      for (var i = nodes.length - 1; i >= 0; i--) {
        let n = nodes[i];
        if (n.id) {
          let node = document.getElementById(n.id);
          node.parentNode.replaceChild(solvespace(n.model, n.params), node);
        }
      }

    })();
  </script>

{% endblock %}