Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
elphel-web-393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
elphel-web-393
Commits
5c155e48
Commit
5c155e48
authored
Jun 27, 2017
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+downloading support for firefox
parent
684cb0c7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
71 additions
and
2 deletions
+71
-2
jp4-viewer.js
src/jp4-viewer/jp4-viewer.js
+7
-0
snapshot.js
src/snapshot/snapshot.js
+64
-2
No files found.
src/jp4-viewer/jp4-viewer.js
View file @
5c155e48
...
@@ -26,6 +26,13 @@ function parseURL(){
...
@@ -26,6 +26,13 @@ function parseURL(){
$
(
function
(){
$
(
function
(){
$
.
ajax
({
url
:
"http://192.168.0.9:2323"
,
success
:
function
(){
console
.
log
(
"success"
);
}
});
parseURL
();
parseURL
();
init
();
init
();
...
...
src/snapshot/snapshot.js
View file @
5c155e48
...
@@ -59,17 +59,79 @@ function download_all(rtp){
...
@@ -59,17 +59,79 @@ function download_all(rtp){
function
download_single
(
addr
){
function
download_single
(
addr
){
// get ze blob
var
http
=
new
XMLHttpRequest
();
http
.
open
(
"GET"
,
addr
,
true
);
http
.
responseType
=
"blob"
;
http
.
onload
=
function
(
e
){
if
(
this
.
status
===
200
)
{
// To access the header, had to add
// printf("Access-Control-Expose-Headers: Content-Disposition\r\n");
// to imgsrv
var
filename
=
this
.
getResponseHeader
(
"Content-Disposition"
);
pass_to_file_reader
(
filename
,
http
.
response
);
}
}
http
.
send
();
/*
return 0;
var link = document.createElement('a');
var link = document.createElement('a');
link.setAttribute('download', null);
link.setAttribute('download', null);
link.style.display = 'none';
link.style.display = 'none';
document
.
body
.
appendChild
(
link
);
link.download = addr;
link.href = addr;
link
.
setAttribute
(
'href'
,
addr
);
document.body.appendChild(link
);
link.click();
link.click();
document.body.removeChild(link);
document.body.removeChild(link);
*/
}
// from here:
// https://diegolamonica.info/multiple-files-download-on-single-link-click/
// http://jsfiddle.net/diegolamonica/ssk8z9pa/
function
pass_to_file_reader
(
filename
,
filedata
){
var
parameters
=
filename
.
split
(
";"
);
for
(
var
i
=
0
;
i
<
parameters
.
length
;
i
++
)
parameters
[
i
]
=
parameters
[
i
].
split
(
"="
);
for
(
var
i
=
0
;
i
<
parameters
.
length
;
i
++
)
{
if
(
parameters
[
i
][
0
].
trim
()
==
"filename"
){
filename
=
parameters
[
i
][
1
].
replace
(
/"/ig
,
""
);
filename
=
filename
.
trim
();
}
}
var
reader
=
new
FileReader
();
reader
.
filename
=
filename
;
reader
.
onloadend
=
function
(
e
){
var
file
=
[
this
.
filename
,
e
.
target
.
result
];
var
theAnchor
=
$
(
'<a />'
)
.
attr
(
'href'
,
file
[
1
])
.
attr
(
'download'
,
file
[
0
])
// Firefox does not fires click if the link is outside
// the DOM
.
appendTo
(
'body'
);
theAnchor
[
0
].
click
();
//theAnchor.click();
theAnchor
.
remove
();
};
reader
.
readAsDataURL
(
filedata
);
}
}
...
...
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