PageSourceSearch

https://surekha.info/wp-content/themes/sport-theme-bongdalu/assets/js/sport-featured.js?ver=1.0

js surekha.info collected 2026-10-09 22:21:48 UTC 2,526 bytes, 81 lines download raw bytes

1jQuery(document).ready(function($){
2    $('.sport-featured-posts').each(function(){
3        const wrap = $(this);
4        const cat = wrap.data('cat') || '';
5        const number = parseInt(wrap.data('number_post')) || 4;
6        let offset = parseInt(wrap.data('offset')) || 0;
7        const btnNext = wrap.find('.sp-next');
8        const btnPrev = wrap.find('.sp-prev');
9
10        // Cập nhật trạng thái nút Prev/Next
11        function updateButtons(isEnd){
12            btnPrev.prop('disabled', offset <= 0);
13            btnNext.prop('disabled', !!isEnd);
14        }
15
16        function loadPosts(newOffset){
17    const direction = newOffset > offset ? 'right' : 'left';
18    const isEnd = wrap.data('end');
19    if ((isEnd && direction === 'right') || (newOffset < 0 && direction === 'left')) return;
20
21    const $wrapper = wrap.find('.sp-featured-wrapper');
22
23    $.get(spAjax.ajax_url, {
24        action: 'sport_theme_load_featured',
25        cat: cat,
26        offset: newOffset,
27        number_post: number
28    }, function (res) {
29        if (!res) return;
30
31        const $resHtml = $(res);
32        const newWrapperHtml = $resHtml.find('.sp-featured-wrapper').html();
33        const endData = $resHtml.find('.sport-featured-posts').data('end') || false;
34
35        if (newWrapperHtml) {
36            // Thay dữ liệu cũ luôn
37            $wrapper.html(newWrapperHtml);
38
39            // Reset vị trí ban đầu (ngoài viewport) và opacity 0
40            $wrapper.css({
41                transform: direction === 'right' ? 'translateX(100%)' : 'translateX(-100%)',
42                opacity: 0,
43                transition: 'none'
44            });
45            $wrapper[0].offsetHeight;
46            $wrapper.css({
47                transition: 'transform 0.3s ease, opacity 0.3s ease',
48                transform: 'translateX(0)',
49                opacity: 1
50            });
51
52            offset = newOffset;
53            wrap.data('end', endData);
54            updateButtons(endData);
55        } else {
56            wrap.data('end', true);
57            updateButtons(true);
58        }
59    });
60}
61
62
63
64
65
66        // Nút Next
67        btnNext.on('click', function(){
68            if(wrap.data('end') === true || wrap.data('end') === 'true') return;
69            loadPosts(offset + number);
70        });
71
72        // Nút Prev
73        btnPrev.on('click', function(){
74            if(offset <= 0) return;
75            loadPosts(Math.max(0, offset - number));
76        });
77
78        // Khởi tạo nút
79        updateButtons(wrap.data('end'));
80    });
81});

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.