PageSourceSearch

https://www.osmanlisahafi.com/resources/assets/js/block/showcase.js?v=1789374620

js osmanlisahafi.com collected 2026-09-24 13:47:25 UTC 3,590 bytes, 95 lines download raw bytes

1const showcases = document.querySelectorAll('[data-toggle="showcase"]');
2Array.from(showcases).forEach(element => {
3    try {
4        const id = element.closest('[data-block-id]')?.dataset.blockId;
5        if (!id) {
6            console.warn('showcases warn: id (data-block-id) undefined');
7            return;
8        }
9
10        const buttons = element.querySelectorAll('[data-toggle="showcase-button"]');
11        if (buttons.length == 0) {
12            createSlider(element, id, 'showcase');
13            return;
14        }
15
16        Array.from(buttons).forEach(btn => {
17            if (btn.components == 1) return;
18
19            const tabId = btn.dataset.showcaseTab;
20            if (!tabId) return;
21
22            const tabElement = element.querySelector(tabId);
23            if (!tabElement) return;
24
25            btn.addEventListener('click', async e => {
26                let url = btn.dataset.url;
27                const callback = btn.dataset.callback;
28
29                let result = null;
30                if (url && !btn.loaded) {
31                    const tabProduct = tabElement.querySelector('[data-showcase-products]');
32                    if (!tabProduct) return;
33
34                    try {
35                        if (PAGE_ID == '3') {
36                            const product = document.querySelector('#product-id');
37                            if (product?.value) url = url + '?productId=' + product.value;
38                        }
39                        await request('GET', url).then(response => {
40                            result = response;
41                            if (result) {
42                                tabProduct.innerHTML = result;
43                                tabProduct.parentNode.insertBefore(tabProduct.content.cloneNode(true), tabProduct);
44                                tabProduct.remove();
45                            }
46                        });
47                    } catch (error) {
48                        console.warn(`showcase ${url} error => ${error}`);
49                    } finally {
50                        components.favourite.set();
51                        components.compare.get();
52                        components.init();
53                        btn.loaded = 1;
54                    }
55                }
56
57                btn.classList.add('active');
58                tabElement.classList.add('active');
59                setTimeout(() => {
60                    tabElement.classList.add('tab-loaded');
61                }, 200);
62
63                Array.from(buttons).forEach(item => {
64                    if (item != btn) {
65                        const tabId = item.dataset.showcaseTab;
66                        if (!tabId) return;
67
68                        const tabElement = element.querySelector(tabId);
69                        if (!tabElement) return;
70
71                        item.classList.remove('active');
72                        tabElement.classList.remove('active');
73                        tabElement.classList.remove('tab-loaded');
74                    }
75                });
76
77                if (tabElement) {
78                    createSlider(tabElement, id, 'showcase');
79                }
80
81                if (typeof window[callback] == 'function') {
82                    try {
83                        window[callback](btn, tabElement);
84                    } catch (error) { }
85                }
86            });
87
88            if (btn.classList.contains('active')) btn.classList.add('tab-loaded');
89            if (btn.classList.contains('active')) btn.click();
90
91            btn.components = 1;
92        });
93    } catch (error) {
94    }
95});

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.