public function output(Settings $settings)
    {
        $class = $this->getClass($settings->getDivClass());
        $style = $this->getStyles();
        $attrs = $this->getAttrsAsString();
        return <<<RETURN
<div class="{$class}"{$attrs}>
<div id="{$this->divId}">
<script type="text/javascript" defer>
googletag.cmd.push(function() { googletag.display('{$this->divId}'); });
googletag.cmd.push(function() {
    \$(function() {
        var slideTimer = setTimeout(function() {
            clearTimeout(slideTimer);
            \$('div.{$class}').each(function() {
                var ad = \$(this);
                var container = \$('[data-role="pageskin"]');
                var closed = false;
                var scrolled = false;
                var showAd = function(force) {
                    if(! closed || force) {
                        ad.fadeIn('fast'); scrolled = true; closed = false;
                        container.css('margin-top', '90px');
                        container.css('z-index', '2');
                        container.css('position', 'relative');
                        ad.css('top', container.offset().top - 90);
                    }
                };
                var hideAd = function() {
                    ad.fadeOut('fast');
                    container.css('margin-top', '0');
                    closed = true;
                }

                            if(ad.find('div').css('display') != 'none') {
                                showAd();
                                \$(window).scroll(function () {
                                    if (!scrolled && !closed && \$(this).scrollTop() > 40) {
                                        showAd();
                                    }
                                });
                                ad.find('.pageskin_ad_close').click(function(e) {
                                    e.preventDefault();
                                    hideAd();
                                });
                            }
                        });
                    }, 2000);
    });
});
</script>
</div>
</div>
RETURN;
    }
    /**
     * Output the DFP code for this ad unit
     *
     * @param Nodrew\Bundle\DfpBundle\Model\Settings $settings
     * @return string
     */
    public function output(Settings $settings)
    {
        $class = $settings->getDivClass();
        $style = $this->getStyles();
        return <<<RETURN

<div id="{$this->divId}" class="{$class}" style="{$style}">
<script type="text/javascript">
googletag.cmd.push(function() { googletag.display('{$this->divId}'); });
</script>
</div>
RETURN;
    }
Beispiel #3
0
    /**
     * Output the DFP code for this ad unit
     *
     * @param Settings $settings
     * @return string
     */
    public function output(Settings $settings)
    {
        $class = $this->getClass($settings->getDivClass());
        $attrs = $this->getAttrsAsString();
        return <<<RETURN
<div class="{$class}"{$attrs}>
<div id="{$this->divId}">
<script type="text/javascript" defer>
googletag.cmd.push(function() { googletag.display('{$this->divId}'); });
</script>
</div>
</div>
RETURN;
    }
Beispiel #4
0
    public function output(Settings $settings)
    {
        $class = $this->getClass($settings->getDivClass());
        $style = $this->getStyles();
        $attrs = $this->getAttrsAsString();
        return <<<RETURN
<div class="{$class}"{$attrs}>
<div id="{$this->divId}">
<script type="text/javascript" defer>
googletag.cmd.push(function() { googletag.display('{$this->divId}'); });
googletag.cmd.push(function() {
    \$(function() {
        var slideTimer = setTimeout(function() {
            clearTimeout(slideTimer);
            \$(function() {
                if(\$('.ad-container').length > 0) {
                    \$('.ad-container > div:first').each(function() {
                        var el = \$(this);
                        // don't show when there is no ad
                        if(el.css('display') == 'none')
                            return;

                        var parent = el.parent();
                        if(parent.data('placement') === 'bottom') {
                            \$('body').css('padding-bottom', parent.data('height'));
                            \$('#feedbackButton').css('bottom', parent.data('height'));
                        }
                        parent.show();
                        \$('input,select,option,textarea')
                            .bind('focus', function() {
                                parent.hide();
                            }).bind('blur', function() {
                            parent.show();
                        });
                    });
                }
            });
        }, 2000);
    });
});
</script>
</div>
</div>
RETURN;
    }
