1/*! 2 * jQuery Cookie Plugin v1.3.1 3 * https://github.com/carhartl/jquery-cookie 4 * 5 * Copyright 2013 Klaus Hartl 6 * Released under the MIT license 7 */ 8 9(function (factory) { 10 if (typeof define === 'function' && define.amd) { 11 // AMD. Register as anonymous module. 12 define(['jquery'], factory); 13 } else { 14 // Browser globals. 15 factory(jQuery); 16 } 17}(function ($) { 18 19 var pluses = /\+/g; 20 21 function decode(s) { 22 if (config.raw) { 23 return s; 24 } 25 try { 26 // If we can't decode the cookie, ignore it, it's unusable. 27 return decodeURIComponent(s.replace(pluses, ' ')); 28 } catch(e) {} 29 } 30 31 function decodeAndParse(s) { 32 if (s.indexOf('"') === 0) { 33 // This is a quoted cookie as according to RFC2068, unescape... 34 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 35 } 36 37 s = decode(s); 38 39 try { 40 // If we can't parse the cookie, ignore it, it's unusable. 41 return config.json ? JSON.parse(s) : s; 42 } catch(e) {} 43 } 44 45 var config = $.cookie = function (key, value, options) { 46 47 // Write 48 if (value !== undefined) { 49 options = $.extend({}, config.defaults, options); 50 51 if (typeof options.expires === 'number') { 52 var days = options.expires, t = options.expires = new Date(); 53 t.setDate(t.getDate() + days); 54 } 55 56 value = config.json ? JSON.stringify(value) : String(value); 57 58 return (document.cookie = [ 59 config.raw ? key : encodeURIComponent(key), 60 '=', 61 config.raw ? value : encodeURIComponent(value), 62 options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE 63 options.path ? '; path=' + options.path : '', 64 options.domain ? '; domain=' + options.domain : '', 65 options.secure ? '; secure' : '' 66 ].join('')); 67 } 68 69 // Read 70 71 var result = key ? undefined : {}; 72 73 // To prevent the for loop in the first place assign an empty array 74 // in case there are no cookies at all. Also prevents odd result when 75 // calling $.cookie(). 76 var cookies = document.cookie ? document.cookie.split('; ') : []; 77 78 for (var i = 0, l = cookies.length; i < l; i++) { 79 var parts = cookies[i].split('='); 80 var name = decode(parts.shift()); 81 var cookie = parts.join('='); 82 83 if (key && key === name) { 84 result = decodeAndParse(cookie); 85 break; 86 } 87 88 // Prevent storing a cookie that we couldn't decode. 89 if (!key && (cookie = decodeAndParse(cookie)) !== undefined) { 90 result[name] = cookie; 91 } 92 } 93 94 return result; 95 }; 96 97 config.defaults = {}; 98 99 $.removeCookie = function (key, options) { 100 if ($.cookie(key) !== undefined) { 101 // Must not alter options, thus extending a fresh object... 102 $.cookie(key, '', $.extend({}, options, { expires: -1 })); 103 return true; 104 } 105 return false; 106 }; 107 108})); 109 110/* ====================================================================================== 111 @author Carlos Doral Pérez (http://webartesanal.com) 112 @version 0.19 113 @copyright Copyright © 2013-2014 Carlos Doral Pérez, All Rights Reserved 114 License: GPLv2 or later 115 ====================================================================================== */ 116 117// 118// 119// 120var cdp_cookie = { 121 122 // vars 123 _id_cookie: 'cdp-cookies-plugin-wp', 124 125 // 126 // Compruebo si ya existe la cookie si es visitante nuevo. 127 // 128 // Modif: 08-ene-2014. Compruebo primero si existe la cookie antes del contenido de la misma 129 // 130 ya_existe_cookie: function _ya_existe_cookie() { 131 if( jQuery.cookie( cdp_cookie._id_cookie ) != null ) 132 return jQuery.cookie( cdp_cookie._id_cookie ) == 'cdp'; 133 return false; 134 }, 135 136 // Guardo cookie 137 poner_cookie: function _poner_cookie() { 138 return jQuery.cookie( cdp_cookie._id_cookie, 'cdp', { expires: 365, path: '/' } ); 139 }, 140 141 // Eliminar cookie 142 eliminar: function _eliminar() {
143 return jQuery.removeCookie( cdp_cookie._id_cookie ); 144 }, 145 146 // Inicializacion 147 iniciar: function _iniciar() { 148 // Solapa 149 jQuery( '.cdp-cookies-solapa' ).click( function() { 150 cdp_cookie.mostrar_aviso(); 151 } ); 152 153 // Aceptar 154 jQuery( '.cdp-cookies-boton-cerrar' ).click( function() { 155 cdp_cookie.poner_cookie(); 156 cdp_cookie.ocultar_aviso(); 157 } ); 158 }, 159 160 // Muestra aviso 161 mostrar_aviso: function _mostrar_aviso( de_golpe ) { 162 if( de_golpe ) 163 { 164 jQuery( '.cdp-cookies-texto' ).attr( 'class', 'cdp-cookies-texto cdp-mostrar' ); 165 jQuery( '.cdp-cookies-solapa' ).attr( 'class', 'cdp-cookies-solapa cdp-ocultar' ); 166 } 167 else 168 { 169 jQuery( '.cdp-cookies-texto' ).attr( 'class', 'cdp-cookies-texto cdp-animacion-arriba' ); 170 jQuery( '.cdp-cookies-solapa' ).attr( 'class', 'cdp-cookies-solapa cdp-animacion-abajo' ); 171 } 172 }, 173 174 // Oculta aviso 175 ocultar_aviso: function _ocultar_aviso( de_golpe ) { 176 if( de_golpe ) 177 { 178 jQuery( '.cdp-cookies-texto' ).attr( 'class', 'cdp-cookies-texto cdp-ocultar' ); 179 jQuery( '.cdp-cookies-solapa' ).attr( 'class', 'cdp-cookies-solapa cdp-mostrar' ); 180 } 181 else 182 { 183 jQuery( '.cdp-cookies-texto' ).attr( 'class', 'cdp-cookies-texto cdp-animacion-abajo' ); 184 jQuery( '.cdp-cookies-solapa' ).attr( 'class', 'cdp-cookies-solapa cdp-animacion-arriba' ); 185 } 186 }, 187 188 // 189 comportamiento: function _comportamiento() { 190 return cdp_cookies_info.comportamiento; 191 } 192}; 193 194// 195// 196// 197jQuery( document ).ready( function( $ ) 198{ 199 // Inicialización 200 cdp_cookie.iniciar(); 201 202 // Si ya hay cookie retorno 203 if( cdp_cookie.ya_existe_cookie() ) 204 cdp_cookie.ocultar_aviso( true ); 205 else 206 cdp_cookie.mostrar_aviso( true ); 207} );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.