Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
4880ef9e
Commit
4880ef9e
authored
May 21, 2012
by
Tristan Cavelier
Committed by
Sebastien Robin
Jun 07, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve replicate storage get list + change officejs storage + grunt ok
parent
da79424c
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
70 additions
and
67 deletions
+70
-67
OfficeJS/index.html
OfficeJS/index.html
+2
-1
OfficeJS/js/officejs.js
OfficeJS/js/officejs.js
+1
-1
OfficeJS/lib/jio/jio.js
OfficeJS/lib/jio/jio.js
+14
-15
OfficeJS/lib/jio/jio.min.js
OfficeJS/lib/jio/jio.min.js
+2
-2
OfficeJS/lib/jio/jio.storage.js
OfficeJS/lib/jio/jio.storage.js
+18
-18
OfficeJS/lib/jio/jio.storage.min.js
OfficeJS/lib/jio/jio.storage.min.js
+2
-2
OfficeJS/lib/jio/localorcookiestorage.js
OfficeJS/lib/jio/localorcookiestorage.js
+10
-10
OfficeJS/lib/jio/localorcookiestorage.min.js
OfficeJS/lib/jio/localorcookiestorage.min.js
+2
-2
OfficeJS/src/jio.storage.js
OfficeJS/src/jio.storage.js
+9
-9
OfficeJS/src/localorcookiestorage.js
OfficeJS/src/localorcookiestorage.js
+1
-1
OfficeJS/test/jiotests.js
OfficeJS/test/jiotests.js
+9
-6
No files found.
OfficeJS/index.html
View file @
4880ef9e
...
@@ -40,8 +40,9 @@
...
@@ -40,8 +40,9 @@
<
div
class
=
"
controls docs-input-sizes
"
>
<
div
class
=
"
controls docs-input-sizes
"
>
<
input
class
=
"
input-xlarge
"
<
input
class
=
"
input-xlarge
"
type
=
"
text
"
name
=
"
JSONstorage
"
id
=
"
input_json_storage
"
type
=
"
text
"
name
=
"
JSONstorage
"
id
=
"
input_json_storage
"
value
=
"
{"type":"
local","userName":"tristan"
}
"
value
=
"
{"type":"
replicate","storageArray":[{"type":"local","userName":"tristan"},{"type":"dav","userName":"tristan","password":"mdp","location":"http://localhost:80"}]
}
"
placeholder
=
"
storage
"
/>
placeholder
=
"
storage
"
/>
<!--
value
=
"
{"type":"local","userName":"tristan"}
"
-->
<
/div
>
<
/div
>
<
label
class
=
"
control-label
"
<
label
class
=
"
control-label
"
for
=
"
JSONapplicantID
"
>
for
=
"
JSONapplicantID
"
>
...
...
OfficeJS/js/officejs.js
View file @
4880ef9e
...
@@ -10,7 +10,7 @@ require.config ({
...
@@ -10,7 +10,7 @@ require.config ({
JIO
:
'
../src/jio
'
,
JIO
:
'
../src/jio
'
,
Base64API
:
'
../lib/base64/base64
'
,
Base64API
:
'
../lib/base64/base64
'
,
Base64
:
'
../js/base64.requirejs_module
'
,
Base64
:
'
../js/base64.requirejs_module
'
,
JIOStorages
:
'
../
lib/jio/jio.storage.min
'
,
JIOStorages
:
'
../
src/jio.storage
'
,
OfficeJS
:
'
moduleloader
'
OfficeJS
:
'
moduleloader
'
}
}
...
...
OfficeJS/lib/jio/jio.js
View file @
4880ef9e
/*! JIO - v0.1.0 - 2012-05-
18
/*! JIO - v0.1.0 - 2012-05-
21
* Copyright (c) 2012 Nexedi; Licensed */
* Copyright (c) 2012 Nexedi; Licensed */
...
@@ -261,10 +261,7 @@ var JIO =
...
@@ -261,10 +261,7 @@ var JIO =
// options.jioID : the jio ID
// options.jioID : the jio ID
var
k
,
emptyfun
=
function
(){},
var
k
,
emptyfun
=
function
(){},
jioIdArray
=
jioGlobalObj
.
localStorage
.
getItem
(
jioIdArrayName
);
jioIdArray
=
jioGlobalObj
.
localStorage
.
getItem
(
jioIdArrayName
)
||
[];
if
(
jioIdArray
===
null
)
{
jioIdArray
=
[];
}
if
(
options
.
publisher
)
{
if
(
options
.
publisher
)
{
priv
.
publisher
=
publisher
;
priv
.
publisher
=
publisher
;
}
}
...
@@ -292,8 +289,8 @@ var JIO =
...
@@ -292,8 +289,8 @@ var JIO =
// Returns a new queueID
// Returns a new queueID
var
k
=
null
,
id
=
0
,
var
k
=
null
,
id
=
0
,
jioIdArray
=
jioGlobalObj
.
localStorage
.
getItem
(
jioIdArrayName
);
jioIdArray
=
jioGlobalObj
.
localStorage
.
getItem
(
jioIdArrayName
)
||
[]
;
for
(
k
in
jioIdArray
)
{
for
(
k
=
0
;
k
<
jioIdArray
.
length
;
k
+=
1
)
{
if
(
jioIdArray
[
k
]
>=
jioGlobalObj
.
queueID
)
{
if
(
jioIdArray
[
k
]
>=
jioGlobalObj
.
queueID
)
{
jioGlobalObj
.
queueID
=
jioIdArray
[
k
]
+
1
;
jioGlobalObj
.
queueID
=
jioIdArray
[
k
]
+
1
;
}
}
...
@@ -306,8 +303,8 @@ var JIO =
...
@@ -306,8 +303,8 @@ var JIO =
// recover job object from older inactive jio
// recover job object from older inactive jio
var
k
=
null
,
newJioIdArray
=
[],
jioIdArrayChanged
=
false
,
var
k
=
null
,
newJioIdArray
=
[],
jioIdArrayChanged
=
false
,
jioIdArray
=
jioGlobalObj
.
localStorage
.
getItem
(
jioIdArrayName
);
jioIdArray
=
jioGlobalObj
.
localStorage
.
getItem
(
jioIdArrayName
)
||
[]
;
for
(
k
in
jioIdArray
)
{
for
(
k
=
0
;
k
<
jioIdArray
.
length
;
k
+=
1
)
{
if
(
jioGlobalObj
.
localStorage
.
getItem
(
if
(
jioGlobalObj
.
localStorage
.
getItem
(
'
jio/id/
'
+
jioIdArray
[
k
])
<
Date
.
now
()
-
10000
)
{
'
jio/id/
'
+
jioIdArray
[
k
])
<
Date
.
now
()
-
10000
)
{
// remove id from jioIdArray
// remove id from jioIdArray
...
@@ -408,7 +405,7 @@ var JIO =
...
@@ -408,7 +405,7 @@ var JIO =
if
(
res
.
newone
)
{
if
(
res
.
newone
)
{
// if it is a new job, we can eliminate deprecated jobs and
// if it is a new job, we can eliminate deprecated jobs and
// set this job dependencies.
// set this job dependencies.
for
(
id
in
res
.
elimArray
)
{
for
(
id
=
0
;
id
<
res
.
elimArray
.
length
;
id
+=
1
)
{
basestorage
=
new
BaseStorage
(
basestorage
=
new
BaseStorage
(
{
'
queue
'
:
that
,
'
job
'
:
priv
.
jobObject
[
res
.
elimArray
[
id
]]});
{
'
queue
'
:
that
,
'
job
'
:
priv
.
jobObject
[
res
.
elimArray
[
id
]]});
basestorage
.
eliminate
();
basestorage
.
eliminate
();
...
@@ -416,13 +413,13 @@ var JIO =
...
@@ -416,13 +413,13 @@ var JIO =
if
(
res
.
waitArray
.
length
>
0
)
{
if
(
res
.
waitArray
.
length
>
0
)
{
job
.
status
=
'
wait
'
;
job
.
status
=
'
wait
'
;
job
.
waitingFor
=
{
'
jobIdArray
'
:
res
.
waitArray
};
job
.
waitingFor
=
{
'
jobIdArray
'
:
res
.
waitArray
};
for
(
id
in
res
.
waitArray
)
{
for
(
id
=
0
;
id
<
res
.
waitArray
.
length
;
id
+=
1
)
{
if
(
priv
.
jobObject
[
res
.
waitArray
[
id
]])
{
if
(
priv
.
jobObject
[
res
.
waitArray
[
id
]])
{
priv
.
jobObject
[
res
.
waitArray
[
id
]].
maxtries
=
1
;
priv
.
jobObject
[
res
.
waitArray
[
id
]].
maxtries
=
1
;
}
}
}
}
}
}
for
(
id
in
res
.
removeArray
)
{
for
(
id
=
0
;
id
<
res
.
removeArray
.
length
;
id
+=
1
)
{
that
.
removeJob
(
priv
.
jobObject
[
res
.
removeArray
[
id
]]);
that
.
removeJob
(
priv
.
jobObject
[
res
.
removeArray
[
id
]]);
}
}
// set job id
// set job id
...
@@ -484,7 +481,7 @@ var JIO =
...
@@ -484,7 +481,7 @@ var JIO =
that
.
invokeAll
=
function
()
{
that
.
invokeAll
=
function
()
{
// Do all jobs in the queue.
// Do all jobs in the queue.
var
i
=
'
id
'
,
ok
;
var
i
=
'
id
'
,
j
,
ok
;
//// do All jobs
//// do All jobs
for
(
i
in
priv
.
jobObject
)
{
for
(
i
in
priv
.
jobObject
)
{
ok
=
false
;
ok
=
false
;
...
@@ -498,7 +495,9 @@ var JIO =
...
@@ -498,7 +495,9 @@ var JIO =
if
(
priv
.
jobObject
[
i
].
waitingFor
.
jobIdArray
)
{
if
(
priv
.
jobObject
[
i
].
waitingFor
.
jobIdArray
)
{
// wait job
// wait job
// browsing job id array
// browsing job id array
for
(
var
j
in
priv
.
jobObject
[
i
].
waitingFor
.
jobIdArray
)
{
for
(
j
=
0
;
j
<
priv
.
jobObject
[
i
].
waitingFor
.
jobIdArray
.
length
;
j
+=
1
)
{
if
(
priv
.
jobObject
[
priv
.
jobObject
[
i
].
if
(
priv
.
jobObject
[
priv
.
jobObject
[
i
].
waitingFor
.
jobIdArray
[
j
]])
{
waitingFor
.
jobIdArray
[
j
]])
{
// if a job is still exist, don't invoke
// if a job is still exist, don't invoke
...
@@ -746,7 +745,7 @@ var JIO =
...
@@ -746,7 +745,7 @@ var JIO =
var
i
;
var
i
;
priv
.
res
.
message
=
'
Document list received.
'
;
priv
.
res
.
message
=
'
Document list received.
'
;
priv
.
res
.
list
=
documentlist
;
priv
.
res
.
list
=
documentlist
;
for
(
i
in
priv
.
res
.
list
)
{
for
(
i
=
0
;
i
<
priv
.
res
.
list
.
length
;
i
+=
1
)
{
priv
.
res
.
list
[
i
].
lastModified
=
priv
.
res
.
list
[
i
].
lastModified
=
new
Date
(
priv
.
res
.
list
[
i
].
lastModified
).
getTime
();
new
Date
(
priv
.
res
.
list
[
i
].
lastModified
).
getTime
();
priv
.
res
.
list
[
i
].
creationDate
=
priv
.
res
.
list
[
i
].
creationDate
=
...
...
OfficeJS/lib/jio/jio.min.js
View file @
4880ef9e
This diff is collapsed.
Click to expand it.
OfficeJS/lib/jio/jio.storage.js
View file @
4880ef9e
/*! JIO Storage - v0.1.0 - 2012-05-
18
/*! JIO Storage - v0.1.0 - 2012-05-
21
* Copyright (c) 2012 Nexedi; Licensed */
* Copyright (c) 2012 Nexedi; Licensed */
...
@@ -45,11 +45,11 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
...
@@ -45,11 +45,11 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// wait a little in order to simulate asynchronous operation
// wait a little in order to simulate asynchronous operation
setTimeout
(
function
()
{
setTimeout
(
function
()
{
var
localStorageObject
=
null
;
var
localStorageObject
=
null
,
k
,
splitk
;
localStorageObject
=
LocalOrCookieStorage
.
getAll
();
localStorageObject
=
LocalOrCookieStorage
.
getAll
();
for
(
var
k
in
localStorageObject
)
{
for
(
k
in
localStorageObject
)
{
var
splitk
=
k
.
split
(
'
/
'
);
splitk
=
k
.
split
(
'
/
'
);
if
(
splitk
[
0
]
===
'
jio
'
&&
if
(
splitk
[
0
]
===
'
jio
'
&&
splitk
[
1
]
===
'
local
'
&&
splitk
[
1
]
===
'
local
'
&&
splitk
[
2
]
===
that
.
getUserName
())
{
splitk
[
2
]
===
that
.
getUserName
())
{
...
@@ -525,7 +525,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
...
@@ -525,7 +525,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
}
};
};
for
(
i
in
priv
.
storageArray
)
{
for
(
i
=
0
;
i
<
priv
.
storageArray
.
length
;
i
+=
1
)
{
newjob
=
that
.
cloneJob
();
newjob
=
that
.
cloneJob
();
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
storage
=
priv
.
storageArray
[
i
];
newjob
.
storage
=
priv
.
storageArray
[
i
];
...
@@ -560,7 +560,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
...
@@ -560,7 +560,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
}
};
};
for
(
i
in
priv
.
storageArray
)
{
for
(
i
=
0
;
i
<
priv
.
storageArray
.
length
;
i
+=
1
)
{
newjob
=
that
.
cloneJob
();
newjob
=
that
.
cloneJob
();
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
storage
=
priv
.
storageArray
[
i
];
newjob
.
storage
=
priv
.
storageArray
[
i
];
...
@@ -633,7 +633,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
...
@@ -633,7 +633,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
}
};
};
for
(
i
in
priv
.
storageArray
)
{
for
(
i
=
0
;
i
<
priv
.
storageArray
.
length
;
i
+=
1
)
{
newjob
=
that
.
cloneJob
();
newjob
=
that
.
cloneJob
();
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
storage
=
priv
.
storageArray
[
i
];
newjob
.
storage
=
priv
.
storageArray
[
i
];
...
@@ -655,23 +655,23 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
...
@@ -655,23 +655,23 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// 'lastModified':date,'creationDate':date}
// 'lastModified':date,'creationDate':date}
// TODO
// TODO
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
done
=
false
,
callback
=
function
(
result
)
{
callback
=
function
(
result
)
{
priv
.
returnsValuesArray
.
push
(
result
);
priv
.
returnsValuesArray
.
push
(
result
);
if
(
result
.
status
===
'
fail
'
)
{
if
(
!
done
)
{
res
.
status
=
'
fail
'
;
if
(
result
.
status
!==
'
fail
'
)
{
}
that
.
done
(
result
.
list
);
if
(
priv
.
returnsValuesArray
.
length
===
priv
.
length
)
{
done
=
true
;
// if this is the last callback
if
(
res
.
status
===
'
fail
'
)
{
that
.
fail
(
'
Unable retrieve all lists.
'
,
0
);
}
else
{
}
else
{
that
.
done
(
result
.
list
);
if
(
priv
.
returnsValuesArray
.
length
===
priv
.
length
)
{
that
.
fail
(
'
Unable to retrieve list.
'
,
0
);
}
}
}
}
}
};
};
for
(
i
in
priv
.
storageArray
)
{
for
(
i
=
0
;
i
<
priv
.
storageArray
.
length
;
i
+=
1
)
{
newjob
=
that
.
cloneJob
();
newjob
=
that
.
cloneJob
();
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
storage
=
priv
.
storageArray
[
i
];
newjob
.
storage
=
priv
.
storageArray
[
i
];
...
@@ -706,7 +706,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
...
@@ -706,7 +706,7 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
}
}
};
};
for
(
i
in
priv
.
storageArray
)
{
for
(
i
=
0
;
i
<
priv
.
storageArray
.
length
;
i
+=
1
)
{
newjob
=
that
.
cloneJob
();
newjob
=
that
.
cloneJob
();
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
maxtries
=
priv
.
maxtries
;
newjob
.
storage
=
priv
.
storageArray
[
i
];
newjob
.
storage
=
priv
.
storageArray
[
i
];
...
...
OfficeJS/lib/jio/jio.storage.min.js
View file @
4880ef9e
This diff is collapsed.
Click to expand it.
OfficeJS/lib/jio/localorcookiestorage.js
View file @
4880ef9e
/*! Local Or Cookie Storage - v0.1.0 - 2012-05-
18
/*! Local Or Cookie Storage - v0.1.0 - 2012-05-
21
* Copyright (c) 2012 Nexedi; Licensed */
* Copyright (c) 2012 Nexedi; Licensed */
var
LocalOrCookieStorage
=
var
LocalOrCookieStorage
=
...
@@ -43,10 +43,10 @@ var LocalOrCookieStorage =
...
@@ -43,10 +43,10 @@ var LocalOrCookieStorage =
};
};
CookieStorage
.
prototype
=
{
CookieStorage
.
prototype
=
{
getItem
:
function
(
name
)
{
getItem
:
function
(
name
)
{
var
cookies
=
document
.
cookie
.
split
(
'
;
'
);
var
cookies
=
document
.
cookie
.
split
(
'
;
'
)
,
i
;
for
(
var
i
in
cookies
)
{
for
(
i
=
0
;
i
<
cookies
.
length
;
i
+=
1
)
{
var
x
=
cookies
[
i
].
substr
(
0
,
cookies
[
i
].
indexOf
(
'
=
'
))
;
var
x
=
cookies
[
i
].
substr
(
0
,
cookies
[
i
].
indexOf
(
'
=
'
))
,
var
y
=
cookies
[
i
].
substr
(
cookies
[
i
].
indexOf
(
'
=
'
)
+
1
);
y
=
cookies
[
i
].
substr
(
cookies
[
i
].
indexOf
(
'
=
'
)
+
1
);
x
=
x
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
x
=
x
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
if
(
x
===
name
)
{
return
unescape
(
y
);
}
if
(
x
===
name
)
{
return
unescape
(
y
);
}
}
}
...
@@ -63,11 +63,11 @@ var LocalOrCookieStorage =
...
@@ -63,11 +63,11 @@ var LocalOrCookieStorage =
return
false
;
return
false
;
},
},
getAll
:
function
()
{
getAll
:
function
()
{
var
retObject
=
{}
;
var
retObject
=
{}
,
i
,
var
cookies
=
document
.
cookie
.
split
(
'
:
'
);
cookies
=
document
.
cookie
.
split
(
'
:
'
);
for
(
var
i
in
cookies
)
{
for
(
i
=
0
;
i
<
cookies
.
length
;
i
+=
1
)
{
var
x
=
cookies
[
i
].
substr
(
0
,
cookies
[
i
].
indexOf
(
'
=
'
))
;
var
x
=
cookies
[
i
].
substr
(
0
,
cookies
[
i
].
indexOf
(
'
=
'
))
,
var
y
=
cookies
[
i
].
substr
(
cookies
[
i
].
indexOf
(
'
=
'
)
+
1
);
y
=
cookies
[
i
].
substr
(
cookies
[
i
].
indexOf
(
'
=
'
)
+
1
);
x
=
x
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
x
=
x
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
retObject
[
x
]
=
unescape
(
y
);
retObject
[
x
]
=
unescape
(
y
);
}
}
...
...
OfficeJS/lib/jio/localorcookiestorage.min.js
View file @
4880ef9e
/*! Local Or Cookie Storage - v0.1.0 - 2012-05-
18
/*! Local Or Cookie Storage - v0.1.0 - 2012-05-
21
* Copyright (c) 2012 Nexedi; Licensed */
* Copyright (c) 2012 Nexedi; Licensed */
var
LocalOrCookieStorage
=
function
(){
var
a
=
function
(){
var
a
=
function
(){};
a
.
prototype
=
{
getItem
:
function
(
a
){
return
JSON
.
parse
(
localStorage
.
getItem
(
a
))},
setItem
:
function
(
a
,
b
){
if
(
a
)
return
localStorage
.
setItem
(
a
,
JSON
.
stringify
(
b
))},
getAll
:
function
(){
return
localStorage
},
deleteItem
:
function
(
a
){
a
&&
delete
localStorage
[
a
]}};
var
b
=
function
(){};
b
.
prototype
=
{
getItem
:
function
(
a
){
var
b
=
document
.
cookie
.
split
(
"
;
"
);
for
(
var
c
in
b
){
var
d
=
b
[
c
].
substr
(
0
,
b
[
c
].
indexOf
(
"
=
"
)),
e
=
b
[
c
].
substr
(
b
[
c
].
indexOf
(
"
=
"
)
+
1
);
d
=
d
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
if
(
d
===
a
)
return
unescape
(
e
)}
return
null
},
setItem
:
function
(
a
,
b
){
return
b
!==
undefined
?(
document
.
cookie
=
a
+
"
=
"
+
JSON
.
stringify
(
b
)
+
"
;domain=
"
+
window
.
location
.
hostname
+
"
;path=
"
+
window
.
location
.
pathname
,
!
0
):
!
1
},
getAll
:
function
(){
var
a
=
{},
b
=
document
.
cookie
.
split
(
"
:
"
);
for
(
var
c
in
b
){
var
d
=
b
[
c
].
substr
(
0
,
b
[
c
].
indexOf
(
"
=
"
)),
e
=
b
[
c
].
substr
(
b
[
c
].
indexOf
(
"
=
"
)
+
1
);
d
=
d
.
replace
(
/^
\s
+|
\s
+$/g
,
""
),
a
[
d
]
=
unescape
(
e
)}
return
a
},
deleteItem
:
function
(
a
){
document
.
cookie
=
a
+
"
=null;domain=
"
+
window
.
location
.
hostname
+
"
;path=
"
+
window
.
location
.
pathname
+
"
;expires=Thu, 01-Jan-1970 00:00:01 GMT
"
}};
try
{
return
localStorage
.
getItem
?
new
a
:
new
b
}
catch
(
c
){
return
new
b
}};
return
window
.
requirejs
?(
define
(
"
LocalOrCookieStorage
"
,[],
a
),
undefined
):
a
()}();
var
LocalOrCookieStorage
=
function
(){
var
a
=
function
(){
var
a
=
function
(){};
a
.
prototype
=
{
getItem
:
function
(
a
){
return
JSON
.
parse
(
localStorage
.
getItem
(
a
))},
setItem
:
function
(
a
,
b
){
if
(
a
)
return
localStorage
.
setItem
(
a
,
JSON
.
stringify
(
b
))},
getAll
:
function
(){
return
localStorage
},
deleteItem
:
function
(
a
){
a
&&
delete
localStorage
[
a
]}};
var
b
=
function
(){};
b
.
prototype
=
{
getItem
:
function
(
a
){
var
b
=
document
.
cookie
.
split
(
"
;
"
),
c
;
for
(
c
=
0
;
c
<
b
.
length
;
c
+=
1
){
var
d
=
b
[
c
].
substr
(
0
,
b
[
c
].
indexOf
(
"
=
"
)),
e
=
b
[
c
].
substr
(
b
[
c
].
indexOf
(
"
=
"
)
+
1
);
d
=
d
.
replace
(
/^
\s
+|
\s
+$/g
,
""
);
if
(
d
===
a
)
return
unescape
(
e
)}
return
null
},
setItem
:
function
(
a
,
b
){
return
b
!==
undefined
?(
document
.
cookie
=
a
+
"
=
"
+
JSON
.
stringify
(
b
)
+
"
;domain=
"
+
window
.
location
.
hostname
+
"
;path=
"
+
window
.
location
.
pathname
,
!
0
):
!
1
},
getAll
:
function
(){
var
a
=
{},
b
,
c
=
document
.
cookie
.
split
(
"
:
"
);
for
(
b
=
0
;
b
<
c
.
length
;
b
+=
1
){
var
d
=
c
[
b
].
substr
(
0
,
c
[
b
].
indexOf
(
"
=
"
)),
e
=
c
[
b
].
substr
(
c
[
b
].
indexOf
(
"
=
"
)
+
1
);
d
=
d
.
replace
(
/^
\s
+|
\s
+$/g
,
""
),
a
[
d
]
=
unescape
(
e
)}
return
a
},
deleteItem
:
function
(
a
){
document
.
cookie
=
a
+
"
=null;domain=
"
+
window
.
location
.
hostname
+
"
;path=
"
+
window
.
location
.
pathname
+
"
;expires=Thu, 01-Jan-1970 00:00:01 GMT
"
}};
try
{
return
localStorage
.
getItem
?
new
a
:
new
b
}
catch
(
c
){
return
new
b
}};
return
window
.
requirejs
?(
define
(
"
LocalOrCookieStorage
"
,[],
a
),
undefined
):
a
()}();
\ No newline at end of file
\ No newline at end of file
OfficeJS/src/jio.storage.js
View file @
4880ef9e
...
@@ -652,18 +652,18 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
...
@@ -652,18 +652,18 @@ var jio_storage_loader = function ( LocalOrCookieStorage, Base64, Jio, $) {
// 'lastModified':date,'creationDate':date}
// 'lastModified':date,'creationDate':date}
// TODO
// TODO
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
var
newjob
=
{},
res
=
{
'
status
'
:
'
done
'
},
i
=
'
id
'
,
done
=
false
,
callback
=
function
(
result
)
{
callback
=
function
(
result
)
{
priv
.
returnsValuesArray
.
push
(
result
);
priv
.
returnsValuesArray
.
push
(
result
);
if
(
result
.
status
===
'
fail
'
)
{
if
(
!
done
)
{
res
.
status
=
'
fail
'
;
if
(
result
.
status
!==
'
fail
'
)
{
}
that
.
done
(
result
.
list
);
if
(
priv
.
returnsValuesArray
.
length
===
priv
.
length
)
{
done
=
true
;
// if this is the last callback
if
(
res
.
status
===
'
fail
'
)
{
that
.
fail
(
'
Unable retrieve all lists.
'
,
0
);
}
else
{
}
else
{
that
.
done
(
result
.
list
);
if
(
priv
.
returnsValuesArray
.
length
===
priv
.
length
)
{
that
.
fail
(
'
Unable to retrieve list.
'
,
0
);
}
}
}
}
}
};
};
...
...
OfficeJS/src/localorcookiestorage.js
View file @
4880ef9e
...
@@ -61,7 +61,7 @@ var LocalOrCookieStorage =
...
@@ -61,7 +61,7 @@ var LocalOrCookieStorage =
},
},
getAll
:
function
()
{
getAll
:
function
()
{
var
retObject
=
{},
i
,
var
retObject
=
{},
i
,
var
cookies
=
document
.
cookie
.
split
(
'
:
'
);
cookies
=
document
.
cookie
.
split
(
'
:
'
);
for
(
i
=
0
;
i
<
cookies
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
cookies
.
length
;
i
+=
1
)
{
var
x
=
cookies
[
i
].
substr
(
0
,
cookies
[
i
].
indexOf
(
'
=
'
)),
var
x
=
cookies
[
i
].
substr
(
0
,
cookies
[
i
].
indexOf
(
'
=
'
)),
y
=
cookies
[
i
].
substr
(
cookies
[
i
].
indexOf
(
'
=
'
)
+
1
);
y
=
cookies
[
i
].
substr
(
cookies
[
i
].
indexOf
(
'
=
'
)
+
1
);
...
...
OfficeJS/test/jiotests.js
View file @
4880ef9e
...
@@ -5,12 +5,15 @@
...
@@ -5,12 +5,15 @@
$
=
loader
.
jQuery
;
$
=
loader
.
jQuery
;
//// clear jio localstorage
//// clear jio localstorage
for
(
var
k
in
LocalOrCookieStorage
.
getAll
())
{
(
function
()
{
var
k
,
storageObject
=
LocalOrCookieStorage
.
getAll
();
for
(
k
in
storageObject
)
{
var
splitk
=
k
.
split
(
'
/
'
);
var
splitk
=
k
.
split
(
'
/
'
);
if
(
splitk
[
0
]
===
'
jio
'
)
{
if
(
splitk
[
0
]
===
'
jio
'
)
{
LocalOrCookieStorage
.
deleteItem
(
k
);
LocalOrCookieStorage
.
deleteItem
(
k
);
}
}
}
}
}());
//// end clear jio localstorage
//// end clear jio localstorage
//// Tools
//// Tools
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment