diff --git a/demo/index.html b/demo/index.html index 36759f30..0d9f6db8 100644 --- a/demo/index.html +++ b/demo/index.html @@ -19,10 +19,8 @@ - + - -

xterm.js: xterm, in the browser

diff --git a/demo/main.js b/demo/main.js index 3937cb75..05adfacf 100644 --- a/demo/main.js +++ b/demo/main.js @@ -1,3 +1,5 @@ +"use strict"; + var term, protocol, socketURL, @@ -109,6 +111,36 @@ function createTerminal() { socket.onopen = runRealTerminal; socket.onclose = runFakeTerminal; socket.onerror = runFakeTerminal; + + term.zmodemAttach(socket); + + term.on("zmodemRetract", () => { + start_form.style.display = "none"; + start_form.onsubmit = null; + }); + + term.on("zmodemDetect", (detection) => { + start_form.style.display = ""; + start_form.onsubmit = function(e) { + start_form.style.display = "none"; + + if (document.getElementById("zmstart_yes").checked) { + let zsession = detection.confirm(); + + current_zsession = zsession; + + if (zsession.type === "receive") { + _handle_receive_session(zsession); + } + else { + _handle_send_session(zsession); + } + } + else { + detection.deny(); + } + }; + }); }); }); }, 0); @@ -237,36 +269,6 @@ function abort_current_session() { current_zsession.abort(); } -term.zmodemAttach(socket); - -term.on("zmodemRetract", () => { - start_form.style.display = "none"; - start_form.onsubmit = null; -}); - -term.on("zmodemDetect", () => { - start_form.style.display = ""; - start_form.onsubmit = function(e) { - start_form.style.display = "none"; - - if (document.getElementById("zmstart_yes").checked) { - let zsession = detection.confirm(); - - current_zsession = zsession; - - if (zsession.type === "receive") { - _handle_receive_session(zsession); - } - else { - _handle_send_session(zsession); - } - } - else { - detection.deny(); - } - }; -}); - function runRealTerminal() { term.on("data", (d) => { socket.send(d); diff --git a/package.json b/package.json index e62af420..3149e085 100644 --- a/package.json +++ b/package.json @@ -75,7 +75,7 @@ "lint": "tslint src/*.ts src/**/*.ts", "test": "gulp test", "build:docs": "jsdoc -c jsdoc.json", - "build": "gulp build; cd demo/zmodemjs; npm install", + "build": "gulp build; cd src/addons/zmodem/zmodemjs; npm install", "prepublish": "npm run build", "coveralls": "gulp coveralls" },