Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
renderjs
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
Cédric Le Ninivin
renderjs
Commits
019e4382
Commit
019e4382
authored
Jun 04, 2013
by
Romain Courteaud
🐸
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Handle sessionStorage
parent
5c0641ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
5 deletions
+51
-5
renderjs.js
renderjs.js
+51
-5
No files found.
renderjs.js
View file @
019e4382
...
@@ -1082,8 +1082,11 @@
...
@@ -1082,8 +1082,11 @@
dispatch
=
function
()
{
dispatch
=
function
()
{
// XXX Local hack
// XXX Local hack
var
ls_regexp
=
/^browser:
\/\/
localstorage
\/([\w\W]
+
)
/
,
var
ls_regexp
=
/^browser:
\/\/
localstorage
\/([\w\W]
+
)
/
,
browse_file_regexp
=
/^browser:
\/\/
browse
\/
ls
\/([\w\W]
+
)
/
,
browse_ls_file_regexp
=
/^browser:
\/\/
browse
\/
ls
\/([\w\W]
+
)
/
,
browse_directory_regexp
=
/^browser:
\/\/
browse
\/
ls
\/
/
,
browse_ls_directory_regexp
=
/^browser:
\/\/
browse
\/
ls
\/
/
,
ss_regexp
=
/^browser:
\/\/
sessionstorage
\/([\w\W]
+
)
/
,
browse_ss_file_regexp
=
/^browser:
\/\/
browse
\/
ss
\/([\w\W]
+
)
/
,
browse_ss_directory_regexp
=
/^browser:
\/\/
browse
\/
ss
\/
/
,
plumb_regexp
=
/^browser:
\/\/
plumb
\/([\w\W]
+
)\/
/
,
plumb_regexp
=
/^browser:
\/\/
plumb
\/([\w\W]
+
)\/
/
,
key
;
key
;
if
(
ls_regexp
.
test
(
this
.
url
))
{
if
(
ls_regexp
.
test
(
this
.
url
))
{
...
@@ -1101,8 +1104,8 @@
...
@@ -1101,8 +1104,8 @@
}
else
{
}
else
{
this
.
respond
(
405
,
{},
""
);
this
.
respond
(
405
,
{},
""
);
}
}
}
else
if
(
browse_file_regexp
.
test
(
this
.
url
))
{
}
else
if
(
browse_
ls_
file_regexp
.
test
(
this
.
url
))
{
key
=
browse_file_regexp
.
exec
(
this
.
url
)[
1
];
key
=
browse_
ls_
file_regexp
.
exec
(
this
.
url
)[
1
];
this
.
respond
(
200
,
{
this
.
respond
(
200
,
{
'
Content-Type
'
:
'
application/hal+json
'
'
Content-Type
'
:
'
application/hal+json
'
},
JSON
.
stringify
({
},
JSON
.
stringify
({
...
@@ -1111,7 +1114,7 @@
...
@@ -1111,7 +1114,7 @@
enclosure
:
{
href
:
'
browser://localstorage/
'
+
key
},
enclosure
:
{
href
:
'
browser://localstorage/
'
+
key
},
}
}
}));
}));
}
else
if
(
browse_directory_regexp
.
test
(
this
.
url
))
{
}
else
if
(
browse_
ls_
directory_regexp
.
test
(
this
.
url
))
{
var
response
=
{
var
response
=
{
_links
:
{
_links
:
{
self
:
{
href
:
this
.
url
},
self
:
{
href
:
this
.
url
},
...
@@ -1126,6 +1129,49 @@
...
@@ -1126,6 +1129,49 @@
this
.
respond
(
200
,
{
this
.
respond
(
200
,
{
'
Content-Type
'
:
'
application/hal+json
'
'
Content-Type
'
:
'
application/hal+json
'
},
JSON
.
stringify
(
response
));
},
JSON
.
stringify
(
response
));
}
else
if
(
ss_regexp
.
test
(
this
.
url
))
{
key
=
ss_regexp
.
exec
(
this
.
url
)[
1
];
if
(
this
.
method
===
"
POST
"
)
{
sessionStorage
[
key
]
=
this
.
requestBody
;
this
.
respond
(
200
,
{},
""
);
}
else
if
(
this
.
method
===
"
GET
"
)
{
this
.
respond
(
200
,
{
"
Content-Type
"
:
"
text/plain
"
},
sessionStorage
[
key
]);
}
else
if
(
this
.
method
===
"
DELETE
"
)
{
sessionStorage
.
removeItem
(
key
);
this
.
respond
(
200
,
{},
""
);
}
else
{
this
.
respond
(
405
,
{},
""
);
}
}
else
if
(
browse_ss_file_regexp
.
test
(
this
.
url
))
{
key
=
browse_ss_file_regexp
.
exec
(
this
.
url
)[
1
];
this
.
respond
(
200
,
{
'
Content-Type
'
:
'
application/hal+json
'
},
JSON
.
stringify
({
_links
:
{
self
:
{
href
:
this
.
url
},
enclosure
:
{
href
:
'
browser://locasstorage/
'
+
key
},
}
}));
}
else
if
(
browse_ss_directory_regexp
.
test
(
this
.
url
))
{
var
response
=
{
_links
:
{
self
:
{
href
:
this
.
url
},
contents
:
[],
}
};
for
(
var
key
in
sessionStorage
){
response
.
_links
.
contents
.
push
({
href
:
'
browser://browse/ss/
'
+
key
});
}
this
.
respond
(
200
,
{
'
Content-Type
'
:
'
application/hal+json
'
},
JSON
.
stringify
(
response
));
}
else
if
(
plumb_regexp
.
test
(
this
.
url
))
{
}
else
if
(
plumb_regexp
.
test
(
this
.
url
))
{
key
=
plumb_regexp
.
exec
(
this
.
url
)[
1
];
key
=
plumb_regexp
.
exec
(
this
.
url
)[
1
];
if
(
this
.
method
===
"
POST
"
)
{
if
(
this
.
method
===
"
POST
"
)
{
...
...
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