PageSourceSearch

https://tofas.com.tr/_catalogs/masterpage/scripts/timeline-slider.js

js tofas.com.tr collected 2026-09-24 19:35:30 UTC 6,576 bytes, 173 lines download raw bytes

1'use strict';
2
3Gri.module({
4  name: 'timeline-slider',
5  ieVersion: null,
6  $el: $('.timeline-slider'),
7  container: '.timeline-slider',
8  fn: function fn() {
9    tofas.timelineSlider = {
10      el: $('.timeline-slider'),
11      content: $('.timeline-slider .slider-content'),
12      itemTag: $('.timeline-slider .slider-content .item'),
13      timelineTag: $('.timeline-slider .slider-timeline .timeline-content span'),
14      timelineBar: $('.timeline-slider .slider-timeline .timeline-content .timeline-bar'),
15      init: function init() {
16        tofas.timelineSlider.slider();
17        tofas.timelineSlider.fancyboxInit();
18        //tofas.timelineSlider.button();
19        tofas.timelineSlider.timeline.init();
20        tofas.timelineSlider.detailButton();
21        //tofas.timelineSlider.video.init();
22        $(window).on('resize', function () {
23          tofas.timelineSlider.overscrollReset();
24        });
25      },
26      overscroll: function overscroll() {
27        if (window.matchMedia('(min-width: 991px)').matches) {
28          $('[data-custom-scroll]').each(function () {
29            $(this).overscroll({
30              direction: 'horizontal',
31              ignoreSizing: true
32            }).on('overscroll:dragstart', function () {
33              console.log('Drag started!');
34            });
35          });
36        }
37      },
38      overscrollReset: function overscrollReset() {
39        $('[data-custom-scroll]').each(function () {
40          $(this).removeOverscroll();
41        });
42        tofas.timelineSlider.overscroll();
43      },
44      slider: function slider() {
45        tofas.timelineSlider.content.on('init', function (event, slick) {
46          tofas.timelineSlider.overscroll();
47        });
48
49        tofas.timelineSlider.content.slick({
50          autoplay: false,
51          autoplaySpeed: 10000,
52          speed: 600,
53          slidesToShow: 1,
54          draggable: false,
55          slidesToScroll: 1,
56          pauseOnHover: false,
57          arrows: true,
58          fade: false,
59          dots: false,
60          adaptiveHeight: false,
61          infinite: false,
62          prevArrow: '<button type="button" class="slick-prev"></button>',
63          nextArrow: '<button type="button" class="slick-next"></button>',
64          responsive: [{
65            breakpoint: 992,
66            settings: {
67              adaptiveHeight: true
68            }
69          }]
70        });
71        tofas.timelineSlider.content.on('beforeChange', function (event, slick, currentSlide, nextSlide) {
72          tofas.timelineSlider.timeline.change(nextSlide);
73          tofas.timelineSlider.timeline.active(nextSlide);
74          //tofas.timelineSlider.fancyboxInit();
75        });
76      },
77      button: function button() {
78        $('[data-video-scroll]').on('click', function () {
79          $('html, body').animate({ scrollTop: $('[data-video-content]').offset().top - $('.header-alpha').height() }, 500);
80        });
81      },
82      timeline: {
83        init: function init() {
84          tofas.timelineSlider.timeline.breakpoint();
85          tofas.timelineSlider.timeline.firstpoint();
86          tofas.timelineSlider.timeline.goTo();
87        },
88        count: function count() {
89          var item = tofas.timelineSlider.content.find('.item').length + 1;
90          return item;
91        },
92        change: function change(activeSlide) {
93          var calc = 100 / tofas.timelineSlider.timeline.count() * (activeSlide + 1);
94          tofas.timelineSlider.timelineBar.css({ "width": calc + "%" });
95        },
96        active: function active(activeSlide) {
97          var i = 0;
98          tofas.timelineSlider.timelineTag.removeClass('active');
99          tofas.timelineSlider.timelineTag.eq(activeSlide).addClass('active');
100          $.each(tofas.timelineSlider.timelineTag, function () {
101            if (activeSlide > i) {
102              tofas.timelineSlider.timelineTag.eq(i).addClass('select');
103            } else {
104              tofas.timelineSlider.timelineTag.eq(i).removeClass('select');
105            }
106            i++;
107          });
108        },
109        firstpoint: function firstpoint() {
110          var firstElement = 100 / tofas.timelineSlider.timeline.count();
111          tofas.timelineSlider.timelineBar.css({ "width": firstElement + "%" });
112          tofas.timelineSlider.timelineTag.first().addClass('active');
113        },
114        breakpoint: function breakpoint() {
115          var calc = 100 / tofas.timelineSlider.timeline.count();
116          var i = 1;
117          $.each(tofas.timelineSlider.timelineTag, function () {
118            $(this).css({ "left": calc * i + "%" });
119            i++;
120          });
121        },
122        goTo: function goTo() {
123          $('span[data-slide]').click(function () {
124            var slide = $(this).data('slide');
125            tofas.timelineSlider.content.slick('slickGoTo', slide);
126          });
127        }
128      },
129      video: {
130        init: function init() {
131          tofas.timelineSlider.video.open();
132          tofas.timelineSlider.video.close();
133        },
134        open: function open() {
135          $('.timeline-slider .play').on('click', function () {
136            var video = $(this).attr("data-video");
137            if (video != "") {
138              $('.timeline-slider .slider-video').addClass('video-opened');
139              $('.timeline-slider .slider-video').append("<video loop autoplay poster='/images/slider-1.png' class='fullscreen'> <source src='/images/video/" + video + ".webm' type='video/webm'><source src='/images/video/" + video + ".mp4' type='video/mp4'></video>");
140            } else {
141              //consle.log("video URL!");
142            }
143          });
144        },
145        close: function close() {
146          $('.timeline-slider .slider-video').on('click', function () {
147            $(this).find('video')[0].pause();
148            $(this).removeClass('video-opened');
149            $(this).html('');
150          });
151        }
152      },
153      fancyboxInit: function fancyboxInit() {
154        console.log("fancy!");
155        if ($('[data-fancybox]').length > 0) {
156          $('[data-fancybox]').fancybox({
157            infobar: false,
158            buttons: false,
159            afterLoad: function afterLoad(instance, current) {
160              if (instance.group.length > 1 && current.$content) {
161                //current.$content.append('<a data-fancybox-next class="button-next" href="javascript:;">→</a><a data-fancybox-previous class="button-previous" href="javascript:;">←</a>');
162              }
163            }
164          });
165        }
166      }
167
168      /**/
169
170    };tofas.timelineSlider.init();
171  }
172});
173//# sourceMappingURL=timeline-slider.js.map

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.