// Conversion tracking guide (/conversion-tracking, 2026-10-24): the Copy buttons on the code examples. Copies the text of // the
 in the same box (placeholders included). Frame handling (traffic exchanges) is common.js's, like every page.
(function () {
  function flash(b, t) { var o = b.getAttribute('data-label') || b.textContent; b.setAttribute('data-label', o); b.textContent = t; setTimeout(function () { b.textContent = o; }, 1600); }
  document.querySelectorAll('[data-copy]').forEach(function (b) {
    b.addEventListener('click', function () {
      var box = b.closest('.cg-code'); var pre = box && box.querySelector('pre'); if (!pre) return;
      var text = pre.textContent;
      var done = function () { flash(b, 'Copied'); };
      var fallback = function () {
        try { var r = document.createRange(); r.selectNodeContents(pre); var s = window.getSelection(); s.removeAllRanges(); s.addRange(r); var ok = document.execCommand && document.execCommand('copy'); flash(b, ok ? 'Copied' : 'Selected'); }
        catch (e) { flash(b, 'Select and copy'); }
      };
      try { if (navigator.clipboard && navigator.clipboard.writeText) navigator.clipboard.writeText(text).then(done, fallback); else fallback(); } catch (e) { fallback(); }
    });
  });
})();