Make it work (as well as it may) in Edge

This commit is contained in:
Felipe Gasper
2017-10-03 23:16:12 -04:00
parent 4c4c392479
commit 0e732a7d41
6 changed files with 19 additions and 5 deletions
+4
View File
@@ -25,6 +25,10 @@ app.get('/zmodemjs/*.js', function(req, res){
res.sendFile(__dirname + req.url);
});
app.get('/js/*.js', function(req, res){
res.sendFile(__dirname + req.url);
});
app.post('/terminals', function (req, res) {
var cols = parseInt(req.query.cols),
rows = parseInt(req.query.rows),
+5 -2
View File
@@ -13,6 +13,9 @@
<script src="/build/addons/fullscreen/fullscreen.js" ></script>
<script src="/build/addons/search/search.js" ></script>
<!-- Edge needs this, as of late 2017 -->
<script src="/js/text-encoding.js"></script>
<script src="/zmodemjs/zmodem.js"></script>
</head>
<body>
@@ -21,7 +24,7 @@
<div id="zmodem_controls">
<form id="zm_start" style="display: none" action="javascript:void(0)">
ZMODEM detected: Start ZMODEM session?
<label><input name="zmstart" type=radio checked value="1"> Yes</label>
<label><input id="zmstart_yes" name="zmstart" type=radio checked value="1"> Yes</label>
&nbsp;
<label><input name="zmstart" type=radio value=""> No</label>
<button type="submit">Submit</button>
@@ -39,7 +42,7 @@
<form id="zm_offer" style="display: none" action="javascript:void(0)">
<p>ZMODEM File offered!</p>
<label><input name="zmaccept" type=radio checked value="1"> Accept</label>
<label><input id="zmaccept_yes" name="zmaccept" type=radio checked value="1"> Accept</label>
&nbsp;
<label><input name="zmaccept" type=radio value=""> Skip</label>
<button type="submit">Submit</button>
Vendored Symlink
+1
View File
@@ -0,0 +1 @@
../../node_modules/formdata-polyfill/formdata.min.js
+1
View File
@@ -0,0 +1 @@
../../node_modules/text-encoding/lib/encoding.js
+5 -3
View File
@@ -168,10 +168,12 @@ function _handle_receive_session(zsession) {
var offer_form = document.getElementById("zm_offer");
offer_form.style.display = "";
offer_form.onsubmit = function(e) {
offer_form.style.display = "none";
var the_form = e.currentTarget;
the_form.style.display = "none";
//START
if (offer_form.zmaccept.value) {
//if (offer_form.zmaccept.value) {
if (document.getElementById("zmaccept_yes").checked) {
var FILE_BUFFER = [];
xfer.on("input", (payload) => {
_update_progress(xfer);
@@ -259,7 +261,7 @@ var zsentry = new Zmodem.Sentry( {
start_form.onsubmit = function(e) {
start_form.style.display = "none";
if (e.currentTarget.zmstart.value) {
if (document.getElementById("zmstart_yes").checked) {
let zsession = detection.confirm();
current_zsession = zsession;
+3
View File
@@ -78,5 +78,8 @@
"build": "gulp build; cd demo/zmodemjs; npm install",
"prepublish": "npm run build",
"coveralls": "gulp coveralls"
},
"dependencies": {
"text-encoding": "^0.6.4"
}
}