<?php $__env->startSection('title','Manşet Haberleri - Ogaste'); ?>
<?php $__env->startSection('description','Manşet Haberleri ve Gelişmeleri Ogaste Haber Sitesinde Yer Almaktadır' ); ?>



<?php $__env->startSection('content'); ?>
<div class="container-page-custom"  id="site-content">
     
        <div class="col-md-12">
    <div class="ads-1">
        <div class="container">
            <div class="d-flex align-items-center">
                    <?php echo config('settings.reklam_alanı_anasyafa_banner', 'Varsayılan Başlık'); ?>

            </div>
        </div>
    </div>
     <div class="container Category">
          <div class="container mt-5">
        <div class="section-header">
            <h2>Manşet Haberler</h2>
            <div class="line" style="background-color:#0400ff"></div>
        </div>
    </div>
    <div class="row">
      

    </div>
  

    </div>
    <div style="clear: both;"></div>
    <div class="container newseight" style="margin-top:50px">
        <div class="row">
           <?php $__currentLoopData = $ekonomikhaberlerNews; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $ekonomikhaberNews): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <div class="col-6 col-md-3 col-lg-3">
                 <div class="news-card">
             <?php echo getNewsLink($ekonomikhaberNews); ?><img src="http://panel.nxoran.com/uploads/images/<?php echo e($ekonomikhaberNews->news_image); ?>" alt="Yıkım"  style="height:165px"></a>
            <div class="news-badge"style="background-color:#<?php echo e($ekonomikhaberNews->category->color); ?> !important;"><?php echo e($ekonomikhaberNews->category->name); ?></div>
             <div class="card-body">
                <h5 class="card-title">  <?php echo getNewsLink($ekonomikhaberNews); ?><div class="news-title"><?php echo e($ekonomikhaberNews->name); ?></div></a></h5></div>
        </div>
            </div>
                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
            
           
        </div>
            <div id="loading" style="display:none;" class="text-center mt-5">
    <img src="/output-onlinegiftools.gif" alt="Loading..." style="width: 150px;">

</div>
    </div>
    </div>
 </div>
              
    </div>
</div>

<script type="text/javascript">
    
    
       
     function initializeSlider(sliderClass, leftBtnId, rightBtnId, indicatorUlId, interval) {
    let sliderCont = document.querySelector(sliderClass);
    let sliderI = sliderCont.querySelectorAll(".sliderIn");
    let sliderItem = [...sliderI];
    let sliderD = sliderCont.parentElement.querySelectorAll(".lim");
    let sliderDods = [...sliderD];
    let dodsUl = sliderCont.parentElement.querySelector(indicatorUlId);
    let btnLeft = document.getElementById(leftBtnId);
    let btnRight = document.getElementById(rightBtnId);
    let limit = 0;
    let startX = 0;
    let moveX = 0;

    btnLeft.addEventListener("click", prev);
    btnRight.addEventListener("click", next);

    sliderCont.addEventListener("touchstart", touchStart);
    sliderCont.addEventListener("touchmove", touchMove);
    sliderCont.addEventListener("touchend", touchEnd);

    nexts();

    function prev() {
        limit--;
        if (limit < 0) {
            limit = sliderItem.length - 1;
        }
        nexts();
    }

    function next() {
        limit++;
        if (limit >= sliderItem.length) {
            limit = 0;
        }
        nexts();
    }

    let replay = setInterval(next, interval);

    dodsUl.addEventListener("mouseover", (e, index) => {
        if (!e.target.classList.contains("tumu")) {
            sliderDods.forEach((em, ind) => {
                em.classList.remove("active");
            });
            e.target.classList.add("active");
            limit = Number(e.target.innerText - 1);
            nexts();
        }
    });

    function nexts() {
        sliderItem.forEach((it, index) => {
            if (index == limit) {
                it.classList.add("sliderInActive");
            } else {
                it.classList.remove("sliderInActive");
            }
        });
        sliderDods.forEach((im, index) => {
            if (index == limit) {
                im.classList.add("active");
            } else {
                im.classList.remove("active");
            }
        });
    }

    function touchStart(e) {
        startX = e.touches[0].clientX;
        clearInterval(replay);
    }

    function touchMove(e) {
        moveX = e.touches[0].clientX;
    }

    function touchEnd() {
        const sensitivity = 100; // Kaydırma hassasiyetini artırmak için bu değeri artırabilirsiniz.
        if (startX > moveX + sensitivity) {
            next();
        } else if (startX < moveX - sensitivity) {
            prev();
        }
        replay = setInterval(next, interval);
    }
}

        // Initialize sliders
        initializeSlider(".slider-2", "left-2", "right-2", "#uli-2", 4000);

      
</script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>

<script type="text/javascript">
    let offset = 50; // İlk 20 haber zaten yüklü.
let loading = false;

// CSRF token'ını almak için jQuery'yi kullanıyoruz
$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});

$(window).scroll(function() {
    if ($(window).scrollTop() + $(window).height() >= $(document).height() - 100 && !loading) {
        loading = true; // Aynı anda birden fazla istek yapmayı engelle
        $('#loading').show(); // Loading div'i göster

        $.ajax({
            url: '<?php echo e(route('load.more.manset')); ?>',
            method: 'POST',
            data: {
                offset: offset
            },
            success: function(response) {
                if (response) {
                    $('.newseight .row').append(response);
                    offset += 20; // Yeni offset değeri
                    loading = false;
                        $('#loading').hide();
                }
            },
            error: function() {
                loading = false; // Hata durumunda tekrar yüklemeye izin ver
                 $('#loading').hide();
            }
        });
    }
});
</script>

<?php $__env->stopSection(); ?>

<?php echo $__env->make('layout.master', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nxoranco/public_html/resources/views/categories/manset.blade.php ENDPATH**/ ?>