PageSourceSearch

https://abat-russia.ru/catalog/view/javascript/technics/copy-sku.js?v

js abat-russia.ru collected 2026-09-30 03:04:45 UTC 1,690 bytes, 58 lines download raw bytes

1function copySku(buttonEl) {
2  const sku = buttonEl.dataset.sku;
3
4  if (navigator.clipboard) {
5    navigator.clipboard.writeText(sku).then(() => showCopyMessage(buttonEl));
6  } else {
7    const temp = document.createElement('input');
8    document.body.appendChild(temp);
9    temp.value = sku;
10    temp.select();
11    document.execCommand('copy');
12    document.body.removeChild(temp);
13    showCopyMessage(buttonEl);
14  }
15}
16
17function showCopyMessage(buttonEl) {
18  const message = document.createElement('div');
19  message.textContent = 'Скопировано!';
20  message.style.cssText = `
21    position: absolute;
22    background: #333;
23    color: #fff;
24    padding: 5px 10px;
25    border-radius: 4px;
26    font-size: 13px;
27    white-space: nowrap;
28    opacity: 0;
29    transform: translateY(-5px);
30    transition: all 0.3s ease;
31    pointer-events: none;
32    z-index: 1000;
33  `;
34
35  // Обеспечиваем, что кнопка — позиционированный контейнер
36  if (getComputedStyle(buttonEl).position === 'static') {
37    buttonEl.style.position = 'relative';
38  }
39
40  // Добавляем сообщение в кнопку
41  buttonEl.appendChild(message);
42
43  // Позиционируем справа от кнопки
44  message.style.left = '100%';
45  message.style.top = '50%';
46  message.style.transform = 'translate(8px, -50%)';
47  requestAnimationFrame(() => {
48    message.style.opacity = '1';
49    message.style.transform = 'translate(8px, -50%)';
50  });
51
52  // Удаляем через 1.5 сек
53  setTimeout(() => {
54    message.style.opacity = '0';
55    message.style.transform = 'translate(8px, -60%)';
56    setTimeout(() => message.remove(), 300);
57  }, 1500);
58}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.