INNER CODE UNIT · JavaScript

rememberCategory

smithyhq/sqladmin · sqladmin/statics/js/main.js:666

  function rememberCategory(name, isExpanded) {
    var names = readExpanded().filter(function (stored) { return stored !== name; });
    if (isExpanded) names.push(name);
    writeExpanded(names);
  }

  // Bootstrap marks both the toggle and the menu with `show`, and reads the
  // class back off the toggle to decide what a click should do. Restoring only
  // one of the two makes the next click a no-op.
  var expanded = readExpanded();
  Array.prototype.forEach.call(
    navbar.querySelectorAll('[data-sqladmin-menu-category]'),
    function (item) {
      var name = item.getAttribute('data-sqladmin-menu-category');
      if (expanded.indexOf(name) === -1) return;

      var toggle = item.querySelector('[data-bs-toggle="dropdown"]');
      var dropdown = item.querySelector('.dropdown-menu');

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…