Skip to content
Snippets Groups Projects
Select Git revision
  • 4bf2c505bbbbec750ac90c53c311e64acf60608e
  • master default protected
  • feat/new-image-formats
  • clickable-select-chevron
  • 2.20.0
  • 2.19.0
  • 2.18.0
  • 2.17.0
  • 2.16.1
  • 2.16.0
  • 2.15.0
  • 2.14.0
  • 2.13.0
  • 2.12.1
  • 2.11.0
  • 2.10.0
  • 2.9.1
  • 2.9.0
  • 2.8.0
  • 2.7.1
  • 2.7.0
  • 2.6.0
  • 2.5.2
  • 2.5.1
24 results

_01-foot.mustache

Blame
  • _01-foot.mustache 1.04 KiB
    
      <!--DO NOT REMOVE-->
      {{{ patternLabFoot }}}
    
      <script src="https://cdn.jsdelivr.net/npm/vue@2.6.11/dist/vue.js"></script>
      <script src="../../js/main.bundle.js?{{ cacheBuster }}"></script>
    
      <script>
        /*
         * By default, {{ link.[pattern] }} starts with /, which breaks when app
         * isn't served from the root like in case of versioned styleguide.
         * This fixes that in most cases by detecting the current prefix from
         * location.pathname and makes it work the same way the main pattern lab nav.
         * IMPORTANT: hrefs need to be marked with data-href instead of real href
         */
        var idx = location.pathname.indexOf("/patterns");
        var prefix = location.pathname.substring(0, idx);
        var anchors = document.querySelectorAll('a[data-href]');
    
        for (var i = 0; i < anchors.length; i++) {
          var anchor = anchors[i];
          if (prefix != "") {
            anchor.setAttribute('href', prefix +  anchor.dataset.href);
          } else {
            anchor.setAttribute('href', anchor.dataset.href);
          }
        }
      </script>
    
      </body>
    </html>