Authored by xuqi

function of get cookie

... ... @@ -10,23 +10,11 @@ var $body = $('body');
require('./footer');
function cookie(name) {
var cookies = document.cookie,
cookieVal,
offset;
if (document.cookie && document.cookie !== '') {
offset = cookies.indexOf(name + '=');
if (offset > -1) {
offset += name.length + 1;
cookieVal = decodeURIComponent($.trim(cookies.substring(offset, cookies.indexOf(';', offset))));
}
}
var re = new RegExp(name + '=([^;$]*)', 'i'),
matchPattern = '$1';
return cookieVal;
return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
}
function setCookie(name, value, options) {
... ...