Browse Source

自动格式化Bug Fix

zxlie 8 years ago
parent
commit
9a04157c36

+ 1 - 1
chrome/manifest.json

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

+ 1 - 1
chrome/online.manifest.json

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

+ 7 - 1
chrome/static/js/jsonformat/contentscript-jsonformat.js

@@ -62,7 +62,7 @@ baidu.csJsonFormat = (function () {
                 return false;
             }
         }
-        return newSource || source;
+        return $.trim(newSource || '') || source;
     };
 
     /**
@@ -201,7 +201,13 @@ baidu.csJsonFormat = (function () {
                 funcName = matches[1];
                 newSource = matches[2];
                 jsonObj = new Function("return " + newSource)();
+            }else{
+                reg = /^([\{\[])/ ;
+                if(!reg.test(source)){
+                    return ;
+                }
             }
+
         } catch (ex) {
             return;
         }