PageSourceSearch

https://rgu.ac/new-web/js/index-js/all-labs.js?v=1790317896

js rgu.ac collected 2026-09-25 06:31:51 UTC 7,873 bytes, 293 lines download raw bytes

1document.addEventListener("DOMContentLoaded", () => {
2
3    /* ================= RESEARCH DATA ================= */
4
5    const researchData = [
6        {
7            img: "/new-web/assets/labs/architecture.png",
8            title: "Architecture Lab",
9            link: "https://rgu.ac/lab-architecture",
10        },
11
12        {
13            img: "/new-web/assets/labs/biochem.png",
14            title: "Biochemistry Lab",
15            link: "https://rgu.ac/lab-bio-chemistry",
16        },
17
18        {
19            img: "/new-web/assets/labs/bioscience-research-lab.png",
20            title: "Bioscience Research Lab",
21            link: "https://rgu.ac/lab-bioscience-research",
22        },
23
24        {
25            img: "/new-web/assets/labs/biotech-lab.png",
26            title: "Biotechnology Lab",
27            link: "https://rgu.ac/lab-biotech",
28        },
29        {
30            img: "/new-web/assets/labs/botany.png",
31            title: "Botany Lab",
32            link: "https://rgu.ac/lab-botany",
33        },
34        {
35            img: "/new-web/assets/labs/chemistry.png",
36            title: "Chemistry Lab",
37            link: "https://rgu.ac/lab-chemistry",
38        },
39        {
40            img: "/new-web/assets/labs/civil-engg-lab.png",
41            title: "Civil Engineering Lab",
42            link: "https://rgu.ac/lab-civilengineering",
43        },
44        {
45            img: "/new-web/assets/labs/computer-lab.png",
46            title: "Computer Lab",
47            link: "https://rgu.ac/lab-computer",
48        },
49        {
50            img: "/new-web/assets/labs/diagnostic.png",
51            title: "Diagonastic Lab",
52            link: "https://rgu.ac/lab-diagnostic",
53        },
54        {
55            img: "/new-web/assets/labs/electrical.png",
56            title: "Electrical Lab",
57            link: "https://rgu.ac/lab-electrical",
58        },
59        {
60            img: "/new-web/assets/labs/electronic.png",
61            title: "Electronic Lab",
62            link: "https://rgu.ac/lab-electronic",
63        },
64        {
65            img: "/new-web/assets/labs/engineeringdrawing.png",
66            title: "Engineering Drawing Lab",
67            link: "https://rgu.ac/lab-engineering_drawing",
68        },
69        {
70            img: "/new-web/assets/labs/ev.jpeg",
71            title: "Electric Vehicle Lab",
72            link: "https://rgu.ac/lab-ev-lab",
73        },
74        {
75            img: "/new-web/assets/labs/foodtech.png",
76            title: "Food Technology Lab",
77            link: "https://rgu.ac/lab-foodteach",
78        },
79        {
80            img: "/new-web/assets/labs/forensic.png",
81            title: "Forensic Lab",
82            link: "https://rgu.ac/lab-forensic-lab",
83        },
84        {
85            img: "/new-web/assets/labs/hotelmanagement.png",
86            title: "Hotel Management Lab",
87            link: "https://rgu.ac/lab-hotelmanagement",
88        },
89        {
90            img: "/new-web/assets/labs/interior.png",
91            title: "Interior Designing Lab",
92            link: "https://rgu.ac/lab-interior",
93        },
94        {
95            img: "/new-web/assets/labs/language.png",
96            title: "Language Lab",
97            link: "https://rgu.ac/lab-language-lab",
98        },
99        {
100            img: "/new-web/assets/labs/mechanical-engg.png",
101            title: "Mechanical Lab",
102            link: "https://rgu.ac/lab-mechanical",
103        },
104        {
105            img: "/new-web/assets/labs/microbio.png",
106            title: "Microbiology Lab",
107            link: "https://rgu.ac/lab-microbiology",
108        },
109        {
110            img: "/new-web/assets/labs/nursing.png",
111            title: "Nursing Lab",
112            link: "https://rgu.ac/lab-nursing",
113        },
114        {
115            img: "/new-web/assets/labs/observe.jpeg",
116            title: "Royal Observatory",
117            link: "https://rgu.ac/lab-astronomy",
118        },
119        {
120            img: "/new-web/assets/labs/operation.png",
121            title: "Operation Theatre Lab",
122            link: "https://rgu.ac/lab-operation_theater",
123        },
124        {
125            img: "/new-web/assets/labs/optometry.png",
126            title: "Optometry Lab",
127            link: "https://rgu.ac/lab-optometry",
128        },
129        {
130            img: "/new-web/assets/labs/pharmacy.png",
131            title: "Pharmacutical Lab",
132            link: "https://rgu.ac/lab-pharmacy",
133        },
134        {
135            img: "/new-web/assets/labs/physics.png",
136            title: "Physics Lab",
137            link: "https://rgu.ac/lab-physics",
138        },
139        {
140            img: "/new-web/assets/labs/physiotherapy.png",
141            title: "Physiotherapy Lab",
142            link: "https://rgu.ac/lab-physiotherapy",
143        },
144        {
145            img: "/new-web/assets/labs/radiology.png",
146            title: "Radiology Lab",
147            link: "https://rgu.ac/lab-radiography",
148        },
149        {
150            img: "/new-web/assets/labs/zoology.png",
151            title: "Zoology Lab",
152            link: "https://rgu.ac/lab-zoology",
153        },
154    ];
155
156
157    const rdTrack = document.getElementById("rdTrack");
158    const rdPrevBtn = document.querySelector(".rgu-lab-prev");
159    const rdNextBtn = document.querySelector(".rgu-lab-next");
160
161
162
163    /* ================= GENERATE CARDS ================= */
164
165    researchData.forEach(item => {
166
167        const card = document.createElement("a");
168
169        card.className = "rgu-lab-card";
170        card.href = item.link;
171
172        card.innerHTML = `
173            <img src="${item.img}" alt="${item.title}">
174            <div class="rgu-lab-overlay"></div>
175
176            <div class="rgu-lab-card-content">
177                <h4>${item.title}</h4>
178            </div>
179
180            <div class="rgu-lab-cta">
181                DISCOVER MORE +
182            </div>
183        `;
184
185        rdTrack.appendChild(card);
186
187    });
188
189
190
191    /* ================= SLIDER ================= */
192
193    const rdCards = document.querySelectorAll(".rgu-lab-card");
194
195    if (rdTrack && rdCards.length > 0) {
196
197        let rdAutoScroll;
198
199        function getScrollAmount() {
200            return rdCards[0].offsetWidth + 48;
201        }
202
203        function moveSlide(direction) {
204
205            if (direction === "next") {
206
207                if (rdTrack.scrollLeft + rdTrack.clientWidth >= rdTrack.scrollWidth - 10) {
208
209                    rdTrack.scrollTo({
210                        left: 0,
211                        behavior: "smooth"
212                    });
213
214                } else {
215
216                    rdTrack.scrollBy({
217                        left: getScrollAmount(),
218                        behavior: "smooth"
219                    });
220
221                }
222
223            }
224
225            else if (direction === "prev") {
226
227                if (rdTrack.scrollLeft <= 0) {
228
229                    rdTrack.scrollTo({
230                        left: rdTrack.scrollWidth,
231                        behavior: "smooth"
232                    });
233
234                } else {
235
236                    rdTrack.scrollBy({
237                        left: -getScrollAmount(),
238                        behavior: "smooth"
239                    });
240
241                }
242
243            }
244
245        }
246
247
248
249        /* BUTTON EVENTS */
250
251        rdNextBtn?.addEventListener("click", () => {
252            moveSlide("next");
253            resetAuto();
254        });
255
256        rdPrevBtn?.addEventListener("click", () => {
257            moveSlide("prev");
258            resetAuto();
259        });
260
261
262
263        /* AUTO SLIDE */
264
265        function startAuto() {
266
267            rdAutoScroll = setInterval(() => {
268                moveSlide("next");
269            }, 3500);
270
271        }
272
273        function resetAuto() {
274
275            clearInterval(rdAutoScroll);
276            startAuto();
277
278        }
279
280
281
282        /* HOVER PAUSE */
283
284        rdTrack.addEventListener("mouseenter", () => clearInterval(rdAutoScroll));
285        rdTrack.addEventListener("mouseleave", startAuto);
286
287
288
289        startAuto();
290
291    }
292
293});

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.