From 69f79c7bca1a9f2713f68c5d2fe300d1d301fcc2 Mon Sep 17 00:00:00 2001 From: shuming Date: Tue, 23 Jul 2013 20:10:06 +0800 Subject: [PATCH] fix mimetype parse --- paste.js | 5 +++-- stylesheet.css | 8 ++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/paste.js b/paste.js index 4ee87d2..16f6ee5 100644 --- a/paste.js +++ b/paste.js @@ -122,8 +122,9 @@ var ImageQueue = (function () { ImageQueue.prototype.upload = function(idx, dataURL) { var base64; - if (dataURL.indexOf('data:image/png;base64,') !== -1) { - base64 = dataURL.slice(22); + match_result = dataURL.match(/data:image\/(\w+);base64,(.*)/); + if(match_result) { + base64 = match_result[2]; } var fd = new FormData(); fd.append('image', base64); diff --git a/stylesheet.css b/stylesheet.css index a20d8d1..60dcc2e 100644 --- a/stylesheet.css +++ b/stylesheet.css @@ -131,3 +131,11 @@ img { .dropable-active { border-color: #0c0; } + +.gritter-with-image { + width: 180px; +} + +.gritter-image { + width: 86px; +}