PageSourceSearch

https://primamf.com/app/modules/website/assets/js/main.js

js primamf.com collected 2026-10-02 01:40:02 UTC 13,290 bytes, 446 lines download raw bytes

1jQuery(function ($) {
2
3    'use strict';
4
5    // Preloader
6
7    // -------------------------------------------------------------
8    //  Preloader
9    // -------------------------------------------------------------
10
11    $(window).on("load", function(){
12        $('#preloader').fadeOut('slow',function(){$(this).remove();});
13    });
14
15    // -------------------------------------------------------------
16    //  Toggle Menu for Mobile
17    // -------------------------------------------------------------
18
19    mobileDropdown ();
20    function mobileDropdown () {
21      if($('.navbar-nav').length) {
22        // Add chevron icons for mobile toggle
23        $('.navbar-nav .sa-dropdown').each(function() {
24          if (!$(this).find('> i.icon').length) {
25            $(this).append('<i class="fas fa-chevron-down icon"></i>');
26          }
27        });
28
29        // On mobile: click on parent link or icon toggles submenu
30        $('.navbar-nav .sa-dropdown > a').on('click', function (e) {
31          if ($(window).width() < 992) {
32            e.preventDefault();
33            var $parent = $(this).parent('li, .sa-dropdown');
34            $parent.children('ul, .sa-dropdown-menu, .mega-dropdown-menu').slideToggle(200);
35            $parent.toggleClass('open');
36            // Close other open dropdowns
37            $parent.siblings('.sa-dropdown.open').removeClass('open')
38              .children('ul, .sa-dropdown-menu, .mega-dropdown-menu').slideUp(200);
39          }
40        });
41
42        // Icon click also toggles
43        $('.navbar-nav .sa-dropdown > .icon').on('click', function (e) {
44          e.preventDefault();
45          e.stopPropagation();
46          var $parent = $(this).parent('li, .sa-dropdown');
47          $parent.children('ul, .sa-dropdown-menu, .mega-dropdown-menu').slideToggle(200);
48          $parent.toggleClass('open');
49        });
50      }
51    }   
52
53    // -------------------------------------------------------------
54    // News Slider
55    // -------------------------------------------------------------
56
57    var ticker = $('#ticker'),
58        container = ticker.find('ul'),
59        tickWidth = 1,
60        speed = 0.1, 
61        distance,
62        timing;
63
64        container.find("li").each(function(i) {
65        tickWidth += $(this, i).outerWidth(true);
66        });
67
68        distance = tickWidth + (ticker.outerWidth() - $('#gameLabel').outerWidth());
69        timing = distance / speed;
70
71        function scrollIt(dist, dur) {
72        container.animate({
73          left: '-=' + dist
74        }, dur, 'linear', function() {
75          container.css({
76            'left': ticker.outerWidth()
77          });
78          scrollIt(distance, timing);
79        });
80        }
81
82        scrollIt(distance, timing);
83
84        ticker.hover(function() {
85        container.stop();
86        }, function() {
87        var offset = container.offset(),
88          newPosition = offset.left + tickWidth,
89          newTime = newPosition / speed;
90        scrollIt(newPosition, newTime);
91    });       
92
93    /*==============================================================*/
94    // TheiaStickySidebar
95    /*==============================================================*/
96
97    $('.sa-sticky')
98        .theiaStickySidebar({
99            additionalMarginTop: 0
100    });
101
102    // -------------------------------------------------------------
103    //  MagnificPopup
104    // -------------------------------------------------------------
105
106    $('.sa-popup').magnificPopup({type:'iframe'});        
107
108    // -------------------------------------------------------------
109    //  Slick Slider
110    // -------------------------------------------------------------  
111
112    $(".news-ticker").slick({
113        infinite: true,
114        dots: false,
115        arrows: true,
116        slidesToShow: 1,
117        autoplay:true,
118        autoplaySpeed: 1000, 
119        speed: 1000,
120        fade:true,
121        pauseOnHover:true,
122        slidesToScroll: 1,
123        nextArrow: '<i class="fa fa-angle-left" aria-hidden="true"></i>',
124        prevArrow: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
125    });     
126
127    $(".post-slider").slick({
128        infinite: true,
129        dots: false,
130        arrows: true,
131        slidesToShow: 1,
132        autoplay:true,
133        autoplaySpeed:10000,
134        slidesToScroll: 1,
135        nextArrow: '<i class="fa fa-angle-left" aria-hidden="true"></i>',
136        prevArrow: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
137    });    
138
139    $('.home-slider').slick({
140        slidesToShow: 1,
141        slidesToScroll: 1,
142        arrows: true,
143        dots: false,
144        speed: 1500,
145        autoplay:true,
146        nextArrow: '<i class="fa fa-angle-left" aria-hidden="true"></i>',
147        prevArrow: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
148        asNavFor: '.home-slider-nav'
149    });
150    
151    $('.home-slider-nav').slick({
152        slidesToShow: 4,
153        slidesToScroll: 1,
154        asNavFor: '.home-slider',
155        dots: false,
156        speed: 1500,
157        arrows: false,
158        focusOnSelect: true,
159        responsive: [
160        {
161          breakpoint: 1200,
162          settings: {
163            slidesToShow:4,
164          }
165        },
166        {
167          breakpoint: 992,
168          settings: {
169            slidesToShow: 3,
170          }
171        },
172        {
173          breakpoint: 768,
174          settings: {
175            slidesToShow: 2,
176          }
177        },
178        {
179          breakpoint: 481,
180          settings: {
181            slidesToShow: 1,
182          }
183        }
184        ] 
185    });
186
187    $(".breaking-news-slider").slick({
188        infinite: true,
189        dots: false,
190        arrows: true,
191        slidesToShow: 3,
192        autoplay:true,
193        slidesToScroll: 1,
194        swipe: false,
195        vertical: true,
196        verticalScrolling: true,        
197        nextArrow: '<i class="fa fa-angle-left" aria-hidden="true"></i>',
198        prevArrow: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
199        responsive: [
200        {
201          breakpoint: 1200,
202          settings: {
203            slidesToShow:2,
204          }
205        },
206        {
207          breakpoint: 992,
208          settings: {
209            slidesToShow: 2,
210          }
211        },
212        {
213          breakpoint: 768,
214          settings: {
215            slidesToShow: 2,
216          }
217        },
218        {
219          breakpoint: 481,
220          settings: {
221            slidesToShow: 1,
222          }
223        }
224        ] 
225    }); 
226
227    $(".latest-slider").slick({
228        infinite: true,
229        dots: true,
230        arrows: false,
231        slidesToShow: 3,
232        autoplay:true,
233        autoplaySpeed:10000,
234        slidesToScroll: 1,
235        nextArrow: '<i class="fa fa-angle-left" aria-hidden="true"></i>',
236        prevArrow: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
237        responsive: [
238        {
239          breakpoint: 992,
240          settings: {
241            slidesToShow: 2,
242          }
243        },
244        {
245          breakpoint: 768,
246          settings: {
247            slidesToShow: 2,
248          }
249        },
250        {
251          breakpoint: 481,
252          settings: {
253            slidesToShow: 1,
254          }
255        }
256        ] 
257    });  
258
259    $('.gallery-slider').slick({
260        infinite: true,
261        dots: true,
262        arrows: false,
263        slidesToShow: 1,
264        autoplay:true,
265        autoplaySpeed:10000,
266        slidesToScroll: 1,
267        nextArrow: '<i class="fa fa-angle-left" aria-hidden="true"></i>',
268        prevArrow: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
269        asNavFor: '.gallery-slider-nav'
270    });
271    
272    $('.gallery-slider-nav').slick({
273        slidesToShow: 6,
274        slidesToScroll: 1,
275        asNavFor: '.gallery-slider',
276        dots: false,
277        speed: 1500,
278        arrows: false,
279        focusOnSelect: true,
280        nextArrow: '<i class="fa fa-angle-right" aria-hidden="true"></i>',
281        prevArrow: '<i class="fa fa-angle-left" aria-hidden="true"></i>',
282        responsive: [
283        {
284          breakpoint: 1200,
285          settings: {
286            slidesToShow:4,
287          }
288        },
289        {
290          breakpoint: 992,
291          settings: {
292            slidesToShow: 3,
293          }
294        },
295        {
296          breakpoint: 768,
297          settings: {
298            slidesToShow: 3,
299          }
300        },
301        {
302          breakpoint: 481,
303          settings: {
304            slidesToShow: 2,
305          }
306        }
307        ] 
308    });    
309        
310    // -------------------------------------------------------------
311    //  Date Time
312    // -------------------------------------------------------------
313
314    var monthNames = [ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "
314November", "December" ]; 
315    var dayNames= ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
316    var newDate = new Date();
317    newDate.setDate(newDate.getDate());
318    $('#date_time').html(dayNames[newDate.getDay()] + " " + newDate.getDate() + ' ' + monthNames[newDate.getMonth()] + ' ' + newDate.getFullYear());
319
320
321    /*==============================================================*/
322    // Select
323    /*==============================================================*/    
324
325    $('.sa-language select').each(function(){
326        var $this = $(this), numberOfOptions = $(this).children('option').length;
327      
328        $this.addClass('select-hidden'); 
329        $this.wrap('<div class="select"></div>');
330        $this.after('<div class="select-styled"></div>');
331
332        var $styledSelect = $this.next('div.select-styled');
333        $styledSelect.text($this.children('option').eq(0).text());
334      
335        var $list = $('<ul />', {
336            'class': 'select-options'
337        }).insertAfter($styledSelect);
338      
339        for (var i = 0; i < numberOfOptions; i++) {
340            $('<li />', {
341                text: $this.children('option').eq(i).text(),
342                rel: $this.children('option').eq(i).val()
343            }).appendTo($list);
344        }
345      
346        var $listItems = $list.children('li');
347      
348        $styledSelect.click(function(e) {
349            e.stopPropagation();
350            $('div.select-styled.active').not(this).each(function(){
351                $(this).removeClass('active').next('ul.select-options').hide();
352            });
353            $(this).toggleClass('active').next('ul.select-options').toggle();
354        });
355      
356        $listItems.click(function(e) {
357            e.stopPropagation();
358            $styledSelect.text($(this).text()).removeClass('active');
359            $this.val($(this).attr('rel'));
360            $list.hide();
361        });
362      
363        $(document).click(function() {
364            $styledSelect.removeClass('active');
365            $list.hide();
366        });
367
368    });    
369
370    /*==============================================================*/
371    // Send Email
372    /*==============================================================*/ 
373
374    $('#contactform').submit(function (e) {
375        $('.flashinfo').hide();
376        e.preventDefault();
377    })
378    .validate({
379        rules: {
380            email: {
381                required: true,
382                email: true
383            },
384            phoneNumber: {
385                digits: true,
386                required: true,
387                minlength: 5,
388                maxlength: 12
389            },
390            name: {
391                required: true,
392                minlength: 5
393            },
394            subject: {
395                required: true,
396                minlength: 10
397            },
398            message: {
399                required: true,
400                minlength: 10
401            }
402        },
403        messages: {
404            email: {
405                required: 'Check your email input '
406            },
407            name: {
408                required: 'Please check your first name input'
409            },
410            subject: {
411                required: 'Please check your message subject input'
412            },
413            message: {
414                required: 'Please write something for us'
415            }
416        },
417        submitHandler: function (form) {
418            $.ajax({
419                type: "POST",
420                url: "https://mailpostexample.herokuapp.com/",
421                data: $(form).serialize(),
422                beforeSend: function () {
423                    $('.flashinfo').hide();
424                    $('.btn-l').html('Sending...')
425                    $('input, textarea').attr('readonly', "readonly");
426                },
427                success: function (msg) {
428                    if (msg == 'your message send') {
429                        $('#contactform').trigger("reset");
430                        $('.btn-l').html('Send Now')
431                        $('input, textarea').removeAttr('readonly');
432                        $('.flashinfo').show();
433                        $('.flashinfo').html('Your message has been sent, I will reply to you shortly');
434                    } else {
435                        $('input, textarea').removeAttr('readonly');
436                        $('#contactform').trigger("reset");
437                        $('.flashinfo').show();
438                        $('.flashinfo').html('<span>report_problem</span>something unknown error');
439                    }
440                }
441            });
442            return false;
443        }
444    });
445// script end
446});

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.