PageSourceSearch

https://www.mahindrasupromaxitruck.com/js/custom.js?v=2

js mahindrasupromaxitruck.com collected 2026-10-06 19:58:40 UTC 10,431 bytes, 296 lines download raw bytes

1// JavaScript Document
2$(document).ready(function () {
3    selectBox();
4
5
6    //URL hardcoding starts
7    var parameters;
8    parameters = getQueryParams(document.location.search);
9    //console.log(parameters)
10
11    // WRITE INCOMING PARAMETERS TO A COOKIE
12    var queryString = 'siteid=' + parameters.siteid + '&utm_medium=' + parameters.utm_medium + '&utm_source=' + parameters.utm_source + '&utm_content=' + parameters.utm_content + '&utm_campaign=' + parameters.utm_campaign;
13    //var queryString = 'siteid=' + parameters.siteid + '&param2=' + parameters.param2;
14    //console.log(queryString);
15
16    $("a").each(function (a, b) {
17        if (!$(this).hasClass("noga")) {
18            var href = $(this).attr('href');
19            if (typeof parameters.utm_medium != "undefined" || typeof parameters.utm_source != "undefined" || typeof parameters.utm_content != "undefined" || typeof parameters.utm_campaign != "undefined") {
20                var r = /#([^\/\?]*)/
21                var h = r.exec(href);
22                //console.log(h);
23                if (h) {
24                    //var chref = window.location.href.split('#')[0];
25                    var re = '/#\S+\s*/';
26                    //$result = preg_replace($re, '', href);
27                    // $result = preg_replace($re, '', href);
28                    // href.replace(/#\S+\s*/g, '');
29                    var regexp = /\#\w\w+\s?/g
30                    href = href.replace(regexp, '');
31                    //console.log("A", href);
32                    href += (href.match(/\?/) ? '&' : '?') + queryString + h[0];
33                    //console.log(href);
34                    // alert(href);
35                } else if (href != undefined) {
36                    //console.log('E: ' + href);
37                    //alert(href);
38                    href += (href.match(/\?/) ? '&' : '?') + queryString;
39                }
40                // href += (href.match(/\?/) ? '&' : '?') + queryString;
41                //alert(href);
42                //e.preventDefault();
43            }
44            $(this).attr('href', href);
45        }
46    });
47
48    function getQueryParams(qs) {
49        qs = qs.split('+').join(' ');
50
51        var params = {},
52            tokens,
53            re = /[?&]?([^=]+)=([^&]*)/g;
54
55        while (tokens = re.exec(qs)) {
56            params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
57        }
58
59        return params;
60    }
61
62    //URL hardcoding ends
63
64
65    if ($(window).width() > 992) {
66        $(window).scroll(function () {
67            if ($(window).scrollTop() > 34) {
68                $('header').addClass('small');
69            }
70            else {
71                $('header').removeClass('small');
72            }
73        });
74    }
75    //
76    $('a.mobilemenu').click(function () {
77        $(this).parents('.wrapper').find('.side_navigation_wrapper').animate({ 'right': '0' });
78        $('body').toggleClass('noscroll');
79        return false;
80    });
81    $('a.menu_close_but').click(function () {
82        $(this).parents('.wrapper').find('.side_navigation_wrapper').animate({ 'right': '-100%' });
83        $('body').toggleClass('noscroll');
84        return false;
85    });
86    // accordian
87    function hidden(a) {
88        $(a).removeClass('selected');
89        $(a).parent().find('ul:first').slideUp();
90    }
91    function visible(b) {
92        $(b).parent().siblings().find('a').removeClass('selected');
93        $(b).parent().parent().find('li ul:visible').slideUp();
94        $(b).addClass('selected');
95        $(b).parent().find('ul:first').slideDown();
96    }
97    function check(c) {
98        if ($(c).parent().find('ul:first').is(':hidden')) {
99            visible(c);
100        } else {
101            hidden(c);
102        }
103    }
104    $(function () {
105        $(".firstpane li:has(ul) > a").click(function () {
106            check($(this));
107            return false;
108        });
109    });
110    //
111    $('.footer_links li a.sitemap').click(function () {
112        $('html, body').animate({ scrollTop: $(document).height() }, 400);
113        $(this).parents('footer').find('.sitemap_wrapper').slideToggle(100);
114        if ($(this).find('span').text() == '+') {
115            $(this).find('span').text('-');
116        } else {
117            $(this).find('span').text('+');
118        }
119        return false;
120    });
121    //
122    $('.home_ft_links p a.home_sitemap').click(function () {
123        $(this).parents('.home_ft_links').find('.sitemap_wrapper').slideToggle();
124        if ($(this).find('span').text() == '+') {
125            $(this).find('span').text('-');
126        } else {
127            $(this).find('span').text('+');
128        }
129        return false;
130    });
131    //
132    $('.scroll_bottom_btn > a').bind('click', function () {
133        showTopBottomArrow();
134        var scrollOffset = $(window).scrollTop() + $(window).height() - 70 - $('.footer_fixed').height();
135        $('html, body').stop(true, false);
136        $('html, body').animate({ 'scrollTop': scrollOffset }, { duration: "slow" });
137        return false;
138    });
139    $(window).scroll(function () {
140        showTopBottomArrow();
141    });
142    function showTopBottomArrow() {
143        var footerHeight = $('footer').height();
144        var totalHeight = $(document).height() - $(window).height();
145        var scrTop = $(window).scrollTop();
146        var a = parseInt(totalHeight) - parseInt(footerHeight);
147        //console.log('totalHeight - footerHeight : '+ a +', scrTop : '+scrTop)
148        if (scrTop >= totalHeight - footerHeight) {
149            $('.scroll_top_btn').fadeIn();
150            $('.scroll_bottom_btn').fadeOut();
151        } else {
152            $('.scroll_top_btn').fadeOut();
153            $('.scroll_bottom_btn').fadeIn();
154        }
155    }
156    $('.scroll_top_btn a').click(function () {
157        $('html, body').animate({ scrollTop: '0px' }, 1000);
158        return false;
159    });
160    //
161    $('.selectbox').uniform();
162    $('.scroll-pane').jScrollPane();
163    //
164    $(".readmore").click(function () {
165        $(this).hide();
166        $(".readless").show();
167        $(".agree").toggleClass('agreefull');
168    });
169    $(".readless").click(function () {
170        $(this).hide();
171        $(".readmore").show();
172        $(".agree").toggleClass('agreefull');
173    });
174    //
175    $('.whatnew_list li').hover(function () {
176        $('.whatnew_list li').css({ 'width': '15%' });
177        $(this).css({ 'width': '40%' });
178    }, function () {
179        $('.whatnew_list li').css({ 'width': '20%' });
180    });
181    //
182    $('.framebox').fancybox({
183        'width': 1000,
184        'type': 'iframe'
185    });
186    // fancybox
187    $('.fancybox').fancybox({
188        openEffect: 'fade',
189        closeEffect: 'fade',
190        prevEffect: 'elastic',
191        nextEffect: 'elastic',
192        helpers: {
193            title: {
194                type: 'outside',
195                position: 'top'
196            }
197        }
198    });
199    // tab
200    $(".tabdetails").hide(); //Hide all content
201    $(".tab_thumb ul li:first").each(function () {
202        $(this).addClass("active").show();
203    }); //Activate first tab
204    $('.tab_section').find(".tabdetails:first").show(); //Show first tab content
205    //On Click Event
206    $(".tab_thumb ul li").click(function () {
207        var indx = $(this).index();
208        $(this).siblings("li").removeClass("active"); //Remove any "active" class
209        $(this).addClass("active"); //Add "active" class to selected tab
210        var cntr = 0;
211        $(this).parents('.tab_section').find(".tabdetails").hide();
212        $(this).parents('.tab_section').find(".tabdetails").each(function () {
213            if (indx == cntr) {
214                $(this).fadeIn();
215            }
216            cntr++;
217        });
218        return false;
219    });
220    // animate page after page load
221    setTimeout(function () {
222        var data_id = (window.location.href).split('?id=');
223        //console.log(data_id);
224        if (data_id.length > 1) {
225            data_id = data_id[1].split('&');
226            var scrolltop = $(document).find('#' + data_id[0]).offset().top - 38;
227            $('html, body').animate({ scrollTop: scrolltop }, 400)
228        }
229    }, 400);
230    //
231    $('.tab_dropdown .selectbox').click(function () {
232        $(this).parents('.tab_dropdown').find('.options').toggle();
233    });
234    $('.options li a').click(function () {
235        $(this).parents('.tab_dropdown').find('.selectbox').text("");
236        if ($('.selItem').length == 1) {
237            $('.selItem').remove();
238        }
239        $(this).parents('.tab_dropdown').find('.selectbox').after('<span class="selItem selectbox2">' + $(this).text() + '</span>');
240        $(this).parents('.tab_dropdown').find('.options').toggle();
241    });
242    //
243    $('.address a').click(function () {
244        $('body').append('<div class="overlay"></div>');
245        $('.locator_popup').show();
246        return false;
247    });
248    $('.locator_popup .close_popup').click(function () {
249        $('.overlay').remove();
250        $('.locator_popup').hide();
251        return false;
252    });
253
254    // tab
255    $(".newTabDetails").hide(); //Hide all content
256    $(".newTabs a:first").each(function () {
257        $(this).addClass("active").show();
258    }); //Activate first tab
259    $('.newTabsBox').find(".newTabDetails:first").show(); //Show first tab content
260    //On Click Event
261    $(".newTabs a").click(function () {
262        var indx = $(this).index();
263        $(this).siblings("a").removeClass("active"); //Remove any "active" class
264        $(this).addClass("active"); //Add "active" class to selected tab
265        var cntr = 0;
266        $(this).parents('.newTabsBox').find(".newTabDetails").hide();
267        $(this).parents('.newTabsBox').find(".newTabDetails").each(function () {
268            if (indx == cntr) {
269                $(this).show();
270            }
271            cntr++;
272        });
273
274        return false;
275    });
276
277
278
279
280
281
282});
283
284function selectBox() {
285    $(".selectStyle select").each(function () {
286
287        $(this).children("option").each(function () {
288            if ($(this).attr("selected")) {
289                $(this).parent(".box").html($(this).html());
290            }
291        });
292    });
293    $(".selectStyle select").bind('change', function () {
294        $(this).prev().html($(this).val());
295    });
296}

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.