PageSourceSearch

https://www.flowtraders.com/js/photo-carousel.js

js flowtraders.com collected 2026-10-02 03:02:28 UTC 2,528 bytes, 77 lines download raw bytes

1NodeList.prototype.find = Array.prototype.find;
2NodeList.prototype.findIndex = Array.prototype.findIndex;
3NodeList.prototype.forEach = Array.prototype.forEach;
4
5const carousels = document.querySelectorAll('.getCarouselLRPhoto');
6carousels.forEach(function (carousel) {
7  var expandButtons = carousel.querySelectorAll('#expand-btn');
8  var collapseButtons = carousel.querySelectorAll('#collapse-btn');
9
10  var text = carousel.querySelectorAll('#text');
11
12  function toggleButton(e) {
13    var index;
14    if (!expandButtons.find((b) => b === e.target)) {
15      index = collapseButtons.findIndex((b) => b === e.target);
16    } else {
17      index = expandButtons.findIndex((b) => b === e.target);
18    }
19
20    if (index === -1) {
21      // if the element is an svg go to the parent element
22      index = expandButtons.findIndex((b) => b === e.target.parentElement);
23      if (index === -1) {
24        index = collapseButtons.findIndex((b) => b === e.target.parentElement);
25      }
26    }
27    text.forEach((el, i) => {
28      const moreText = text[i].querySelector('p')?.innerHTML.length || 0;
29      if (moreText > 0) {
30        expandButtons[i]?.classList.remove('hidden');
31      }
32      collapseButtons[i]?.classList.add('hidden');
33      text[i]?.classList.add('hidden');
34    });
35    if (text[index]?.classList.contains('hidden')) {
36      expandButtons[index]?.classList.add('hidden');
37      collapseButtons[index]?.classList.remove('hidden');
38      text[index]?.classList.remove('hidden');
39
40      text.forEach((el, i) => {
41        const elParagraph = el.querySelector('p')?.innerHTML;
42
43        if (elParagraph === text[index]?.querySelector('p')?.innerHTML && i !== index) {
44          el?.classList.remove('hidden');
45
46          const parentElement = el.parentElement;
47          const expandBtn = parentElement?.querySelector('#expand-btn');
48          const collapseBtn = parentElement?.querySelector('#collapse-btn');
49
50          expandBtn?.classList.add('hidden');
51          collapseBtn?.classList.remove('hidden');
52        }
53      })
54    }
55  }
56
57  function collapse() {
58    text.forEach((el, i) => {
59      const moreText = text[i].querySelector('p')?.innerHTML.length || 0;
60      if (moreText > 0) {
61        expandButtons[i]?.classList.remove('hidden');
62      }
63      collapseButtons[i]?.classList.add('hidden');
64      text[i]?.classList.add('hidden');
65    });
66  }
67
68  expandButtons.forEach((b) => {
69    b.addEventListener('click', toggleButton);
70  });
71
72  collapseButtons.forEach((b) => {
73    b.addEventListener('click', collapse);
74  });
75
76}
77)

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.