Beispiel #5
0
    public function output(Settings $settings)
    {
        $class = $this->getClass($settings->getDivClass());
        $style = $this->getStyles();
        return <<<RETURN
<div class="{$class}">
<div id="{$this->divId}">
<a href="javascript:void(0)" class="scrolldown_ad_close">x</a>
<script type="text/javascript">
googletag.cmd.push(function() { googletag.display('{$this->divId}'); });
googletag.cmd.push(function() {
    \$(function() {
        var slideTimer = setTimeout(function() {
            clearTimeout(slideTimer);
            \$('div.{$class}').each(function() {
                var ad = \$(this);
                var closed = false;
                var scrolled = false;
                var showAd = function(force) { if(! closed || force) { ad.toggle('slow'); scrolled = true; closed = false; } }
                            var hideAd = function() { ad.fadeOut(); closed = true; }

                            if(ad.find('div').css('display') != 'none') {
                                showAd();
                                \$(window).scroll(function () {
                                    if (!scrolled && !closed && \$(this).scrollTop() > 40) {
                                        showAd();
                                    }
                                });
                                ad.find('.scrolldown_ad_close').click(function(e) {
                                    e.preventDefault();
                                    hideAd();
                                });
                            }
                        });
                    }, 2000);
    });
});
</script>
</div>
</div>
RETURN;
    }
Beispiel #6
0
    public function output(Settings $settings)
    {
        $class = $this->getClass($settings->getDivClass());
        $style = $this->getStyles();
        $attrs = $this->getAttrsAsString();
        $attr_array = $this->getAttrs();
        $closed = isset($attr_array['data-closed']) ? $attr_array['data-closed'] : 'false';
        $scrolled = isset($attr_array['data-scrolled']) ? $attr_array['data-scrolled'] : 'false';
        $initTimer = isset($attr_array['data-init-timer']) ? $attr_array['data-init-timer'] : 2000;
        $closeBtn = isset($attr_array['data-close-btn']) ? $attr_array['data-close-btn'] : 'scrolldown_ad_close';
        return <<<RETURN
<div class="{$class}"{$attrs}>
<div id="{$this->divId}">
<a href="javascript:void(0)" class="{$closeBtn}">x</a>
<script type="text/javascript">
googletag.cmd.push(function() { googletag.display('{$this->divId}'); });
googletag.cmd.push(function() {
    \$(function() {
        var slideTimer = setTimeout(function() {
            clearTimeout(slideTimer);
            \$('div.{$class}').each(function() {
                var ad = \$(this);
                var closed = {$closed};
                var scrolled = {$scrolled};
                var disabled = false;
                var showAd = function(force) { if(! closed || force) { ad.toggle('fast'); scrolled = true; closed = false; } }
                    var hideAd = function(forced) { if(!forced && disabled) return; ad.fadeOut(); closed = true; }

                    if(ad.find('div').css('display') != 'none') {
                        showAd();
                        \$(window).scroll(function () {
                            if (!scrolled && !closed && \$(this).scrollTop() > 40) {
                                showAd();
                            }
                        });
                        ad.find('.{$closeBtn}').click(function(e) {
                            e.preventDefault();
                            hideAd();
                        });
                    }
                    
                    var timeout = ad.data('timeout');
                    var timeout_wait = ad.data('wait-timeout');
                   
                    if(timeout) {
                        setTimeout(function(){
                            // Hide function
                            hideAd(true);
                        }, timeout);
                    }
                    
                    if(timeout_wait) {
                        var count=timeout_wait/1000;

                        var counter=setInterval(timer, 1000);
                        \$('.{$class} .{$closeBtn}')
                                .html('' + count +'')
                                .css('display','inline');
                    
                    
                        function timer()
                        {
                            \$('.{$class} .{$closeBtn}').html(--count);
                            if (count <= 0)
                            {
                                clearInterval(counter);
                                return;
                            }
                    
                        }
                    
                       // Disable Close Button
                        disabled = true;
                        setTimeout(function(){
                            // Enable Close Button
                            \$('.{$class} .{$closeBtn}').html('x');
                            disabled = false;
                        }, timeout_wait);
                    }
                });
            }, {$initTimer});
    });
});
</script>
</div>
</div>
RETURN;
    }