Enabled support for local disk images to PCjs
This commit is contained in:
parent
43860a588c
commit
a54cbeeba8
18 changed files with 961 additions and 845 deletions
|
|
@ -128,15 +128,15 @@ C1PSerialPort.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, c
|
|||
};
|
||||
return true;
|
||||
|
||||
case "uploadSerial":
|
||||
case "mountSerial":
|
||||
/*
|
||||
* Check for availability of FileReader
|
||||
*/
|
||||
if (window.FileReader && window.File && window.FileList && window.Blob) {
|
||||
if (window.FileReader && window.File && window.FileList) {
|
||||
this.bindings[sBinding] = control;
|
||||
|
||||
/*
|
||||
* Enable "Load Local File" button only if a file is actually selected
|
||||
* Enable "Mount" button only if a file is actually selected
|
||||
*/
|
||||
control.addEventListener('change', function() {
|
||||
var fieldset = control.children[0];
|
||||
|
|
@ -150,7 +150,7 @@ C1PSerialPort.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, c
|
|||
|
||||
var reader = new FileReader();
|
||||
reader.onload = function() {
|
||||
// serial.println("loading " + file.name + "...");
|
||||
// serial.println("mounting " + file.name + "...");
|
||||
serial.loadFile(file.name, reader.result.toString(), 0);
|
||||
};
|
||||
reader.readAsText(file);
|
||||
|
|
@ -162,7 +162,7 @@ C1PSerialPort.prototype.setBinding = function(sHTMLClass, sHTMLType, sBinding, c
|
|||
};
|
||||
}
|
||||
else {
|
||||
this.println("FileReader support not available, disabling local file load");
|
||||
if (DEBUG) this.log("FileReader support not available, Mount disabled");
|
||||
control.parentNode.removeChild(control);
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,11 @@
|
|||
font-family: Monaco, monospace;
|
||||
font-size: x-small;
|
||||
}
|
||||
.c1pjs-fieldset {
|
||||
border: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.c1pjs-flag {
|
||||
font-family: "Lucida Console", monospace;
|
||||
font-size: small;
|
||||
|
|
|
|||
|
|
@ -286,10 +286,10 @@
|
|||
<div><xsl:value-of select="."/></div>
|
||||
</xsl:when>
|
||||
<xsl:when test="@type = 'file'">
|
||||
<form class="{$APPCLASS}-{@class}" data-value="{$type},{$binding}">
|
||||
<fieldset>
|
||||
<form class="{$APPCLASS}-{@class}" style="{$border}{$width}{$height}{$style}" data-value="{$type},{$binding}">
|
||||
<fieldset class="{$APPCLASS}-fieldset">
|
||||
<input type="file"/>
|
||||
<input type="submit" value="Load Local File" disabled="true"/>
|
||||
<input type="submit" value="Mount" disabled="true"/>
|
||||
</fieldset>
|
||||
</form>
|
||||
</xsl:when>
|
||||
|
|
|
|||
Loading…
Reference in a new issue