Răsfoiți Sursa

增加代码压缩工具

压缩工具需要后端服务,所以是跳转到官网进行操作的
Alien 11 ani în urmă
părinte
comite
0d1514a8d8

+ 2 - 2
chrome/manifest.json

@@ -1,11 +1,11 @@
 { 
 { 
 	"name": "WEB前端助手(FeHelper)", 
 	"name": "WEB前端助手(FeHelper)", 
-	"version": "4.6",
+	"version": "4.7",
     "manifest_version": 2,
     "manifest_version": 2,
 	 
 	 
 	"default_locale": "zh_CN", 
 	"default_locale": "zh_CN", 
 
 
-    "description": "FE助手:包括字符串编解码、代码美化、JSON格式化、正则表达式、时间转换工具、二维码生成器、编码规范检测、页面性能检测、栅格检测等",
+    "description": "FE助手:包括字符串编解码、代码压缩、美化、JSON格式化、正则表达式、时间转换工具、二维码生成器、编码规范检测、页面性能检测、栅格检测等",
 	"icons": { 
 	"icons": { 
 		"16": "static/img/fe-16.png",
 		"16": "static/img/fe-16.png",
 		"48": "static/img/fe-48.png",
 		"48": "static/img/fe-48.png",

+ 2 - 2
chrome/online.manifest.json

@@ -1,11 +1,11 @@
 {
 {
     "name": "WEB前端助手(FeHelper)",
     "name": "WEB前端助手(FeHelper)",
-    "version": "4.6",
+    "version": "4.7",
     "manifest_version": 2,
     "manifest_version": 2,
 
 
     "default_locale": "zh_CN",
     "default_locale": "zh_CN",
 
 
-    "description": "FE助手:包括字符串编解码、代码美化、JSON格式化、正则表达式、时间转换工具、二维码生成器、编码规范检测、页面性能检测、栅格检测、JS运行效率分析等",
+    "description": "FE助手:包括字符串编解码、代码压缩、美化、JSON格式化、正则表达式、时间转换工具、二维码生成器、编码规范检测、页面性能检测、栅格检测、JS运行效率分析等",
 	"icons": { 
 	"icons": { 
 		"16": "static/img/fe-16.png",
 		"16": "static/img/fe-16.png",
 		"48": "static/img/fe-48.png",
 		"48": "static/img/fe-48.png",

+ 3 - 0
chrome/static/css/fe-popup.css

@@ -76,6 +76,9 @@ ul.fe-function-list li.-x-tracker b {
 ul.fe-function-list li.-x-timestamp b {
 ul.fe-function-list li.-x-timestamp b {
     background-position:0px -161px;
     background-position:0px -161px;
 }
 }
+ul.fe-function-list li.-x-codecompress b {
+    background-position:-65px -81px;
+}
 .fe-feedback {
 .fe-feedback {
 	font-size:12px;
 	font-size:12px;
 	border-top:1px dotted #ddd;
 	border-top:1px dotted #ddd;

+ 2 - 0
chrome/static/js/core/fe-const.js

@@ -57,6 +57,8 @@ const MSG_TYPE = {
     //执行JS嗅探:Tracker,from 志龙(http://ucren.com)
     //执行JS嗅探:Tracker,from 志龙(http://ucren.com)
     JS_TRACKER : 'js_tracker',
     JS_TRACKER : 'js_tracker',
 
 
+    CODE_COMPRESS : 'code_compress',
+
     ////////////////////如下是popup中的menu,value和filename相同///////////////////
     ////////////////////如下是popup中的menu,value和filename相同///////////////////
     REGEXP_TOOL : 'regexp',
     REGEXP_TOOL : 'regexp',
     //字符串编解码
     //字符串编解码

+ 32 - 0
chrome/static/js/fe-background.js

@@ -121,6 +121,34 @@ var BgPageInstance = (function(){
         });
         });
     };
     };
 
 
+    /**
+     * 代码压缩工具
+     * @private
+     */
+    var _goCompressTool = function(){
+        var url = "http://www.baidufe.com/fehelper/codecompress.html";
+        chrome.tabs.getAllInWindow(null,function(tabs){
+            var isOpened = false;
+            var tabId ;
+            var reg = new RegExp("fehelper.*codecompress.html$","i");
+            for(var i = 0,len = tabs.length;i < len;i++){
+                if(reg.test(tabs[i].url)) {
+                    isOpened = true;
+                    tabId = tabs[i].id;
+                    break;
+                }
+            }
+            if(!isOpened) {
+                chrome.tabs.create({
+                    url : url,
+                    selected : true
+                });
+            } else {
+                chrome.tabs.update(tabId,{selected : true});
+            }
+        });
+    };
+
     /**
     /**
      * 打开对应文件,运行该Helper
      * 打开对应文件,运行该Helper
      * @param tab
      * @param tab
@@ -176,6 +204,10 @@ var BgPageInstance = (function(){
                     case MSG_TYPE.JS_TRACKER:
                     case MSG_TYPE.JS_TRACKER:
                         _doJsTracker();
                         _doJsTracker();
                         break;
                         break;
+                    //代码压缩
+                    case MSG_TYPE.CODE_COMPRESS:
+                        _goCompressTool();
+                        break;
                 }
                 }
             }
             }
         });
         });

+ 1 - 1
chrome/template/fehelper_codebeautify.html

@@ -12,7 +12,7 @@
             <div class="format-item clearfix">
             <div class="format-item clearfix">
                 <fieldset>
                 <fieldset>
                     <legend>代码美化:<span id="codeTitle">Javascript</span></legend>
                     <legend>代码美化:<span id="codeTitle">Javascript</span></legend>
-                    <textarea id="codeSource" placeholder="在这里粘贴您需要进行美化的Javascript代码"></textarea>
+                    <textarea id="codeSource" placeholder="在这里粘贴您需要进行美化的代码"></textarea>
                     <div class="btn-opts">
                     <div class="btn-opts">
                         <input id="codeTypeJs" name="codeType" type="radio" value="Javascript" checked>
                         <input id="codeTypeJs" name="codeType" type="radio" value="Javascript" checked>
                         <label for="codeTypeJs">JS代码美化</label>
                         <label for="codeTypeJs">JS代码美化</label>

Fișier diff suprimat deoarece este prea mare
+ 0 - 1
chrome/template/fehelper_popup.html


Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff