• 31-12-2023, 13:46:25
    #1
    Merhaba sayfa içerisinde altta açılıp site önizlemesi yapan örnekte verdiğim gibi bir şey arıyorum bunun kodları nedir ? veya bir wordpress eklentisi üzerinden yapılıyor mu ?
    ÖRNEK
  • 31-12-2023, 13:50:25
    #2
    Sayfa kaynağını görüntüle diyip bulabiliyorsunuz script kodlarını.
  • 31-12-2023, 14:36:22
    #3
    Javascript kodları şu şekilde aynı ilettiğiniz örnekteki gibi çalışır;


    
    var ilkPopupURL = "http://example.com/first-ad";
    var ikinciPopupURL = "http://example.com/second-ad";
    
    var reklamListesi = [ilkPopupURL, ikinciPopupURL];
    
    var reklamBeklemeSuresi = 60;
    
    function setCookieForAd(name, value, seconds) {
        var expires = new Date();
        expires.setTime(expires.getTime() + (seconds * 1000));
        document.cookie = name + "=" + value + ";expires=" + expires.toGMTString() + ";path=/";
    }
    
    function getCookieForAd(name) {
        var keyValue = document.cookie.match('(^|;) ?' + name + '=([^;]*)(;|$)');
        return keyValue ? keyValue[2] : null;
    }
    
    function openPopupAd(url) {
        var height = 200; 
        var width = 300;
        var top = window.innerHeight - height;
        var left = window.innerWidth - width;
        var popup = window.open(url, '', 'height=' + height + ', width=' + width + ', top=' + top + ', left=' + left);
        return popup;
    }
    
    function initAd() {
        document.addEventListener('click', checkForAdDisplay);
    }
    
    function checkForAdDisplay() {
        reklamListesi.forEach(function(url, index) {
            if (!getCookieForAd('adShown' + index)) {
                openPopupAd(url);
                setCookieForAd('adShown' + index, 'true', reklamBeklemeSuresi);
            }
        });
    }
    
    initAd();