PageSourceSearch

https://www.epias.com.tr/wp-content/themes/www-epias/js/slider.js?ver=7.1.2

js epias.com.tr collected 2026-10-01 11:27:24 UTC 5,982 bytes, 212 lines download raw bytes

1var currentSlide = 0;
2var sliderInterval;
3var sliderIsAnimating = false;
4
5var scheduledSwitch = false;
6
7$(document).ready(function () {
8    inSlide();
9
10    var firstContent = JSON.parse($('.epias-slider-items li').first().attr('data-project'));
11    changeSliderContents($('#epias-slider'), firstContent);
12});
13
14$(document).on('mouseenter', '.haber-top-content', function () {
15    if (sliderInterval) {
16        clearInterval(sliderInterval);
17    }
18});
19
20$(document).on('mouseleave', '.haber-top-content', function () {
21    inSlide();
22});
23
24$(document).on('click', '#epias-slider .haber-top-nav .nav ', function () {
25    moveSlider($(this).hasClass('nav-left') ? -1 : 1);
26});
27
28$(document).on('keydown', function (e) {
29    if (e.keyCode === 37) {
30        moveSlider(-1);
31    }
32
33    if (e.keyCode === 39) {
34        moveSlider(1);
35    }
36});
37
38$(document).on('swipeleft', function (e) {
39    moveSlider(1);
40});
41
42$(document).on('swiperight', function (e) {
43    moveSlider(-1);
44});
45
46$(document).on('mouseenter', '.haber-top-photo-nav > div', function() {
47    $('.haber-top-photo-nav > div').removeClass('active');
48    $(this).addClass('active');
49
50    $('.haber-top-photos > a').addClass('hidden');
51    $('.haber-top-photos > a[data-sld="' + $(this).attr('data-sld') + '"]').removeClass('hidden');
52
53    var sld = {
54        name: $(this).attr('data-name'),
55        route: $(this).attr('data-route'),
56        pivot: {
57            type: $(this).attr('data-type'),
58        }
59    }
60
61    swapsld(sld);
62});
63
64window.addEventListener('focus', inSlide);
65window.addEventListener('blur', stopSlider);
66
67function inSlide() {
68    stopSlider();
69
70    sliderInterval = setInterval(function () {
71        $('#epias-slider').stop(true, true);
72        moveSlider(1);
73    }, 5000);
74}
75
76function stopSlider() {
77    if (sliderInterval) {
78        clearInterval(sliderInterval);
79    }
80}
81
82function moveSlider(direction) {
83    clearInterval(sliderInterval);
84
85    // Schedule switch if slider is animating and there is no other scheduled switch
86
87    if (sliderIsAnimating) {
88        if (scheduledSwitch) {
89            return;
90        }
91
92        (function wait() {
93            if (!sliderIsAnimating) {
94                moveSlider(direction);
95            } else {
96                scheduledSwitch = true;
97                setTimeout(wait, 100);
98            }
99        })();
100
101        return;
102    }
103
104    scheduledSwitch = false;
105    sliderIsAnimating = true;
106
107    var sliderLength = $('.epias-slider-items li').length;
108
109    currentSlide += direction;
110
111    if (currentSlide >= sliderLength) {
112        currentSlide = 0;
113    }
114
115    if (currentSlide < 0) {
116        currentSlide = sliderLength - 1;
117    }
118
119    changeSlide(currentSlide, direction);
120}
121
122function changeSlide(index, direction) {
123	
124    var $slider = $('#epias-slider');
125    var $newSlide = $slider.find('.epias-slider-items li').eq(index);
126    var $allSlides = $slider.find('.epias-slider-items li');
127    var $previousSlide = $('.epias-slider-items li.active');
128    var $remainingSlides = $allSlides.not($previousSlide);
129
130    var slideContents = JSON.parse($newSlide.attr('data-project'));
131	
132    $slider.find('.slider-content').addClass('hidden');
133    $slider.find('.play-button').addClass('hidden');
134
135    rearrangeSliderPhotos($allSlides, $newSlide, $previousSlide, $remainingSlides, direction);
136
137    setTimeout(function () {
138        changeSliderContents($slider, slideContents);
139    }, 1500);
140
141    setTimeout(function () {
142        // Reorder slides to correct order after animation
143        $remainingSlides.css('opacity', 1);
144
145        $allSlides.css('z-index', 1);
146        $newSlide.css('z-index', 2);
147
148        setTimeout(function () {
149            // Allow next slider animation
150
151            sliderIsAnimating = false;
152
153            stopSlider();
154
155            sliderInterval = setInterval(function () {
156                moveSlider(1);
157            }, 5000);
158        }, 300);
159    }, 2000);
160}
161
162function swapText($element, text, animate) {
163    $element.fadeTo(animate ? 200 : 0, 0, function () {
164        if(text) {
165            $element.html(nl2br(text || ''));
166        }
167        $element.fadeTo(animate ? 200 : 0, 1);
168    });
169}
170
171function swapBackground($element, url) {
172    $element.css('background-image', 'url("' + url + '")');
173}
174
175function changeSliderContents($slider, slideContents) {
176    swapText($slider.find('h1.baslik'), slideContents.title, false);
177    swapText($slider.find('.subtitle'), slideContents.subtitle, false);
178	swapText($slider.find('.link').attr("href", slideContents.link), false);
179	swapText($slider.find('.detaylink').attr("id", slideContents.butontip), false);
180	swapText($slider.find('.detaylink').attr("target",slideContents.target), false);
181	swapText($slider.find('.detaylink').text(slideContents.butontext), false);
182	swapText($slider.find('h1.baslik').css('color',slideContents.color), false);
183	swapText($slider.find('.subtitle').css('color',slideContents.color), false);
184	swapText($slider.find('.link').css('color',slideContents.color), false);
185    $slider.find('.slider-content').removeClass('hidden');
186}
187
188function rearrangeSliderPhotos($allSlides, $newSlide, $previousSlide, $remainingSlides, direction) {
189    $newSlide.addClass('sliding');
190    setTimeout(function () {
191        $newSlide.removeClass('sliding');
192    }, 100);
193
194    $allSlides.removeClass('active');
195    $newSlide.addClass('active');
196
197    $allSlides.css('z-index', 1);
198    $newSlide.css('z-index', 2);
199    $previousSlide.css('z-index', 3);
200
201    $previousSlide.addClass((direction === -1 ? 'hidden-right' : 'hidden-left'));
202
203    $remainingSlides.removeClass('hidden-left');
204    $remainingSlides.removeClass('hidden-right');
205    $remainingSlides.addClass((direction === -1 ? 'hidden-left' : 'hidden-right'));
206    $newSlide.removeClass('hidden-left').removeClass('hidden-right');
207}
208
209function nl2br(str, is_xhtml) {
210    var breakTag = (is_xhtml || typeof is_xhtml === 'undefined') ? '<br />' : '<br>';
211    return (str + '').replace(/([^>\r\n]?)(\r\n|\n\r|\r|\n)/g, '$1' + breakTag + '$2');
212}

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.