From: Shuanglei Tao Date: Sun, 7 Jan 2018 06:28:16 +0000 (+0800) Subject: Fix Edge and IE11 support X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=702eee4e669db52bac9c52a28047a43b5634bcd6;p=ttyd.git Fix Edge and IE11 support --- diff --git a/html/js/app.js b/html/js/app.js index 2875ce2..d51a49c 100644 --- a/html/js/app.js +++ b/html/js/app.js @@ -1,12 +1,12 @@ +require("babel-polyfill"); +require('fast-text-encoding'); + var Zmodem = require('zmodem.js/src/zmodem_browser'); var Terminal = require('xterm').Terminal; -var fit = require('xterm/lib/addons/fit'); -var winptyCompat = require('xterm/lib/addons/winptyCompat'); -var overlay = require('./overlay'); -Terminal.applyAddon(fit); -Terminal.applyAddon(winptyCompat); -Terminal.applyAddon(overlay); +Terminal.applyAddon(require('xterm/lib/addons/fit')); +Terminal.applyAddon(require('xterm/lib/addons/winptyCompat')); +Terminal.applyAddon(require('./overlay')); function showReceiveModal(xfer) { resetModal('Receiving files'); @@ -214,9 +214,7 @@ var openWs = function() { theme: { foreground: '#f0f0f0', background: '#101010', - cursor: '#f0f0f033', - cursorAccent: "#101010", - selection: '#c1deff33', + cursor: '#f0f0f0', black: '#1a1a1a', red: '#d81e00', green: '#5ea702', @@ -267,7 +265,7 @@ var openWs = function() { }; ws.onmessage = function(event) { - var cmd = String.fromCharCode(new DataView(event.data).getUint8()), + var cmd = String.fromCharCode(new Uint8Array(event.data)[0]), data = event.data.slice(1); switch(cmd) { case '0': diff --git a/html/package.json b/html/package.json index a0c0f16..ed37a84 100644 --- a/html/package.json +++ b/html/package.json @@ -14,10 +14,12 @@ }, "dependencies": { "babel-core": "^6.26.0", + "babel-polyfill": "^6.26.0", "babel-preset-env": "^1.6.1", "babelify": "^8.0.0", "browserify": "^14.5.0", "bulma": "^0.6.1", + "fast-text-encoding": "^1.0.0", "gulp": "^3.9.1", "gulp-inline-source": "^3.0.0", "xterm": "^3.0.1", diff --git a/html/yarn.lock b/html/yarn.lock index 611ae67..d0e724f 100644 --- a/html/yarn.lock +++ b/html/yarn.lock @@ -484,6 +484,14 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" +babel-polyfill@^6.26.0: + version "6.26.0" + resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" + dependencies: + babel-runtime "^6.26.0" + core-js "^2.5.0" + regenerator-runtime "^0.10.5" + babel-preset-env@^1.6.1: version "1.6.1" resolved "https://registry.yarnpkg.com/babel-preset-env/-/babel-preset-env-1.6.1.tgz#a18b564cc9b9afdf4aae57ae3c1b0d99188e6f48" @@ -1241,6 +1249,10 @@ fancy-log@^1.1.0: color-support "^1.1.3" time-stamp "^1.0.0" +fast-text-encoding@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/fast-text-encoding/-/fast-text-encoding-1.0.0.tgz#3e5ce8293409cfaa7177a71b9ca84e1b1e6f25ef" + fill-range@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-4.0.0.tgz#d544811d428f98eb06a63dc402d2403c328c38f7" @@ -2409,6 +2421,10 @@ regenerate@^1.2.1: version "1.3.3" resolved "https://registry.yarnpkg.com/regenerate/-/regenerate-1.3.3.tgz#0c336d3980553d755c39b586ae3b20aa49c82b7f" +regenerator-runtime@^0.10.5: + version "0.10.5" + resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz#336c3efc1220adcedda2c9fab67b5a7955a33658" + regenerator-runtime@^0.11.0: version "0.11.1" resolved "https://registry.yarnpkg.com/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz#be05ad7f9bf7d22e056f9726cee5017fbf19e2e9" diff --git a/src/index.html b/src/index.html index 427d6b5..5c46e29 100644 --- a/src/index.html +++ b/src/index.html @@ -51,6 +51,6 @@ blockquote,body,dd,dl,dt,fieldset,figure,h1,h2,h3,h4,h5,h6,hr,html,iframe,legend - +