vendor: 3,437 bytes, lines 1-106
1//like fanpage 2(function(factory) { 3 if (typeof define === 'function' && define.amd) { 4// AMD 5 define(['jquery'], factory); 6 } else if (typeof exports === 'object') { 7// CommonJS 8 factory(require('jquery')); 9 } else { 10// Browser globals 11 factory(jQuery); 12 } 13}(function($) { 14 15 var pluses = /\+/g; 16 function encode(s) { 17 return config.raw ? s : encodeURIComponent(s); 18 } 19 20 function decode(s) { 21 return config.raw ? s : decodeURIComponent(s); 22 } 23 24 function stringifyCookieValue(value) { 25 return encode(config.json ? JSON.stringify(value) : String(value)); 26 } 27 28 function parseCookieValue(s) { 29 if (s.indexOf('"') === 0) { 30// This is a quoted cookie as according to RFC2068, unescape... 31 s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); 32 } 33 34 try { 35// Replace server-side written pluses with spaces. 36// If we can't decode the cookie, ignore it, it's unusable. 37// If we can't parse the cookie, ignore it, it's unusable. 38 s = decodeURIComponent(s.replace(pluses, ' ')); 39 return config.json ? JSON.parse(s) : s; 40 } catch (e) { 41 } 42 } 43 44 function read(s, converter) { 45 var value = config.raw ? s : parseCookieValue(s); 46 return $.isFunction(converter) ? converter(value) : value; 47 } 48 49 var config = $.cookie = function(key, value, options) { 50 51// Write 52 53 if (arguments.length > 1 && !$.isFunction(value)) { 54 options = $.extend({}, config.defaults, options); 55 if (typeof options.expires === 'number') { 56 var days = options.expires, t = options.expires = new Date(); 57 t.setTime(+t + days * 864e+5); 58 } 59 60 return (document.cookie = [ 61 encode(key), '=', stringifyCookieValue(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// To prevent the for loop in the first place assign an empty array 73// in case there are no cookies at all. Also prevents odd result when 74// calling $.cookie(). 75 var cookies = document.cookie ? document.cookie.split('; ') : []; 76 for (var i = 0, l = cookies.length; i < l; i++) { 77 var parts = cookies[i].split('='); 78 var name = decode(parts.shift()); 79 var cookie = parts.join('='); 80 if (key && key === name) { 81// If second argument (value) is a function it's a converter... 82 result = read(cookie, value); 83 break; 84 } 85 86// Prevent storing a cookie that we couldn't decode. 87 if (!key && (cookie = read(cookie)) !== undefined) { 88 result[name] = cookie; 89 } 90 } 91 92 return result; 93 }; 94 config.defaults = {}; 95 $.removeCookie = function(key, options) { 96 if ($.cookie(key) === undefined) { 97 return false; 98 } 99 100// Must not alter options, thus extending a fresh object... 101 $.cookie(key, '', $.extend({}, options, {expires: -1})); 102 return !$.cookie(key); 103 }; 104})); 105$(document).ready(function() { 106});
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.