Advertisement
edusan

02 - Coloca Aceptación

Dec 29th, 2013
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
  2.  
  3. <script>
  4. /*!
  5.  * jQuery Cookie Plugin v1.3.1
  6.  * https://github.com/carhartl/jquery-cookie
  7.  *
  8.  * Copyright 2013 Klaus Hartl
  9.  * Released under the MIT license
  10.  */
  11. (function (factory) {
  12.     if (typeof define === 'function' && define.amd) {
  13.         // AMD. Register as anonymous module.
  14.         define(['jquery'], factory);
  15.     } else {
  16.         // Browser globals.
  17.         factory(jQuery);
  18.     }
  19. }(function ($) {
  20.  
  21.     var pluses = /\+/g;
  22.  
  23.     function decode(s) {
  24.         if (config.raw) {
  25.             return s;
  26.         }
  27.         return decodeURIComponent(s.replace(pluses, ' '));
  28.     }
  29.  
  30.     function decodeAndParse(s) {
  31.         if (s.indexOf('"') === 0) {
  32.             // This is a quoted cookie as according to RFC2068, unescape...
  33.             s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  34.         }
  35.  
  36.         s = decode(s);
  37.  
  38.         try {
  39.             return config.json ? JSON.parse(s) : s;
  40.         } catch(e) {}
  41.     }
  42.  
  43.     var config = $.cookie = function (key, value, options) {
  44.  
  45.         // Write
  46.         if (value !== undefined) {
  47.             options = $.extend({}, config.defaults, options);
  48.  
  49.             if (typeof options.expires === 'number') {
  50.                 var days = options.expires, t = options.expires = new Date();
  51.                 t.setDate(t.getDate() + days);
  52.             }
  53.  
  54.             value = config.json ? JSON.stringify(value) : String(value);
  55.  
  56.             return (document.cookie = [
  57.                 config.raw ? key : encodeURIComponent(key),
  58.                 '=',
  59.                 config.raw ? value : encodeURIComponent(value),
  60.                 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
  61.                 options.path    ? '; path=' + options.path : '',
  62.                 options.domain  ? '; domain=' + options.domain : '',
  63.                 options.secure  ? '; secure' : ''
  64.             ].join(''));
  65.         }
  66.  
  67.         // Read
  68.         var cookies = document.cookie.split('; ');
  69.         var result = key ? undefined : {};
  70.         for (var i = 0, l = cookies.length; i < l; i++) {
  71.             var parts = cookies[i].split('=');
  72.             var name = decode(parts.shift());
  73.             var cookie = parts.join('=');
  74.  
  75.             if (key && key === name) {
  76.                 result = decodeAndParse(cookie);
  77.                 break;
  78.             }
  79.  
  80.             if (!key) {
  81.                 result[name] = decodeAndParse(cookie);
  82.             }
  83.         }
  84.  
  85.         return result;
  86.     };
  87.  
  88.     config.defaults = {};
  89.  
  90.     $.removeCookie = function (key, options) {
  91.         if ($.cookie(key) !== undefined) {
  92.             // Must not alter options, thus extending a fresh object...
  93.             $.cookie(key, '', $.extend({}, options, { expires: -1 }));
  94.             return true;
  95.         }
  96.         return false;
  97.     };
  98.  
  99. }));
  100. </script>
  101. <script>
  102. jQuery(document).ready(function($){
  103.     $.cookie('aceptacookie', 'yes', { expires: 365, path: '/' });
  104.         $(".avisoCookie").css({"display" : "none"});
  105.  
  106.     });
  107. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement