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
b82bce7b
Commit
b82bce7b
authored
Jun 04, 2013
by
Sven Franck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pull browser:url from url
parent
0b8d2257
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
0 deletions
+73
-0
gadget/preview.html
gadget/preview.html
+18
-0
gadget/preview.js
gadget/preview.js
+55
-0
No files found.
gadget/preview.html
View file @
b82bce7b
<!DOCTYPE html>
<html>
<head>
<title>
Preview
</title>
<meta
name=
"viewport"
content=
"width=device-width, height=device-height, initial-scale=1"
/>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
<script
type=
"text/javascript"
src=
"http://code.jquery.com/jquery-1.9.1.min.js"
></script>
<script
type=
"text/javascript"
src=
"../hyperbrowser.js"
></script>
<script
type=
"text/javascript"
src=
"../renderjs.js"
></script>
<script
type=
"text/javascript"
src=
"preview.js"
></script>
</head>
<body>
<noscript>
Please enable Javascript
</noscript>
</body>
</html>
\ No newline at end of file
gadget/preview.js
0 → 100644
View file @
b82bce7b
// > grab URL with parameters of file to open
// > call addGadget with those parameters?
// > display a file from some storage (local/session)
// > storage type will also be a parameter in the url?
// return "browser://localstorage/foo"
// file=browser%3A%2F%2Flocalstorage%2Ffoo
/*global document, jQuery */
"
use strict
"
;
(
function
(
document
,
$
)
{
$
(
document
).
ready
(
function
()
{
localStorage
.
setItem
(
"
foo
"
,
JSON
.
stringify
(
"
bar
"
));
localStorage
.
setItem
(
"
bar
"
,
JSON
.
stringify
(
"
baz
"
));
sessionStorage
.
setItem
(
"
cous
"
,
JSON
.
stringify
(
"
cous
"
));
sessionStorage
.
setItem
(
"
deux
"
,
JSON
.
stringify
(
"
pommes
"
));
var
mapUrl
=
function
(
url
)
{
var
searchString
=
url
.
href
.
split
(
"
?
"
)[
1
],
fileToDisplay
;
if
(
searchString
)
{
fileToDisplay
=
getParameter
(
searchString
,
"
file
"
);
if
(
fileToDisplay
)
{
$
.
ajax
({
method
:
'
GET
'
,
url
:
fileToDisplay
,
context
:
$
(
'
body
'
),
error
:
function
(
jqXHR
,
textStatus
,
errorThrown
)
{
$
(
this
).
text
(
errorThrown
);
},
success
:
function
(
value
,
textStatus
,
jqXHR
)
{
$
(
this
).
text
(
value
);
},
});
}
}
};
var
getParameter
=
function
(
searchString
,
paramName
)
{
var
i
,
val
,
params
=
searchString
.
split
(
"
&
"
);
for
(
i
=
0
;
i
<
params
.
length
;
i
++
)
{
val
=
params
[
i
].
split
(
"
=
"
);
if
(
val
[
0
]
==
paramName
)
{
return
decodeURIComponent
(
val
[
1
]);
}
}
return
null
;
};
mapUrl
(
window
.
location
);
});
}(
document
,
jQuery
));
\ No newline at end of file
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