Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $current_visitor_count = intval(get_transient('popup_visitor_counter'));
- if ($current_visitor_count){
- if ($current_visitor_count == 3) {
- $referal = 'facebook';
- if (preg_match("/".$referal."\.com/i", $_SERVER['HTTP_REFERER']) && !isset($_COOKIE['popupSeen'])) {
- // show popup
- ?>
- <div class="_ppframe">
- <div class="_ppcontent">
- <h4>ZA PRISTUP STRANICI KLIKNI ISPOD</h4>
- <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
- <!-- 336 -->
- <ins class="adsbygoogle"
- style="display:inline-block;width:336px;height:280px"
- data-ad-client="ca-pub-8444860906359667"
- data-ad-slot="9602801662"></ins>
- <script>
- (adsbygoogle = window.adsbygoogle || []).push({});
- </script> </div>
- </div>
- <?
- // reset routine
- delete_transient('popup_visitor_counter');
- }
- } else {
- $vcount = $current_visitor_count + 1;
- set_transient('popup_visitor_counter', $vcount);
- }
- } else {
- set_transient('popup_visitor_counter', 1, 12 * HOUR_IN_SECONDS);
- }
- ?>
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
- <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
- <script type="text/javascript">
- $(window).on('blur',function(e) {
- if($(this).data('mouseIn') != 'yes')return;
- $('iframe').filter(function(){
- return $(this).data('mouseIn') == 'yes';
- }).trigger('iframeclick');
- });
- $(window).mouseenter(function(){
- $(this).data('mouseIn', 'yes');
- }).mouseleave(function(){
- $(this).data('mouseIn', 'yes');
- });
- $('iframe').mouseenter(function(){
- $(this).data('mouseIn', 'yes');
- $(window).data('mouseIn', 'yes');
- }).mouseleave(function(){
- $(this).data('mouseIn', null);
- });
- $('iframe').on('iframeclick', function(){
- console.log('Clicked inside iframe');
- $.cookie('popupSeen', '1', { expires: 0.3, path: '/' });
- location.reload();
- });
- $(window).on('click', function(){
- console.log('Clicked inside window');
- }).blur(function(){
- console.log('window blur');
- });
- </script>
- <meta charset="<?php bloginfo('charset'); ?>">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <link rel="profile" href="http://gmpg.org/xfn/11" />
- <?php if (is_singular() && pings_open(get_queried_object())) : ?>
- <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
- <?php endif; ?>
- <?php wp_head(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement