File: design-tabs.js

package info (click to toggle)
nvidia-cuda-toolkit 12.5.0-1
  • links: PTS, VCS
  • area: non-free
  • in suites: experimental
  • size: 13,247,276 kB
  • sloc: ansic: 214,716; cpp: 65,455; javascript: 24,274; python: 22,339; xml: 11,484; makefile: 3,079; sh: 2,288; perl: 356
file content (27 lines) | stat: -rw-r--r-- 770 bytes parent folder | download | duplicates (51)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
var sd_labels_by_text = {};

function ready() {
  const li = document.getElementsByClassName("sd-tab-label");
  for (const label of li) {
    syncId = label.getAttribute("data-sync-id");
    if (syncId) {
      label.onclick = onLabelClick;
      if (!sd_labels_by_text[syncId]) {
        sd_labels_by_text[syncId] = [];
      }
      sd_labels_by_text[syncId].push(label);
    }
  }
}

function onLabelClick() {
  // Activate other inputs with the same sync id.
  syncId = this.getAttribute("data-sync-id");
  for (label of sd_labels_by_text[syncId]) {
    if (label === this) continue;
    label.previousElementSibling.checked = true;
  }
  window.localStorage.setItem("sphinx-design-last-tab", syncId);
}

document.addEventListener("DOMContentLoaded", ready, false);