Authored by zhangxiaoru

guang cookie

@@ -264,6 +264,40 @@ $overlay.on('touchstart', function() { @@ -264,6 +264,40 @@ $overlay.on('touchstart', function() {
264 return false; 264 return false;
265 }); 265 });
266 266
  267 +function setCookie(name, value, options) {
  268 + var expires = '',
  269 + path,
  270 + domain,
  271 + secure,
  272 + date;
  273 +
  274 +
  275 + if (typeof value !== 'undefined') {
  276 + options = options || {};
  277 + if (value === null) {
  278 + value = '';
  279 + options.expires = -1;
  280 + }
  281 +
  282 + if (options.expires &&
  283 + (typeof options.expires === 'number' || options.expires.toUTCString)) {
  284 + if (typeof options.expires === 'number') {
  285 + date = new Date();
  286 +
  287 + date.setTime(Date.parse((new Date()).toLocaleDateString()) + 86400 * 1000);
  288 +
  289 + } else {
  290 + date = options.expires;
  291 + }
  292 + expires = '; expires=' + date.toGMTString();
  293 + }
  294 + path = options.path ? '; path=' + options.path : '';
  295 + domain = options.domain ? '; domain=' + options.domain : '';
  296 + secure = options.secure ? '; secure' : '';
  297 + document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
  298 + }
  299 +}
  300 +
267 // 初始化页面,包括是否使用iscorll初始化页面 301 // 初始化页面,包括是否使用iscorll初始化页面
268 // 接口暴露在HTML中,使用压缩名 302 // 接口暴露在HTML中,使用压缩名
269 (function() { 303 (function() {
@@ -369,9 +403,10 @@ $overlay.on('touchstart', function() { @@ -369,9 +403,10 @@ $overlay.on('touchstart', function() {
369 // window.setCookie('_float-layer-app-close', 1); 403 // window.setCookie('_float-layer-app-close', 1);
370 404
371 if (parseInt(appClose) === 0) { 405 if (parseInt(appClose) === 0) {
372 - window.setCookie('_float-layer-app-close', 1); 406 + setCookie('_float-layer-app-close', 1, {expires: -1});
  407 +
373 } else if (parseInt(appClose) === 1) { 408 } else if (parseInt(appClose) === 1) {
374 - window.setCookie('_float-layer-app-close', 2); 409 + setCookie('_float-layer-app-close', 2, {expires: -1});
375 } 410 }
376 411
377 $('#float-layer-app').hide(); 412 $('#float-layer-app').hide();