PageSourceSearch

https://www.herbavia.cz/user/documents/club-select.js?1.1v

js herbavia.cz collected 2026-10-08 22:39:36 UTC 1,690 bytes, 49 lines download raw bytes

1
2(function () {
3  // Spustí se pouze na stránce Herbavia Klub
4  if (!window.location.pathname.includes('herbavia-klub')) return;
5
6  function selectFirstVariant() {
7    var select = document.querySelector('select[name="variantId"], select.variants-select, select#variantSelect, select[id*="variant"]');
8    
9    if (!select) {
10      // Zkus najít jakýkoliv select s variantami
11      var allSelects = document.querySelectorAll('select');
12      for (var i = 0; i < allSelects.length; i++) {
13        if (allSelects[i].options.length > 1) {
14          select = allSelects[i];
15          break;
16        }
17      }
18    }
19
20    if (select) {
21      // Vyber první skutečnou variantu (přeskoč placeholder "Zvolte variantu")
22      var firstRealOption = null;
23      for (var j = 0; j < select.options.length; j++) {
24        if (select.options[j].value && select.options[j].value !== '') {
25          firstRealOption = select.options[j];
26          break;
27        }
28      }
29
30      if (firstRealOption) {
31        select.value = firstRealOption.value;
32        // Spustit change event, aby se aktualizovala cena/stock
33        var event = new Event('change', { bubbles: true });
34        select.dispatchEvent(event);
35        console.log('Varianta předvybrána:', firstRealOption.text);
36      }
37    }
38  }
39
40  // Zkus ihned, a pokud stránka ještě nenačetla select, počkej
41  if (document.readyState === 'loading') {
42    document.addEventListener('DOMContentLoaded', selectFirstVariant);
43  } else {
44    selectFirstVariant();
45    // Pojistka pro lazy-loaded obsah
46    setTimeout(selectFirstVariant, 500);
47    setTimeout(selectFirstVariant, 1500);
48  }
49})();

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.