PageSourceSearch

https://www.affingroup.com/themes/demo/js/customer-care.js

js affingroup.com collected 2026-10-02 17:45:23 UTC 4,124 bytes, 106 lines download raw bytes

1function customerCareTabbedComponent(event)
2{
3    if (!event) return;
4    
5    let parentClassName = event.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.className.replace(/\ /g, '.');
6    // console.log(parentClassName);
7
8    const tabs = document.querySelectorAll(`.${parentClassName} .cc-tab`);
9    const tabsContent = document.querySelectorAll(`.${parentClassName} .tab-content`);
10    const clicked = event.children[0];
11    // console.log(clicked);
12
13    tabs.forEach(t => t.classList.remove('tab--active'));
14    tabsContent.forEach(c => c.classList.remove('content--active'));
15    clicked.classList.add('tab--active');
16
17    document.querySelector(`.${parentClassName} .tab-content--${clicked.dataset.tab}`).classList.add('content--active');
18
19    //radio btn (Not used anymore, using their form from iframe)
20    // const radioBtn = document.querySelectorAll(`.${parentClassName} .feedback-btn`);
21    // const radioBtnContainer = document.querySelector(`.${parentClassName} .feedback-btn-container`);
22
23    // if (radioBtnContainer) {
24    //     radioBtnContainer.addEventListener('click', function (e) {
25    //         const clicked = e.target.closest('.feedback-btn');
26
27    //         if (!clicked) {
28    //             return;
29    //         }
30
31    //         radioBtn.forEach(t => t.classList.remove('feedback-btn-selected'));
32    //         clicked.classList.add('feedback-btn-selected');
33    //     });
34    // }
35    
36    //getURLParam(tabs, tabsContent);
37}
38
39function getURLParam(tabs, tabsContent) {
40    fetch('/currentLang')
41    .then(response => response.text())
42    .then(lang => {
43        var url = new URL(location.href);
44        var section = url.searchParams.get('section');
45        var sectionSelected;
46        var sectionParent;
47        var tempContactCenter;
48        var tempBranchOperation;
49        var tempOnlineFeed;
50        var tempYourVoice;
51
52        switch (lang) {
53            case 'zh':
54               
55                break;
56            case 'ms':
57                tempContactCenter = "Pusat Panggilan";
58                tempBranchOperation = "Waktu Operasi Cawagan"
59                tempOnlineFeed = "Borang Maklum Balas";
60                tempYourVoice = "Suarakan Pendapat Anda!"
61                break;
62            case 'en':
63                default:
64                    tempContactCenter = "Contact Center";
65                    tempBranchOperation = "Branch Operation Hours"
66                    tempOnlineFeed = "Online Feedback Form";
67                    tempYourVoice = "Your Voice Counts!"
68                break;
69        }
70
71        if (section) {
72            if (section == "contactcenter") {
73                // sectionSelected = $("p:contains(Pusat Panggilan)");
74                sectionSelected = $("p:contains(" + tempContactCenter + ")");
75            }
76            else if (section == "branchoperation") {
77                // sectionSelected = $("p:contains(Branch Operation Hours)");
78                sectionSelected = $("p:contains(" + tempBranchOperation + ")");
79            }
80            else if (section == "onlinefeedback") {
81                // sectionSelected = $("p:contains(Online Feedback Form)");
82                sectionSelected = $("p:contains(" + tempOnlineFeed + ")");
83            }
84            else if (section == "yourvoice") {
85                // sectionSelected = $("p:contains(Your Voice Counts!)");
86                sectionSelected = $("p:contains(" + tempYourVoice + ")");
87            }
88
89            tabs.forEach(t => t.classList.remove('tab--active'));
90            tabsContent.forEach(c => c.classList.remove('content--active'));
91            sectionSelected.closest('.cc-tab')[0].classList.add('tab--active');
92
93            document.querySelector(`.tab-content--${sectionSelected.closest('.cc-tab')[0].dataset.tab}`).classList.add('content--active');
94
95            sectionParent = sectionSelected[1];
96
97            // console.log(sectionParent);
98
99            sectionParent.scrollIntoView({ behavior: 'smooth', block: 'start' });
100        }
101    });
102}
103
104if (document.querySelector('.block-customer-care')) {
105    customerCareTabbedComponent();
106}

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.