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
0b8d2257
Commit
0b8d2257
authored
Jun 04, 2013
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display the list of keys in localstorage
parent
1c69f917
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
6 deletions
+33
-6
gadget/filebrowser.js
gadget/filebrowser.js
+13
-2
renderjs.js
renderjs.js
+20
-4
No files found.
gadget/filebrowser.js
View file @
0b8d2257
...
...
@@ -6,13 +6,24 @@
$
.
ajax
({
method
:
'
GET
'
,
// XXX Hardcoded
url
:
"
browser://browse
r
/ls/
"
,
url
:
"
browser://browse/ls/
"
,
context
:
$
(
'
body
'
),
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
$
(
this
).
text
(
errorThrown
);
},
success
:
function
(
value
,
textStatus
,
jqXHR
)
{
$
(
this
).
text
(
value
);
var
content_type
=
jqXHR
.
getResponseHeader
(
"
Content-Type
"
)
||
""
;
// XXX Hardcoded mime type
if
(
content_type
.
split
(
'
;
'
)[
0
]
===
"
application/hal+json
"
)
{
// XXX Will fail if response does not send expected links...
$
(
this
).
html
(
"
<ul>
"
);
for
(
var
i
in
value
.
_links
.
contents
){
$
(
this
).
append
(
"
<li>
"
+
value
.
_links
.
contents
[
i
].
href
+
"
</li>
"
);
}
$
(
this
).
append
(
"
</ul>
"
);
}
else
{
$
(
this
).
text
(
"
Unsupported content type
"
+
content_type
);
};
},
});
});
...
...
renderjs.js
View file @
0b8d2257
...
...
@@ -1053,7 +1053,8 @@
dispatch
=
function
()
{
// XXX Local hack
var
ls_regexp
=
/browser:
\/\/
localstorage
\/([\w\W]
+
)
/
,
browse_regexp
=
/browser:
\/\/
browse
\/
ls
\/([\w\W]
+
)
/
,
browse_file_regexp
=
/browser:
\/\/
browse
\/
ls
\/([\w\W]
+
)
/
,
browse_directory_regexp
=
/browser:
\/\/
browse
\/
ls
\/
/
,
key
;
if
(
ls_regexp
.
test
(
this
.
url
))
{
key
=
ls_regexp
.
exec
(
this
.
url
)[
1
];
...
...
@@ -1070,16 +1071,31 @@
}
else
{
this
.
respond
(
405
,
{},
""
);
}
}
else
if
(
browse_regexp
.
test
(
this
.
url
))
{
key
=
browse_regexp
.
exec
(
this
.
url
)[
1
];
}
else
if
(
browse_
file_
regexp
.
test
(
this
.
url
))
{
key
=
browse_
file_
regexp
.
exec
(
this
.
url
)[
1
];
this
.
respond
(
200
,
{
'
Content-Type
'
:
'
application/hal+json
'
},
JSON
.
stringify
({
_links
:
{
self
:
{
href
:
'
browser://browse/ls/
'
+
key
},
self
:
{
href
:
this
.
url
},
enclosure
:
{
href
:
'
browser://localstorage/
'
+
key
},
}
}));
}
else
if
(
browse_directory_regexp
.
test
(
this
.
url
))
{
var
response
=
{
_links
:
{
self
:
{
href
:
this
.
url
},
contents
:
[],
}
};
for
(
var
key
in
localStorage
){
response
.
_links
.
contents
.
push
({
href
:
'
browser://browse/ls/
'
+
key
});
}
this
.
respond
(
200
,
{
'
Content-Type
'
:
'
application/hal+json
'
},
JSON
.
stringify
(
response
));
}
else
{
this
.
respond
(
404
,
{},
""
);
}
...
...
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