SHARE
TWEET

Untitled

a guest Jul 17th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var expDays = 1;
  2. function GetCookie (name) {  
  3. var arg = name + "=";
  4.   var alen = arg.length;
  5.   var clen = document.cookie.length;
  6.   var i = 0;
  7.  
  8.   while (i < clen) {
  9.     var j = i + alen;
  10.    if (document.cookie.substring(i, j) == arg)
  11.        return getCookieVal (j);
  12.       i = document.cookie.indexOf(" ", i) + 1;
  13.  if (i == 0) break;
  14. }
  15.     return null;
  16. }
  17.  
  18. function SetCookie (name, value) {
  19.   var argv = SetCookie.arguments;
  20.   var argc = SetCookie.arguments.length;
  21.   var expires = (argc > 2) ? argv[2] : null;
  22.   var path = (argc > 3) ? argv[3] : null;
  23.   var domain = (argc > 4) ? argv[4] : null;
  24.   var secure = (argc > 5) ? argv[5] : false;
  25. document.cookie = name + "=" + escape(value) +
  26. ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
  27. ((path == null) ? "" : ("; path=" + path)) +
  28. ((domain == null) ? "" : ("; domain=" + domain)) +
  29. ((secure == true) ? "; secure" : "");
  30.  
  31. }
  32.  
  33. function DeleteCookie (name) {
  34.   var exp = new Date();
  35.   exp.setTime (exp.getTime() - 1);
  36.   var cval = GetCookie (name);
  37.   document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
  38.  
  39. }
  40.  
  41. var exp = new Date();
  42. exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
  43.  
  44. function amt(){
  45.   var count = GetCookie('count')
  46.  
  47.   if(count == null) {
  48.     SetCookie('count','1')
  49.     return 1
  50.     } else {
  51.        var newcount = parseInt(count) + 1;
  52.        DeleteCookie('count')
  53.        SetCookie('count',newcount,exp)
  54.     return count
  55.  
  56.     }
  57.  
  58. }
  59.  
  60. function getCookieVal(offset) {
  61.    var endstr = document.cookie.indexOf (";", offset);
  62.    if (endstr == -1)
  63.      endstr = document.cookie.length;
  64.      return unescape(document.cookie.substring(offset, endstr));
  65. }
  66.  
  67.  
  68.  
  69. function checkCount() {
  70.   var count = GetCookie('count');
  71.   if (count == null) {
  72.     count=1;
  73.     SetCookie('count', count, exp);
  74.     $(".popup-suscripcion").attr("style","display:block");
  75.   } else {      
  76.     $(".popup-suscripcion").attr("style","display:none");      
  77.     count++;
  78.     SetCookie('count', count, exp);
  79.   }
  80.  
  81. }
  82.  
  83. window.onload=checkCount
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top