Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jio-main
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Hardik Juneja
jio-main
Commits
b5f2b208
Commit
b5f2b208
authored
Dec 24, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
removing dependency localorcookiestorage
parent
818282cd
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
19 deletions
+55
-19
src/jio.storage/intro.js
src/jio.storage/intro.js
+1
-1
src/jio.storage/outro.js
src/jio.storage/outro.js
+1
-1
src/jio/activityUpdater.js
src/jio/activityUpdater.js
+1
-2
src/jio/intro.js
src/jio/intro.js
+36
-1
src/jio/jio.outro.js
src/jio/jio.outro.js
+2
-2
src/jio/jobs/jobManager.js
src/jio/jobs/jobManager.js
+10
-10
src/jio/outro.js
src/jio/outro.js
+4
-2
No files found.
src/jio.storage/intro.js
View file @
b5f2b208
...
...
@@ -9,4 +9,4 @@
*
* @module JIOStorages
*/
(
function
(
LocalOrCookieStorage
,
$
,
Base64
,
sjcl
,
hex_sha256
,
jIO
)
{
(
function
(
jIO
,
$
,
Base64
,
sjcl
,
hex_sha256
)
{
src/jio.storage/outro.js
View file @
b5f2b208
}(
LocalOrCookieStorage
,
jQuery
,
Base64
,
sjcl
,
hex_sha256
,
jIO
));
}(
jIO
,
jQuery
,
Base64
,
sjcl
,
hex_sha256
));
src/jio/activityUpdater.js
View file @
b5f2b208
...
...
@@ -14,7 +14,7 @@ var activityUpdater = (function(spec, my) {
* @method touch
*/
priv
.
touch
=
function
()
{
LocalOrCookieS
torage
.
setItem
(
'
jio/id/
'
+
priv
.
id
,
Date
.
now
());
locals
torage
.
setItem
(
'
jio/id/
'
+
priv
.
id
,
Date
.
now
());
};
/**
...
...
@@ -72,4 +72,3 @@ var activityUpdater = (function(spec, my) {
return
that
;
}());
src/jio/intro.js
View file @
b5f2b208
var
jIO
=
(
function
(
)
{
(
function
(
scope
,
hex_md5
)
{
"
use strict
"
;
var
localstorage
;
if
(
typeof
localStorage
!==
"
undefined
"
)
{
localstorage
=
{
getItem
:
function
(
item
)
{
return
JSON
.
parse
(
localStorage
.
getItem
(
item
));
},
setItem
:
function
(
item
,
value
)
{
return
localStorage
.
setItem
(
item
,
JSON
.
stringify
(
value
));
},
deleteItem
:
function
(
item
)
{
delete
localStorage
[
item
];
},
clone
:
function
()
{
return
JSON
.
parse
(
JSON
.
stringify
(
localStorage
));
}
};
}
else
{
(
function
()
{
var
pseudo_localStorage
=
{};
localstorage
=
{
getItem
:
function
(
item
)
{
return
JSON
.
parse
(
pseudo_localStorage
[
item
]);
},
setItem
:
function
(
item
,
value
)
{
return
pseudo_localStorage
[
item
]
=
JSON
.
stringify
(
value
);
},
deleteItem
:
function
(
item
)
{
delete
pseudo_localStorage
[
item
];
},
clone
:
function
()
{
return
JSON
.
parse
(
JSON
.
stringify
(
pseudo_localStorage
));
}
};
}());
}
src/jio/jio.outro.js
View file @
b5f2b208
...
...
@@ -12,7 +12,7 @@
// Initialize the jio id and add the new id to the list
if
(
priv
.
id
===
null
)
{
var
i
,
jio_id_a
=
LocalOrCookieS
torage
.
getItem
(
jio_id_array_name
)
||
[];
locals
torage
.
getItem
(
jio_id_array_name
)
||
[];
priv
.
id
=
1
;
for
(
i
=
0
;
i
<
jio_id_a
.
length
;
i
+=
1
)
{
if
(
jio_id_a
[
i
]
>=
priv
.
id
)
{
...
...
@@ -20,7 +20,7 @@
}
}
jio_id_a
.
push
(
priv
.
id
);
LocalOrCookieS
torage
.
setItem
(
jio_id_array_name
,
jio_id_a
);
locals
torage
.
setItem
(
jio_id_array_name
,
jio_id_a
);
activityUpdater
.
setId
(
priv
.
id
);
jobManager
.
setId
(
priv
.
id
);
}
...
...
src/jio/jobs/jobManager.js
View file @
b5f2b208
...
...
@@ -25,7 +25,7 @@ var jobManager = (function(spec) {
* @return {array} The job array.
*/
priv
.
getJobArray
=
function
()
{
return
LocalOrCookieS
torage
.
getItem
(
priv
.
getJobArrayName
())
||
[];
return
locals
torage
.
getItem
(
priv
.
getJobArrayName
())
||
[];
};
/**
...
...
@@ -37,7 +37,7 @@ var jobManager = (function(spec) {
for
(
i
=
0
;
i
<
priv
.
job_array
.
length
;
i
+=
1
)
{
new_a
.
push
(
priv
.
job_array
[
i
].
serialized
());
}
LocalOrCookieS
torage
.
setItem
(
priv
.
getJobArrayName
(),
new_a
);
locals
torage
.
setItem
(
priv
.
getJobArrayName
(),
new_a
);
};
/**
...
...
@@ -90,7 +90,7 @@ var jobManager = (function(spec) {
clearInterval
(
priv
.
interval_id
);
priv
.
interval_id
=
null
;
if
(
priv
.
job_array
.
length
===
0
)
{
LocalOrCookieS
torage
.
deleteItem
(
priv
.
getJobArrayName
());
locals
torage
.
deleteItem
(
priv
.
getJobArrayName
());
}
}
};
...
...
@@ -105,7 +105,7 @@ var jobManager = (function(spec) {
var
i
,
jio_id_a
;
priv
.
lastrestore
=
priv
.
lastrestore
||
0
;
if
(
priv
.
lastrestore
>
(
Date
.
now
())
-
2000
)
{
return
;
}
jio_id_a
=
LocalOrCookieS
torage
.
getItem
(
'
jio/id_array
'
)
||
[];
jio_id_a
=
locals
torage
.
getItem
(
'
jio/id_array
'
)
||
[];
for
(
i
=
0
;
i
<
jio_id_a
.
length
;
i
+=
1
)
{
priv
.
restoreOldJioId
(
jio_id_a
[
i
]);
}
...
...
@@ -119,7 +119,7 @@ var jobManager = (function(spec) {
*/
priv
.
restoreOldJioId
=
function
(
id
)
{
var
jio_date
;
jio_date
=
LocalOrCookieS
torage
.
getItem
(
'
jio/id/
'
+
id
)
||
0
;
jio_date
=
locals
torage
.
getItem
(
'
jio/id/
'
+
id
)
||
0
;
if
(
new
Date
(
jio_date
).
getTime
()
<
(
Date
.
now
()
-
10000
))
{
// 10 sec
priv
.
restoreOldJobFromJioId
(
id
);
priv
.
removeOldJioId
(
id
);
...
...
@@ -134,7 +134,7 @@ var jobManager = (function(spec) {
*/
priv
.
restoreOldJobFromJioId
=
function
(
id
)
{
var
i
,
jio_job_array
;
jio_job_array
=
LocalOrCookieS
torage
.
getItem
(
'
jio/job_array/
'
+
id
)
||
[];
jio_job_array
=
locals
torage
.
getItem
(
'
jio/job_array/
'
+
id
)
||
[];
for
(
i
=
0
;
i
<
jio_job_array
.
length
;
i
+=
1
)
{
var
command_object
=
command
(
jio_job_array
[
i
].
command
);
if
(
command_object
.
canBeRestored
())
{
...
...
@@ -152,14 +152,14 @@ var jobManager = (function(spec) {
*/
priv
.
removeOldJioId
=
function
(
id
)
{
var
i
,
jio_id_array
,
new_array
=
[];
jio_id_array
=
LocalOrCookieS
torage
.
getItem
(
'
jio/id_array
'
)
||
[];
jio_id_array
=
locals
torage
.
getItem
(
'
jio/id_array
'
)
||
[];
for
(
i
=
0
;
i
<
jio_id_array
.
length
;
i
+=
1
)
{
if
(
jio_id_array
[
i
]
!==
id
)
{
new_array
.
push
(
jio_id_array
[
i
]);
}
}
LocalOrCookieS
torage
.
setItem
(
'
jio/id_array
'
,
new_array
);
LocalOrCookieS
torage
.
deleteItem
(
'
jio/id/
'
+
id
);
locals
torage
.
setItem
(
'
jio/id_array
'
,
new_array
);
locals
torage
.
deleteItem
(
'
jio/id/
'
+
id
);
};
/**
...
...
@@ -168,7 +168,7 @@ var jobManager = (function(spec) {
* @param {number} id The jio id.
*/
priv
.
removeJobArrayFromJioId
=
function
(
id
)
{
LocalOrCookieS
torage
.
deleteItem
(
'
jio/job_array/
'
+
id
);
locals
torage
.
deleteItem
(
'
jio/job_array/
'
+
id
);
};
/**
...
...
src/jio/outro.js
View file @
b5f2b208
return
jioNamespace
;
}());
Object
.
defineProperty
(
scope
,
"
jIO
"
,{
configurable
:
false
,
enumerable
:
false
,
writable
:
false
,
value
:
jioNamespace
});
}(
window
,
hex_md5
));
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