PageSourceSearch

https://www.royalenfield.com/etc.clientlibs/re-platform/clientlibs…ion.min.6ab46a437df6078ba3877721e083342b.js

js royalenfield.com collected 2026-09-24 08:58:52 UTC 17,627 bytes, 431 lines download raw bytes

1$(function(){
2    // $(document).on('click','.secNavDataAnaList',function(){
3    //     let clickText = $(this).children("a").text().trim();
4    //     let primaryText = $(this).children("a").text().trim();
5    //     let nextUrl = $(this).children("a").attr("href");
6    //     if(nextUrl == undefined){
7    //         nextUrl = "";
8    //     }
9    //     let navigationItemText = $(".fsh-left").children(".fsh-head").children("h1").text().trim();
10    //     if(navigationItemText == undefined || navigationItemText == ""){
11    //         navigationItemText = $(".fsh-left").children(".fsh-head").children("h2").text().trim();
12    //         }
13    //     dataLayer.push({
14    //         'event':'secondaryNavigation',
15    //         'eventCategory':'secondaryNavigation',
16    //         'eventAction':clickText,
17    //         'eventLabel':nextUrl,
18    //         'primaryText':primaryText,
19    //         'headingName':navigationItemText,
20    //      });
21    // });
22
23    $('.secNavDataAnaList').children("a").on('click',function(){
24        let clickText = $(this).text().trim();
25        let primaryText = $(this).text().trim();
26        let nextUrl = $(this).attr("href");
27        if(nextUrl == undefined){
28            nextUrl = "";
29        }
30        let navigationItemText = $(".fsh-left").children(".fsh-head").children("h1").text().trim();
31        if(navigationItemText == undefined || navigationItemText == ""){
32            navigationItemText = $(".fsh-left").children(".fsh-head").children("h2").text().trim();
33            }
34        dataLayer.push({
35            'event':'secondaryNavigation',
36            'eventCategory':'secondaryNavigation',
37            'eventAction':clickText,
38            'eventLabel':nextUrl,
39            'primaryText':primaryText,
40            'headingName':navigationItemText,
41         });
42    });
43
44        $(document).on('click','.secNavAnalyticsBtn',function(){
45        let clickText = $(this).text().trim();
46        let primaryText = $(this).text().trim();
47        let nextUrl = $(this).attr("href");
48        if(nextUrl == undefined){
49            nextUrl = "";
50        }
51        let navigationItemText = $(".fsh-left").children(".fsh-head").children("h1").text().trim();
52        if(navigationItemText == undefined || navigationItemText == ""){
53            navigationItemText = $(".fsh-left").children(".fsh-head").children("h2").text().trim();
54            }
55        dataLayer.push({
56            'event':'secondaryNavigation',
57            'eventCategory':'secondaryNavigation',
58            'eventAction':clickText,
59            'eventLabel':nextUrl,
60            'primaryText':primaryText,
61            'headingName':navigationItemText,
62         });
63    });
64 });
65/*home page */
66$(document).ready(function () {
67    var verifyUrl = $(".myUrlLoginUnique").attr("data-url");
68    var refreshTokenUrl = $(".myUrlLoginUnique").attr("refresh-url");
69    $(".redirectionPath").each(function () {
70        let link = $(this).attr("href");
71        // let link = timerCardLink;
72        if (link == undefined) {
73            $(this).attr("href", "#");
74        } else {
75            link = link.replace("/content/royal-enfield", "");
76            $(this).attr("href", link);
77        }
78    });
79    var verifyUrl = $(".myUrlLoginUnique").attr("data-url");
80    var refreshTokenUrl = $(".myUrlLoginUnique").attr("refresh-url");
81    var currentPageUrl = window.location.pathname;
82
83    var jwtAccessToken;
84    var userFetchedData;
85    var fetchedUserID;
86    var subDomainCookieName = $("body").attr("sub-domain-cookie");
87    var fetchedData = getCookie(subDomainCookieName);
88    if (fetchedData) {
89        userFetchedData = window.atob(fetchedData);
90        userFetchedData = userFetchedData.split("#");
91        fetchedUserID = userFetchedData[0];
92        fetchedRtk = userFetchedData[1];
93        jwtAccessToken = userFetchedData[2];
94    }
95
96    if (!jwtAccessToken && !fetchedUserID) {
97    } else {
98        const verifyTokenPromise = verifyToken(verifyUrl, "promise", refreshTokenUrl);
99        verifyTokenPromise.then(function (value) {
100            $(".toggleCta").hide();
101            if (value.cluster == "EU0001" && value.ridersClubMember == true) {
102                if (currentPageUrl.includes("/rides-and-club") || currentPageUrl.includes("/users")) {
103                    $(".riderportal").hide();
104                    $(".dynamicUrl").attr("href", "javaScript:void(0)");
105                    $(".floatingButton").hide();
106                }
107            }
108        });
109
110        verifyTokenPromise.catch(function (value) {});
111    }
112
113    setTimeout(fetchbranchData, 1000);
114
115    $(document).on("click touchend", ".secNavDataAnaList a", function (e) {
116        $(".secNavDataAnaList a").removeClass("active");
117        //      $(".secNavDataAnaList a").css("color", "#ffffff");
118        $(this).addClass("active");
119        localStorage.setItem("navName", $(this).text());
120        //     $(this).css("color", "#da291c");
121    });
122
123    $("#campaignBtn").click(function () {
124        $(this).css("background", "grey");
125        $("#campaign-form-open").show();
126    });
127    $(".icon-close").click(function () {
128        $("#campaignBtn").css("background", "#da291c");
129    });
130
131    //carousel motorcycles
132    // $(".carousel-content-sh").each(function () {
133    //     if (!$(this).hasClass("slick-slider")) {
134    //         var id = $(this).parent().attr("data-id");
135    //         var sub_head = "secondary-navigation-" + id;
136    //         var sub_car = "secondary-navigation-carousel-" + id;
137    //         $("#" + sub_car + " .carousel-content-sh").slick({
138    //             slidesToShow: 1,
139    //             slidesToScroll: 1,
140    //             arrows: false,
141    //             fade: false,
142    //             infinite: true,
143    //             speed: 200,
144    //             touchThreshold: 15,
145    //             asNavFor: "#" + sub_head + " .carousel-thumb-sh",
146    //             responsive: [
147    //                 {
148    //                     breakpoint: 767,
149    //                     settings: {
150    //                         infinite: false,
151    //                         speed: 200,
152    //                     },
153    //                 },
154    //             ],
155    //         });
156
157    //         var carousel_thumb_sh = $("#" + sub_head + " .carousel-thumb-sh");
158    //         if ($(window).width() > 767) {
159    //             carousel_thumb_sh.slick({
160    //                 slidesToShow: 7,
161    //                 slidesToScroll: 1,
162    //                 asNavFor: "#" + sub_car + " .carousel-content-sh",
163    //                 dots: true,
164    //                 centerMode: false,
165    //                 arrows: false,
166    //                 focusOnSelect: true,
167    //                 speed: 600,
168    //                 touchThreshold: 15,
169    //                 variableWidth: true,
170    //                 infinite: false,
171    //             });
172    //         } else {
173    //             if ($("#" + sub_head + " .carousel-thumb-sh .c-item").length == 1) {
174    //                 carousel_thumb_sh.slick({
175    //                     slidesToShow: 1,
176    //                     slidesToScroll: 1,
177    //                     variableWidth: true,
178    //                     arrows: false,
179    //                     infinite: false,
180    //                     focusOnSelect: true,
181    //                     asNavFor: "#" + sub_car + " .carousel-content-sh",
182    //                 });
183    //             } else if ($("#" + sub_head + " .carousel-thumb-sh .c-item").length == 2) {
184    //                 carousel_thumb_sh.slick({
185    //                     slidesToShow: 2,
186    //                     slidesToScroll: 1,
187    //                     variableWidth: true,
188    //                     arrows: false,
189    //                     infinite: false,
190    //                     focusOnSelect: true,
191    //                     asNavFor: "#" + sub_car + " .carousel-content-sh",
192    //                 });
193    //             } else {
194    //                 carousel_thumb_sh.slick({
195    //                     slidesToShow: 1,
196    //                     slidesToScroll: 1,
197    //                     variableWidth: true,
198    //                     speed: 200,
199    //                     touchThreshold: 15,
200    //                     infinite: false,
201    //                     arrows: false,
202    //                     focusOnSelect: true,
203    //                     asNavFor: "#" + sub_car + " .carousel-content-sh",
204    //                 });
205    //             }
206    //         }
207
208    //         if ($(window).width() > 767) {
209    //             carousel_thumb_sh.on('wheel', (function(e) {
210    //                 // console.log(e);
211
212    //                 if(e.currentTarget.slick.slideCount > 8){
213    //                     if (e.originalEvent.deltaY < 0) {
214    //                         if(e.currentTarget.slick.currentSlide > 0){
215    //                             e.preventDefault();
216    //                             e.currentTarget.slick.slickPrev();
217    //                         }
218    //                     } else {
219    //                         if(e.currentTarget.slick.currentSlide < (e.currentTarget.slick.slideCount - 1)){
220    //                             let lastCount = e.currentTarget.slick.slideCount - 1;
221    //                             // console.log(e.currentTarget.slick.$slides[lastCount]);
222    //                             if(!(e.currentTarget.slick.$slides[lastCount].classList.contains("slick-active"))){
223    //                                 e.preventDefault();
224    //                                 e.currentTarget.slick.slickNext();
225    //                             }
226    //                         }
227    //                     }
228    //                 }
229    //             }));
230    //         }
231    //     }
232
233    // });
234
235    $(".carousel-content-sh").slick({
236        slidesToShow: 1,
237        slidesToScroll: 1,
238        arrows: false,
239        fade: false,
240        infinite: true,
241        speed: 200,
242        touchThreshold: 15,
243        // asNavFor: "#" + sub_head + " .carousel-thumb-sh",
244        responsive: [
245            {
246                breakpoint: 767,
247                settings: {
248                    infinite: false,
249                    speed: 200,
250                },
251            },
252        ],
253    });
254
255    $(".carousel-thumb-sh").each(function () {
256        var lastXPos = 0;
257        var count = 0;
258        var lastDataCount = 1;
259        var xFirstChild = $(this)[0].firstElementChild.getBoundingClientRect().left;
260        console.log(xFirstChild);
261        $(this)
262            .children(".c-item")
263            .on("click", function () {
264                $(this).parent(".carousel-thumb-sh").children(".c-item").removeClass("active");
265                // $(this).parent(".carousel-thumb-sh").scrollLeft( 100 );
266                //   $(this)[0].scrollIntoView({ behavior: "smooth", inline: "nearest" })
267                var curDataCount = parseInt($(this).attr("data-nav-count"));
268                var xCurChild = $(this)[0].getBoundingClientRect().left;
269                console.log(xCurChild + "cur pos");
270                var xLastChild;
271                if (count > 0) {
272                    if (lastDataCount > curDataCount) {
273                        xLastChild = xFirstChild + (curDataCount - 1) * 2;
274                        $(this)
275                            .parent(".carousel-thumb-sh")
276                            .animate({
277                                scrollLeft: "-=" + xLastChild + "px",
278                            });
279                    } else {
280                        xLastChild = xFirstChild + (curDataCount - 1) * 5;
281                        $(this)
282                            .parent(".carousel-thumb-sh")
283                            .animate({
284                                scrollLeft: "+=" + xLastChild + "px",
285                            });
286                    }
287                } else {
288                    xLastChild = xFirstChild + (curDataCount - 1) * 5;
289                    $(this)
290                        .parent(".carousel-thumb-sh")
291                        .animate({
292                            scrollLeft: "+=" + xLastChild + "px",
293                        });
294                }
295                lastDataCount = curDataCount;
296                count++;
297                console.log(xLastChild);
298                console.log(curDataCount);
299
300                $(this).addClass("active");
301                var navItemCount = parseInt($(this).attr("data-nav-count"));
302                navItemCount = navItemCount - 1;
303                console.log(navItemCount);
304                console.log($(this).closest(".follow-sticky-wrap").next(".secondary-navigation-carousel").find(".carousel-content-sh"));
305                $(this).closest(".follow-sticky-wrap").next(".secondary-navigation-carousel").find(".carousel-content-sh").slick("slickGoTo", navItemCount);
306            });
307    });
308
309    $(".carousel-thumb-sh").each(function () {
310        $(this).children(".c-item:first-child").addClass("active");
311    });
312
313    let tabTarget, tabTargetNav, activePane, activeLink, tabId, navLinkId;
314    $(document).on("click", ".secondary-sticky-nav .secNavDataAna", function () {
315        tabTarget = $(this).attr("data-tab-target");
316        $(".tours-filter-content .tab-pane").each(function () {
317            tabId = $(this).attr("id");
318            activePane = $(this);
319            if (tabTarget == tabId) {
320                $(".tours-filter-content .tab-pane").removeClass("active show");
321                activePane.addClass("active show");
322            }
323        });
324    });
325
326    $(document).on("click", ".secondary-sticky-nav .secNavDataAna", function () {
327        // $(".secondary-sticky-nav .secNavDataAna").on("click", function(){
328        tabTargetNav = $(this).attr("data-tab-target");
329        tabTargetNav = "#" + tabTargetNav;
330        $(".tours-filter-tabs .nav-link").each(function () {
331            navLinkId = $(this).attr("href");
332            activeLink = $(this);
333            if (tabTargetNav == navLinkId) {
334                $(".tours-filter-tabs .nav-link").removeClass("active show");
335                activeLink.addClass("active show");
336            }
337        });
338    });
339
340    let navName = localStorage.getItem("navName");
341    if (!navName) {
342        navName = "";
343    }
344
345    $(".secNavDataAnaList a").each(function () {
346        if (navName) {
347            $(this).removeClass("active");
348            if ($(this).text() == navName) {
349                $(this).addClass("active");
350                $(this).trigger("click");
351            }
352        }
353    });
354
355    localStorage.removeItem("navName");
356});
357
358function fetchbranchData() {
359    if (collectionData) {
360        collectionData.doc("riderPortalMembership").onSnapshot(function (doc) {
361            let realtimeChange = {};
362            realtimeChange = doc.data();
363            if (realtimeChange) {
364                let branchLink = $(".dynamicUrl").attr("data-url");
365                if (branchLink.includes("/content/royal-enfield")) {
366                    branchLink = branchLink.replace("/content/royal-enfield", "");
367                }
368                if (branchLink && realtimeChange.branch && realtimeChange.moderationStatus != "REJECTED") {
369                    $(".dynamicUrl").attr("href", branchLink + "?branchId=" + realtimeChange.branch._id + "&register=true");
370                } else if (branchLink && realtimeChange.moderationStatus == "REJECTED") {
371                    $(".dynamicUrl").attr("href", branchLink + "?register=false");
372                } else {
373                    $(".dynamicUrl").attr("href", "javaScript:void(0)");
374                }
375            }
376        });
377    }
378}
379
380$(document).on("click", ".toggleCta", function () {
381    $("body").toggleClass("login_show");
382    $(".nav-hamburger").removeClass("is-active");
383    $(".nav-primary").removeClass("np-open");
384
385    //Remove Sticky Links
386    $(".sticky-links-box").removeClass("open sl-head-show");
387
388    //Close Nav Dropdown
389    $(".nav-primary .has-children").removeClass("active");
390    $(".nav-primary .has-children").siblings().find(".nav-secondary").removeClass("nav-dropdown");
391
392    //Close Nav Dropdown for Mobile
393    $(".nav-hamburger").removeClass("is-active");
394    $(".nav-primary").removeClass("np-open");
395    $("body").removeClass("body-scroll-stop");
396
397    //Language dropdown close
398    $("body").removeClass("language-open");
399
400    //Close Secondary Nav
401    $("body").removeClass("secondary-sticky-nav-open");
402});
403
404function fetchbranchData() {
405    if (collectionData) {
406        collectionData.doc("riderPortalMembership").onSnapshot(function (doc) {
407            let realtimeChange = {};
408            realtimeChange = doc.data();
409            if (realtimeChange) {
410                let branchLink = $(".dynamicUrl").attr("data-url");
411                if (branchLink) {
412                    if (branchLink.includes("/content/royal-enfield")) {
413                        branchLink = branchLink.replace("/content/royal-enfield", "");
414                    }
415                    if (branchLink && realtimeChange.branch && realtimeChange.moderationStatus != "REJECTED") {
416                        $(".dynamicUrl").attr("href", branchLink + "?branchId=" + realtimeChange.branch._id + "&register=true");
417                    } else if (branchLink && realtimeChange.moderationStatus == "REJECTED") {
418                        $(".dynamicUrl").attr("href", branchLink + "?register=false");
419                    }
420                } else {
421                    $(".dynamicUrl").attr("href", "javaScript:void(0)");
422                }
423            }
424        });
425    }
426}
427
428$("#overlay-btn").click(function () {
429    $(".overlay-form").toggle();
430});
431

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.