Przeglądaj źródła

1、编码规范检测功能按需执行;2、Unicode解码升级;3、身份证正则表达式更新

zxlie 9 lat temu
rodzic
commit
192bb8eaa3

+ 1 - 1
chrome/manifest.json

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

+ 1 - 1
chrome/online.manifest.json

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

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

@@ -5,4 +5,7 @@
 }
 #rstCode {
     height: 280px;
+}
+.ui-ml-05 {
+    margin-left: 5px;
 }

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

@@ -26,6 +26,8 @@ const MSG_TYPE = {
 	GET_OPTIONS : 'get_options',
 	//set options
 	SET_OPTIONS : 'set_options',
+
+    FCP_HELPER_INIT:'fcp_helper_init',
 	
 	//css ready...
 	CSS_READY : 'css-ready',
@@ -35,6 +37,8 @@ const MSG_TYPE = {
 	
 	//html ready...
 	HTML_READY : 'html-ready',
+    //all ready...
+    ALL_READY : 'all-ready',
 	
 	//启动项
 	START_OPTION : 'start-option',

+ 4 - 2
chrome/static/js/endecode/endecode.js

@@ -9,14 +9,16 @@ baidu.ed = (function () {
      * 转码
      */
     var _convert = function () {
-        var srcText = jQuery("#srcText").val();
+        var srcEl = jQuery("#srcText");
+        var srcText = srcEl.val();
         jQuery("#rst").show();
         var rstCode = jQuery("#rstCode");
 
         if (jQuery("#uniEncode").attr("checked") == true) {
             rstCode.val(baidu.endecode.uniEncode(srcText));
         } else if (jQuery("#uniDecode").attr("checked") == true) {
-            rstCode.val(baidu.endecode.uniDecode(srcText));
+            srcEl.val(srcEl.val().replace(/\\U/g,'\\u'));
+            rstCode.val(baidu.endecode.uniDecode(srcEl.val()));
         } else if (jQuery("#utf8Encode").attr("checked") == true) {
             rstCode.val(encodeURIComponent(srcText));
         } else if (jQuery("#utf8Decode").attr("checked") == true) {

+ 21 - 13
chrome/static/js/fe-background.js

@@ -31,7 +31,7 @@ var BgPageInstance = (function () {
             options.title = "温馨提示";
         }
 
-        chrome.notifications.create('', {
+        return chrome.notifications.create('', {
             type: 'basic',
             title: options.title,
             iconUrl: chrome.runtime.getURL(options.icon),
@@ -40,35 +40,41 @@ var BgPageInstance = (function () {
 
     };
 
-    //侦测的interval
-    var _detectInterval = null;
-
     //侦测就绪情况
-    var _detectReadyState = function () {
-        _detectInterval = window.setInterval(function () {
-            if (_readyState.css && _readyState.js && _readyState.html) {
-                _readyState.allDone = true;
-                window.clearInterval(_detectInterval);
-            }
-        }, 100);
+    var _detectReadyState = function (callback) {
+        if (_readyState.css && _readyState.js && _readyState.html) {
+            _readyState.allDone = true;
+        }
+        if(_readyState.allDone && typeof callback == 'function'){
+            callback();
+        }
     };
 
 
+    var _fcp_detect_interval = [];
     /**
      * 执行前端FCPHelper检测
      */
     var _doFcpDetect = function (tab) {
         //所有元素都准备就绪
         if (_readyState.allDone) {
+            clearInterval(_fcp_detect_interval[tab.id]);
             chrome.tabs.sendMessage(tab.id, {
                 type: MSG_TYPE.BROWSER_CLICKED,
                 event: MSG_TYPE.FCP_HELPER_DETECT
             });
-        } else {
+        } else if(_fcp_detect_interval[tab.id] === undefined) {
+            chrome.tabs.sendMessage(tab.id, {
+                type: MSG_TYPE.BROWSER_CLICKED,
+                event: MSG_TYPE.FCP_HELPER_INIT
+            });
             //显示桌面提醒
             notifyText({
                 message: "正在准备数据,请稍等..."
             });
+            _fcp_detect_interval[tab.id] = setInterval(function(){
+                _doFcpDetect(tab);
+            },200);
         }
     };
 
@@ -404,14 +410,17 @@ var BgPageInstance = (function () {
             //CSS准备就绪
             else if (request.type == MSG_TYPE.CSS_READY) {
                 _readyState.css = true;
+                _detectReadyState(callback);
             }
             //JS准备就绪
             else if (request.type == MSG_TYPE.JS_READY) {
                 _readyState.js = true;
+                _detectReadyState(callback);
             }
             //HTML准备就绪
             else if (request.type == MSG_TYPE.HTML_READY) {
                 _readyState.html = true;
+                _detectReadyState(callback);
             }
             //提取配置项
             else if (request.type == MSG_TYPE.GET_OPTIONS) {
@@ -445,7 +454,6 @@ var BgPageInstance = (function () {
      */
     var _init = function () {
         _addExtensionListener();
-        _detectReadyState();
         _createOrRemoveContextMenu();
     };
 

+ 13 - 27
chrome/static/js/fe-helper.js

@@ -28,46 +28,32 @@ baidu.fehelper = (function(){
 	 * 执行FCPHelper检测
 	 */
 	var _doFcpDetect = function(){
-		//////////先做一些准备工作/////////////////////
-		baidu.fcphelper.initStaticFile();
 		
 		chrome.extension.onMessage.addListener(function(request,sender,callback){
 			//browserAction被点击
-			if(request.type == MSG_TYPE.BROWSER_CLICKED && request.event == MSG_TYPE.FCP_HELPER_DETECT) {
-				//加载css
-                _loadCss();
-				//html
-				baidu.fcphelper.initHtml(function(){
-					//fcp相关检测
-					baidu.fcphelper.detect();
-				});
+			if(request.type == MSG_TYPE.BROWSER_CLICKED && request.event == MSG_TYPE.FCP_HELPER_INIT) {
+                //////////先做一些准备工作/////////////////////
+                baidu.fcphelper.initStaticFile();
 			}
-		});
-	};
-	
-	/**
-	 * 执行栅格检测:在页面上显示栅格
-	 */
-	var _doGridDetect = function(){
-		chrome.runtime.onMessage.addListener(function(request,sender,callback){
-			//browserAction被点击
-			if(request.type == MSG_TYPE.BROWSER_CLICKED && request.event == MSG_TYPE.GRID_DETECT) {
-				//加载css
+            //browserAction被点击
+            if(request.type == MSG_TYPE.BROWSER_CLICKED && request.event == MSG_TYPE.FCP_HELPER_DETECT) {
+                //加载css
                 _loadCss();
-				//栅格检测
-				baidu.grid.detect();
-			}
+                //html
+                baidu.fcphelper.initHtml(function(){
+                    //fcp相关检测
+                    baidu.fcphelper.detect();
+                });
+            }
 		});
 	};
-	
+
 	/**
 	 * 函数主入口,主要是处理和browserAction之间的message交互
 	 */
 	var _main = function(){
 		//执行FCPHelper检测
 		_doFcpDetect();
-		//执行栅格检测
-		_doGridDetect();
 	};
 	
 	

Plik diff jest za duży
+ 0 - 0
chrome/template/fehelper_endecode.html


Plik diff jest za duży
+ 0 - 0
chrome/template/fehelper_regexp.html


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików