浏览代码

base64样式优化

Alien 9 年之前
父节点
当前提交
0d34492724

+ 1 - 1
chrome/manifest.json

@@ -1,6 +1,6 @@
 {
     "name": "WEB前端助手(FeHelper)",
-    "version": "7.6",
+    "version": "7.7",
     "manifest_version": 2,
 
     "default_locale": "zh_CN",

+ 1 - 1
chrome/online.manifest.json

@@ -1,6 +1,6 @@
 {
     "name": "WEB前端助手(FeHelper)",
-    "version": "7.6",
+    "version": "7.7",
     "manifest_version": 2,
 
     "default_locale": "zh_CN",

+ 4 - 3
chrome/static/css/fe-imagebase64.css

@@ -14,8 +14,9 @@ body{
 }
 
 .tips{
-	color:#ff6666;
-	margin-left: 10px;
+	color:#aaa;
+	margin: 10px 0;
+    font-size: 12px;
 }
 
 table {
@@ -57,7 +58,7 @@ td .x-panel .x-tips {
 #upload:hover {
     background: #00a2d4;
 }
-#preview {display: none;max-width: 260px;max-height: 260px;margin-top:10px;border:2px solid #ccc;}
+#preview {display: none;max-width: 260px;max-height: 260px;margin-top:10px;}
 form {display: none}
 td textarea {
     width: 490px;

+ 11 - 15
chrome/static/js/imagebase64/main.js

@@ -32,23 +32,19 @@ var ImageBase64 = (function () {
         });
 
         //监听paste事件
-        document.onpaste = function(event){
+        document.onpaste = function (event) {
             var items = (event.clipboardData || event.originalEvent.clipboardData).items;
             for (var index in items) {
-              var item = items[index];
-              if (item.kind === 'file') {
-                var blob = item.getAsFile();
-                var reader = new FileReader();
-                reader.onload = function(event){
-                  $('#preview').attr('src', event.target.result).show();
-                  $('#result').val(event.target.result);
-                };
-                reader.readAsDataURL(blob);
-              }
+                var item = items[index];
+                if (/image\//.test(item.type)) {
+                    var file = item.getAsFile();
+                    _getDataUri(file);
+                    break;
+                }
             }
         };
 
-        $(document).bind('drop',function (e) {
+        $(document).bind('drop', function (e) {
             e.preventDefault();
             e.stopPropagation();
             var files = e.originalEvent.dataTransfer.files;
@@ -60,9 +56,9 @@ var ImageBase64 = (function () {
                 }
             }
         }).bind('dragover', function (e) {
-                e.preventDefault();
-                e.stopPropagation();
-            });
+            e.preventDefault();
+            e.stopPropagation();
+        });
     };
 
     $(function () {

文件差异内容过多而无法显示
+ 0 - 0
chrome/template/fehelper_imagebase64.html


部分文件因为文件数量过多而无法显示