mirror of
https://github.com/flynx/PortableMag.git
synced 2025-12-17 17:11:47 +00:00
added uploading, still not working...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
5edcebce62
commit
f2b5d069c0
30
index.html
30
index.html
@ -761,6 +761,7 @@ $(document).ready(function(){
|
|||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<a id="downloader" download="magazine.json">download magazine...</a>
|
<a id="downloader" download="magazine.json">download magazine...</a>
|
||||||
|
<input type="file" id="upload" name="files[]"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<hr noshade color="silver">
|
<hr noshade color="silver">
|
||||||
@ -1002,7 +1003,7 @@ $(document).ready(function(){
|
|||||||
|
|
||||||
loadSettings()
|
loadSettings()
|
||||||
|
|
||||||
// setup the link...
|
// setup download link...
|
||||||
$('#downloader')
|
$('#downloader')
|
||||||
.attr('href','data:text/octet-stream;base64,'+btoa(
|
.attr('href','data:text/octet-stream;base64,'+btoa(
|
||||||
JSON.stringify(buildJSON(true, true))
|
JSON.stringify(buildJSON(true, true))
|
||||||
@ -1010,6 +1011,33 @@ $(document).ready(function(){
|
|||||||
// entities with actual chars...
|
// entities with actual chars...
|
||||||
.replace(/–/g, '–')))
|
.replace(/–/g, '–')))
|
||||||
|
|
||||||
|
// upload...
|
||||||
|
function handleFileSelect(evt) {
|
||||||
|
var files = evt.target.files; // FileList object
|
||||||
|
|
||||||
|
// Loop through the FileList and render image files as thumbnails.
|
||||||
|
for (var i = 0, f; f = files[i]; i++) {
|
||||||
|
|
||||||
|
var reader = new FileReader();
|
||||||
|
|
||||||
|
// Closure to capture the file information.
|
||||||
|
reader.onload = (function(theFile) {
|
||||||
|
return function(e) {
|
||||||
|
console.log('loading...')
|
||||||
|
console.log($.parseJSON(e.target.result))
|
||||||
|
loadJSON($.parseJSON(e.target.result), true)
|
||||||
|
console.log('done.')
|
||||||
|
};
|
||||||
|
})(f);
|
||||||
|
|
||||||
|
// Read in the image file as a data URL.
|
||||||
|
reader.readAsText(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#upload').on('change', handleFileSelect);
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user