Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_saveToBrowser: function () {
var flag = true;
try {
oIeOffline.setAttribute(TIME_DEADLINE, Json.stringify(oDeadline));
oIeOffline.setAttribute(SINGLE_KEY, Json.stringify(oGlobal));
oIeOffline.save(IE_OFFLINE);
} catch (e) {
// 磁盘已满或权限不足等问题
flag = false;
}
return flag;
}
}); //re.init();
if (index > -1) {
store.splice(index, 1);
}
break;
case 'update':
id = self.get('id');
index = findById(store, id);
if (index > -1) {
store[index] = self.toJSON();
}
break;
}
if (method !== 'read' && window.localStorage) {
try {
window.localStorage.setItem(KEY, Json.stringify(store));
} catch (e) {
// QUOTA_EXCEEDED_ERR
S.log(e, 'error');
}
}
STORE = store;
if (error) {
if (options.error) {
options.error(null, error);
}
}
else if (options.success) {
options.success(ret);
_saveDeadLine: function () {
ls.setItem(DEADLINE_KEY, Json.stringify(oDeadline));
}
}); //re.init();
_saveDeadLine: function () {
ls.setItem(DEADLINE_KEY, Json.stringify(oDeadline));
}
}); //re.init();
usedByte: function () {
var tempLen = 0, strDeadLine = Json.stringify(oDeadline);
//deadline不存在
if (oDeadline !== '') {
tempLen += strDeadLine.length + TIME_DEADLINE.length;
}
tempLen += Json.stringify(oGlobal).length;
return tempLen;
},
getAll: function (isObject) {
usedByte: function () {
var tempLen = this.getAll().length;
//统计时间的key有可能还没有
if (ls[DEADLINE_KEY]) {
tempLen += Json.stringify(oDeadline).length;
tempLen += DEADLINE_KEY.length;
}
return tempLen;
},
/**
getAll: function (isObject) {
var len = ls.length, oTemp = {}, key;
for (i = 0; i < len; i++) {
key = ls.key(i);
oTemp[key] = ls.getItem(key);
if (key === DEADLINE_KEY) {
delete oTemp[key];
}
}
if (isObject) {
return oTemp;
}
return Json.stringify(oTemp);
},
timeRemain: function (key) {
getAll: function (isObject) {
if (isObject) {
return oGlobal;
}
return Json.stringify(oGlobal);
},
/**
draft = drafts[i];
tip = (draft.auto ? '\u81EA\u52A8' : '\u624B\u52A8') + '\u4FDD\u5B58\u4E8E : ' + date(draft.date);
versions.addItem({
content: tip,
value: i
});
}
if (!drafts.length) {
versions.addItem({
disabled: true,
content: '\u5C1A\u65E0\u5386\u53F2',
value: ''
});
}
timeTip.html(tip);
localStorage.setItem(self._getSaveKey(), localStorage === window.localStorage ? encodeURIComponent(Json.stringify(drafts)) : drafts);
},
save: function (auto) {
usedByte: function () {
var tempLen = 0, strDeadLine = Json.stringify(oDeadline);
//deadline不存在
if (oDeadline !== '') {
tempLen += strDeadLine.length + TIME_DEADLINE.length;
}
tempLen += Json.stringify(oGlobal).length;
return tempLen;
},
getAll: function (isObject) {