PageSourceSearch

https://cmsprime.com/wp-content/themes/hello-elementor-child/assets/js/main.js?ver=1790140152

js cmsprime.com collected 2026-09-24 13:07:58 UTC 6,499 bytes, 192 lines download raw bytes

1document.addEventListener("DOMContentLoaded", function () {
2    const maxWords = 10;
3
4    const translations = {
5        en: { more: 'Load more', less: 'Show less' },
6        fa: { more: 'ادامه مطلب', less: 'بستن' },
7        ar: { more: 'اقرأ المزيد', less: 'إظهار أقل' },
8        fr: { more: 'Lire plus', less: 'Lire moins' },
9        es: { more: 'Leer más', less: 'Leer menos' },
10    };
11
12    const lang = document.documentElement.lang?.slice(0, 2).toLowerCase() || 'en';
13    const i18n = translations[lang] || translations['en'];
14
15    document.querySelectorAll(".read_curs").forEach((wrapper, index) => {
16        const paragraph = wrapper.querySelector("p");
17        if (!paragraph) return;
18
19        const originalText = paragraph.textContent.trim();
20        const words = originalText.split(/\s+/);
21        if (words.length <= maxWords) return;
22
23        const shortText = words.slice(0, maxWords).join(" ");
24        const remainingText = words.slice(maxWords).join(" ");
25
26        /* Create DOM elements */
27        const spanShort = document.createElement("span");
28        spanShort.className = "read-short";
29        spanShort.textContent = shortText;
30
31        const spanEllipsis = document.createElement("span");
32        spanEllipsis.className = "read-ellipsis";
33        spanEllipsis.textContent = "...";
34
35        const spanFull = document.createElement("span");
36        spanFull.className = "read-full";
37        spanFull.textContent = " " + remainingText;
38
39        const fullWrapper = document.createElement("span");
40        fullWrapper.className = "read-full-wrapper";
41        fullWrapper.appendChild(spanFull);
42
43        const toggleLink = document.createElement("a");
44        toggleLink.href = "#";
45        toggleLink.className = "read-toggle";
46        toggleLink.textContent = i18n.more;
47
48        /* Initial hidden state */
49        fullWrapper.style.maxHeight = "0px";
50        fullWrapper.style.opacity = "0";
51        fullWrapper.style.overflow = "hidden";
52        fullWrapper.style.transition = "all 0.4s ease";
53
54        toggleLink.addEventListener("click", function (e) {
55            e.preventDefault();
56            const isExpanded = fullWrapper.style.maxHeight !== "0px";
57
58            if (isExpanded) {
59                fullWrapper.style.maxHeight = "0px";
60                fullWrapper.style.opacity = "0";
61                toggleLink.textContent = i18n.more;
62                spanEllipsis.style.display = "inline";
63            } else {
64                fullWrapper.style.maxHeight = fullWrapper.scrollHeight + "px";
65                fullWrapper.style.opacity = "1";
66                toggleLink.textContent = i18n.less;
67                spanEllipsis.style.display = "none";
68            }
69        });
70
71        /* Clear and rebuild paragraph content */
72        paragraph.textContent = '';
73        paragraph.appendChild(spanShort);
74        paragraph.appendChild(spanEllipsis);
75        paragraph.appendChild(fullWrapper);
76        paragraph.appendChild(toggleLink);
77    });
78});
79/*Animatoin*/
80document.addEventListener("DOMContentLoaded", () => {
81  const tabsSelector = ".elementor-widget-n-tabs.animatedTab";
82  const tabsWidgets = document.querySelectorAll(tabsSelector);
83
84  if (typeof gsap === "undefined") {
85    console.warn("GSAP is required for tab animation but not found.");
86    return;
87  }
88
89  tabsWidgets.forEach((widget) => {
90    const tabHeaders = widget.querySelectorAll(".e-n-tabs-heading .e-n-tab-title");
91    const tabContents = widget.querySelectorAll(".e-n-tabs-content [id*='e-n-tab-content-']");
92    let currentIndex = 0;
93    const animationDuration = 5000;
94    let animationTween = null;
95
96    tabHeaders.forEach((header) => {
97      if (!header.querySelector(".progress-bar")) {
98        const progressBar = document.createElement("div");
99        progressBar.classList.add("progress-bar");
100        Object.assign(progressBar.style, {
101          position: "absolute",
102          bottom: "0",
103          left: "0",
104          height: "1px",
105          backgroundColor: "var(--e-global-color-accent)",
106          width: "0%",
107        });
108        header.style.position = "relative";
109        header.appendChild(progressBar);
110      }
111      if (!header.hasAttribute("role")) header.setAttribute("role", "tab");
112      if (!header.hasAttribute("tabindex")) header.setAttribute("tabindex", "-1");
113    });
114
115    function switchTab(index) {
116      if (animationTween) {
117        animationTween.kill();
118        animationTween = null;
119      }
120
121      tabHeaders.forEach((header, i) => {
122        const bar = header.querySelector(".progress-bar");
123        bar.style.width = "0%";
124        header.setAttribute("aria-selected", "false");
125        header.classList.remove("active");
126        header.setAttribute("tabindex", "-1");
127      });
128
129      const activeHeader = tabHeaders[index];
130      activeHeader.setAttribute("aria-selected", "true");
131      activeHeader.classList.add("active");
132      activeHeader.setAttribute("tabindex", "0");
133      /*activeHeader.focus();*/
134
135      tabContents.forEach((content, i) => {
136        content.style.display = i === index ? "block" : "none";
137      });
138
139      currentIndex = index;
140
141      const currentBar = activeHeader.querySelector(".progress-bar");
142      animationTween = gsap.to(currentBar, {
143        width: "100%",
144        duration: animationDuration / 1000,
145        ease: "linear",
146        onComplete: () => {
147          const nextIndex = (currentIndex + 1) % tabHeaders.length;
148          switchTab(nextIndex);
149        },
150      });
151    }
152
153    tabHeaders.forEach((header, index) => {
154      header.style.cursor = "pointer";
155
156      header.addEventListener("click", () => {
157        if (currentIndex !== index) {
158          switchTab(index);
159        }
160      });
161
162      header.addEventListener("keydown", (e) => {
163        if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
164          e.preventDefault();
165          if (currentIndex !== index) {
166            switchTab(index);
167          }
168        }
169      });
170    });
171
172    switchTab(currentIndex);
173  });
174});
175/*document.querySelector('#toggleLiveChat').addEventListener('click', e => {
176  e.preventDefault();
177  window.Tawk_API.toggle();
178}); */
179
180document.addEventListener('DOMContentLoaded', function () {
181    const chatBtn = document.querySelector('#toggleLiveChat');
182
183    if (chatBtn) {
184        chatBtn.addEventListener('click', function (e) {
185            e.preventDefault();
186
187            if (window.Tawk_API) {
188                window.Tawk_API.toggle();
189            }
190        });
191    }
192});

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.