Sha256: fe654ab9c312918f6e93f6b4b52fb7232a0a97dc4aeee7d19c8ca6e6150e04af

Contents?: true

Size: 1.57 KB

Versions: 13

Compression:

Stored size: 1.57 KB

Contents

/* global bootstrap: false */

(function () {
  'use strict'

  // Tooltip and popover demos
  document.querySelectorAll('.tooltip-demo')
    .forEach(function (tooltip) {
      new bootstrap.Tooltip(tooltip, {
        selector: '[data-bs-toggle="tooltip"]'
      })
    })

  document.querySelectorAll('[data-bs-toggle="popover"]')
    .forEach(function (popover) {
      new bootstrap.Popover(popover)
    })

  document.querySelectorAll('.toast')
    .forEach(function (toastNode) {
      var toast = new bootstrap.Toast(toastNode, {
        autohide: false
      })

      toast.show()
    })

  // Disable empty links and submit buttons
  document.querySelectorAll('[href="#"], [type="submit"]')
    .forEach(function (link) {
      link.addEventListener('click', function (event) {
        event.preventDefault()
      })
    })

  function setActiveItem() {
    var hash = window.location.hash

    if (hash === '') {
      return
    }

    var link = document.querySelector('.bd-aside a[href="' + hash + '"]')

    if (!link) {
      return
    }

    var active = document.querySelector('.bd-aside .active')
    var parent = link.parentNode.parentNode.previousElementSibling

    link.classList.add('active')

    if (parent.classList.contains('collapsed')) {
      parent.click()
    }

    if (!active) {
      return
    }

    var expanded = active.parentNode.parentNode.previousElementSibling

    active.classList.remove('active')

    if (expanded && parent !== expanded) {
      expanded.click()
    }
  }

  setActiveItem()
  window.addEventListener('hashchange', setActiveItem)
})()

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
card-mod-bootstrap-0.18.1 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.18.0 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.17.0 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.16.0 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.6 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.5 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.4 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.3 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.1.2 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.2.pre1 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.1.1 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.1 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js
card-mod-bootstrap-0.15.0 vendor/bootstrap/site/content/docs/5.1/examples/cheatsheet/cheatsheet.js