Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.32 KB | None | 0 0
  1. <?php
  2. $current_visitor_count = intval(get_transient('popup_visitor_counter'));
  3. if ($current_visitor_count){
  4. if ($current_visitor_count == 3) {
  5. $referal = 'facebook';
  6. if (preg_match("/".$referal."\.com/i", $_SERVER['HTTP_REFERER']) && !isset($_COOKIE['popupSeen'])) {
  7. // show popup
  8. ?>
  9. <div class="_ppframe">
  10. <div class="_ppcontent">
  11. <h4>ZA PRISTUP STRANICI KLIKNI ISPOD</h4>
  12. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
  13. <!-- 336 -->
  14. <ins class="adsbygoogle"
  15. style="display:inline-block;width:336px;height:280px"
  16. data-ad-client="ca-pub-8444860906359667"
  17. data-ad-slot="9602801662"></ins>
  18. <script>
  19. (adsbygoogle = window.adsbygoogle || []).push({});
  20. </script> </div>
  21. </div>
  22. <?
  23. // reset routine
  24. delete_transient('popup_visitor_counter');
  25. }
  26. } else {
  27. $vcount = $current_visitor_count + 1;
  28. set_transient('popup_visitor_counter', $vcount);
  29. }
  30. } else {
  31. set_transient('popup_visitor_counter', 1, 12 * HOUR_IN_SECONDS);
  32. }
  33. ?>
  34. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  35. <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-cookie/1.4.1/jquery.cookie.js"></script>
  36. <script type="text/javascript">
  37. $(window).on('blur',function(e) {
  38. if($(this).data('mouseIn') != 'yes')return;
  39. $('iframe').filter(function(){
  40. return $(this).data('mouseIn') == 'yes';
  41. }).trigger('iframeclick');
  42. });
  43. $(window).mouseenter(function(){
  44. $(this).data('mouseIn', 'yes');
  45. }).mouseleave(function(){
  46. $(this).data('mouseIn', 'yes');
  47. });
  48. $('iframe').mouseenter(function(){
  49. $(this).data('mouseIn', 'yes');
  50. $(window).data('mouseIn', 'yes');
  51. }).mouseleave(function(){
  52. $(this).data('mouseIn', null);
  53. });
  54. $('iframe').on('iframeclick', function(){
  55. console.log('Clicked inside iframe');
  56. $.cookie('popupSeen', '1', { expires: 0.3, path: '/' });
  57. location.reload();
  58. });
  59. $(window).on('click', function(){
  60. console.log('Clicked inside window');
  61. }).blur(function(){
  62. console.log('window blur');
  63. });
  64. </script>
  65. <meta charset="<?php bloginfo('charset'); ?>">
  66. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  67. <link rel="profile" href="http://gmpg.org/xfn/11" />
  68. <?php if (is_singular() && pings_open(get_queried_object())) : ?>
  69. <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
  70. <?php endif; ?>
  71. <?php wp_head(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement