forked from digitalpalireader/digitalpalireader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ioc.js
124 lines (111 loc) · 3.13 KB
/
ioc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
function getColPref(name) {
return localStorage[name];
}
function getSizePref(name) {
return localStorage[name];
}
function getMiscPref(name) {
return localStorage[name];
}
function setColPref(name,val) {
localStorage.setItem(name,val);
}
function setSizePref(name,val) {
localStorage.setItem(name,val);
}
function setMiscPref(name,val) {
localStorage.setItem(name,val);
}
function readFile(aFileKey)
{
return localStorage[aFileKey];
}
function writeFile(aFileKey, aContent, aChars)
{
localStorage.setItem(aFileKey,aContent);
}
function readDir() {
var ca = [];
for (var i = 0; i < localStorage.length; i++) {
if (localStorage.key(i).substring(0,3) == "DPB" || localStorage.key(i).substring(0,3) == "DPD" || localStorage.key(i).substring(0,3) == "DPS") ca.push(localStorage.key(i));
}
return ca;
}
function eraseItem(name) {
delete localStorage["DPB"+name];
delete localStorage["DPD"+name];
delete localStorage["DPS"+name];
return false;
}
function eraseAll() {
var aKey = [];
var Key;
var aVar = [];
for (var i = 0; i < localStorage.length; i++) {
Key = localStorage.key(i);
if (Key.substring(0,3) == "DPB" || Key.substring(0,3) == "DPD" || Key.substring(0,3) == "DPS") delete localStorage[Key];
}
return false;
}
function changeName(name, nam) {
var Name = "DPB"+name;
var Des = "DPD"+name;
var Scroll = "DPS"+name;
var nName = "DPB"+nam;
var nDes = "DPD"+nam;
var nScroll = "DPS"+nam;
localStorage.setItem(nName, localStorage[Name]);
localStorage.setItem(nDes, localStorage[Des]);
localStorage.setItem(nScroll, localStorage[Scroll]);
delete localStorage[Name];
delete localStorage[Des];
delete localStorage[Scroll];
}
function removeHistory(value) {
var storeHistory = [];
for (var i = 0; i < 100; i++) {
if (localStorage['DPR_History_'+i]) {
if (localStorage['DPR_History_'+i] == value) { continue; }
storeHistory.push(localStorage['DPR_History_'+i]);
}
else break;
}
var k = 0;
for (var j in storeHistory) {
k++;
localStorage['DPR_History_'+j] = storeHistory[j];
}
delete localStorage['DPR_History_'+k];
bookmarkframe(1);
}
function clearHistory(cp) {
var answer = confirm('Are you sure you want to erase the history?');
if(!answer) { return; }
for (var i = 0; i < 100; i++) {
if (localStorage['DPR_History_'+i]) { delete localStorage['DPR_History_'+i]; }
else break;
}
if(!cp) { bookmarkframe(1); }
historyBox();
}
function getHistory() {
var sendHistory = [];
for (var i = 0; i < 100; i++) {
if (localStorage['DPR_History_'+i]) { sendHistory.push(localStorage['DPR_History_'+i]); }
else break;
}
return sendHistory;
}
function addHistory(value) {
var storeHistory = [value];
for (var i = 0; i < 100; i++) {
if (localStorage['DPR_History_'+i]) {
if (localStorage['DPR_History_'+i] == value) { continue; }
storeHistory.push(localStorage['DPR_History_'+i]);
}
else break;
}
for (var j in storeHistory) {
localStorage['DPR_History_'+j] = storeHistory[j];
}
}