From 58f504a8f869db6c603acd58c80c6ab0d7e0fcb7 Mon Sep 17 00:00:00 2001 From: neauoire Date: Fri, 27 Mar 2020 08:31:05 +0900 Subject: [PATCH] Added svg support --- index.html | 5 +++-- scripts/client.js | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/index.html b/index.html index 351471e..6c788e8 100644 --- a/index.html +++ b/index.html @@ -605,8 +605,7 @@ function Client () { if (file.name.indexOf('.lisp') > -1) { this.source.read(file, this.whenOpen) this.log('Loaded ' + file.name) - } - if (file.type === 'image/jpeg' || file.type === 'image/png') { + } else if (file.type.substr(0, 5) === 'image') { const img = new Image() img.onload = () => { this.cache.set(file.name, img) @@ -614,6 +613,8 @@ function Client () { this.log('Loaded ' + file.name) } img.src = URL.createObjectURL(file) + } else { + console.warn('Unknown format', file) } } this.cache = { diff --git a/scripts/client.js b/scripts/client.js index 0f0a6b6..9b21953 100644 --- a/scripts/client.js +++ b/scripts/client.js @@ -172,9 +172,7 @@ function Client () { if (file.name.indexOf('.lisp') > -1) { this.source.read(file, this.whenOpen) this.log('Loaded ' + file.name) - } - - if (file.type === 'image/jpeg' || file.type === 'image/png') { + } else if (file.type.substr(0, 5) === 'image') { const img = new Image() img.onload = () => { this.cache.set(file.name, img) @@ -182,6 +180,8 @@ function Client () { this.log('Loaded ' + file.name) } img.src = URL.createObjectURL(file) + } else { + console.warn('Unknown format', file) } }