Sfoglia il codice sorgente

废弃的功能清理

一些已经停用的功能,就删掉算了
Alien 10 anni fa
parent
commit
1f2cfd966a

+ 1 - 4
chrome/manifest.json

@@ -1,6 +1,6 @@
 {
     "name": "WEB前端助手(FeHelper)",
-    "version": "7.3",
+    "version": "7.4",
     "manifest_version": 2,
 
     "default_locale": "zh_CN",
@@ -41,7 +41,6 @@
         "static/img/43.png",
         "static/img/baidufe_bj.png",
         "static/img/baidufe_bj.gif",
-        "static/img/grid.png",
         "static/img/fe-18.png",
         "static/img/fe-48.png",
         "static/img/fe-128.png",
@@ -77,9 +76,7 @@
                 "static/js/fcp/fcp-tabs.js",
                 "static/js/fcp/fcp-main.js",
 
-                "static/js/grid/grid-main.js",
                 "static/js/fe-helper.js",
-                "static/js/notification/fe-notification.js",
                 "static/js/wpo/fe-calc-wpo.js",
 
                 "static/js/jsonformat/json-format-dealer.js",

+ 2 - 3
chrome/online.manifest.json

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

+ 34 - 26
chrome/static/js/fe-background.js

@@ -12,6 +12,34 @@ var BgPageInstance = (function () {
         allDone: false
     };
 
+    /**
+     * 文本格式,可以设置一个图标和标题
+     * @param {Object} options
+     * @config {string} type notification的类型,可选值:html、text
+     * @config {string} icon 图标
+     * @config {string} title 标题
+     * @config {string} message 内容
+     */
+    var notifyText = function (options) {
+        if (!window.Notification) {
+            return;
+        }
+        if (!options.icon) {
+            options.icon = "static/img/fe-48.png";
+        }
+        if (!options.title) {
+            options.title = "温馨提示";
+        }
+
+        chrome.notifications.create('',{
+            type:'basic',
+            title:options.title,
+            iconUrl: chrome.runtime.getURL(options.icon),
+            message:options.message
+        });
+
+    };
+
     //侦测的interval
     var _detectInterval = null;
 
@@ -37,9 +65,8 @@ var BgPageInstance = (function () {
                 event: MSG_TYPE.FCP_HELPER_DETECT
             });
         } else {
-            //正在准备数据,请稍等...
             //显示桌面提醒
-            baidu.feNotification.notifyText({
+            notifyText({
                 message: "正在准备数据,请稍等..."
             });
         }
@@ -55,35 +82,20 @@ var BgPageInstance = (function () {
         });
     };
 
-    /**
-     * 提醒层 缓存
-     * @type {Array}
-     */
-    var _notificationCache = [];
-
     /**
      * 查看页面wpo信息
      */
     var _showPageWpoInfo = function (wpoInfo) {
         chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
-            var tab = tabs[0];
-            try {
-                _notificationCache[tab.id].cancel();
-            } catch (e) {
-            }
             if (!wpoInfo) {
-                baidu.feNotification.notifyText({
+                notifyText({
                     message: "对不起,检测失败"
                 });
             } else {
-                if (window.webkitNotifications && webkitNotifications.createHTMLNotification) {
-                    baidu.feNotification.notifyHtml("template/fehelper_wpo.html?" + JSON.stringify(wpoInfo));
-                } else {
-                    chrome.tabs.create({
-                        url: "template/fehelper_wpo.html?" + JSON.stringify(wpoInfo),
-                        active: true
-                    });
-                }
+                chrome.tabs.create({
+                    url: "template/fehelper_wpo.html?" + btoa(encodeURIComponent(JSON.stringify(wpoInfo))),
+                    active: true
+                });
             }
         });
     };
@@ -96,10 +108,6 @@ var BgPageInstance = (function () {
         chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {
             var tab = tabs[0];
             //显示桌面提醒
-            _notificationCache[tab.id] = baidu.feNotification.notifyText({
-                message: "正在统计,请稍后...",
-                autoClose: false
-            });
             chrome.tabs.sendMessage(tab.id, {
                 type: MSG_TYPE.GET_PAGE_WPO_INFO
             });

+ 0 - 157
chrome/static/js/grid/grid-main.js

@@ -1,157 +0,0 @@
-/**
- * 注册命名空间:baidu.grid
- */
-baidu.namespace.register("baidu.grid");
-
-/**
- * 栅格相关处理
- * @author zhaoxianlie 
- */
-baidu.grid = (function(){
-	
-	/**
-	 * 创建栅格
-	 */
-	var _createGrid = function(){
-		
-		var box = jQuery('#fe-helper-box');
-		if(box[0]) {	//已经有栅格,则移除
-			box.remove();
-		} 
-		//没有栅格,则创建
-		var gridPng = chrome.extension.getURL('static/img/grid.png');
-		var $win =  jQuery(window);
-		var $body = jQuery('body');
-		jQuery('<div id="fe-helper-box"></div>').appendTo('body').css({
-			position:'static'
-		});
-		jQuery('<div id="fe-helper-grid"></div>').appendTo('#fe-helper-box').css({
-			'background' : 'url(' + gridPng + ') repeat',
-			width : $body.width(),
-			height : Math.max($win.height() , $body.height())
-		}).mousemove(function(e){
-			var pos = {};
-			try{
-				pos = document.getElementsByTagName('body')[0].getBoundingClientRect();
-			}catch(err){
-				pos = {left:0,top:0};
-			}
-			//虚线框
-			jQuery('#fe-helper-g-pos').show().css({
-				width : e.pageX - pos.left,
-				height : e.pageY
-			});
-			
-			var _t = Math.min(e.pageY,jQuery(window).height() + jQuery('body').scrollTop() - 40) ;
-			var _l = Math.min(e.pageX,jQuery(window).width() + jQuery('body').scrollLeft() - 200) + 5 - pos.left;
-			
-			//坐标tooltip
-			jQuery('#fe-helper-gp-info').show().css({
-				top : _t,
-				left : _l
-			}).html('top = ' + e.pageY + ' px ,left = ' + e.pageX + ' px');
-		}).mouseout(function(e){
-			jQuery('#fe-helper-g-pos,#fe-helper-gp-info').hide();
-		})
-		
-		//为页面注册按键监听
-		jQuery('body').keydown(function(e){
-			if(jQuery('#fe-helper-box')[0]) {
-				if(e.which == 27) { //ESC
-					jQuery('#fe-helper-box').remove();
-				}
-			}
-		});
-		
-		//window.onresize
-		jQuery(window).resize(function(){
-			if(jQuery('#fe-helper-box')[0]) {
-				jQuery('#fe-helper-grid').css({
-					width : Math.max($win.width() , $body.width()),
-					height : Math.max($win.height() , $body.height())
-				})
-			}
-		});
-		
-		jQuery('<div id="fe-helper-g-pos"></div><div id="fe-helper-gp-info"></div>').appendTo('#fe-helper-box');
-		jQuery('<span id="fe-helper-btn-close-grid">关闭栅格层</span>')
-			.appendTo('#fe-helper-box').click(function(){
-				jQuery('#fe-helper-box').remove();
-			});
-		
-		//创建页面标尺	
-		_createPageRuler();
-	};
-	
-	/**
-	 * 创建页面标尺
-	 */
-	var _createPageRuler = function(){
-		if(!jQuery('#fe-helper-box')[0]) {
-			jQuery('<div id="fe-helper-box"></div>').appendTo('body');
-		}
-		jQuery('<div id="fe-helper-ruler-top"></div><div id="fe-helper-ruler-left"></div>').appendTo('#fe-helper-box');
-		var _t = 0,_h = 20,_w = 20;
-		
-		var $win =  jQuery(window);
-		var $body = jQuery('body');
-		var $width = Math.max($win.width() , $body.width());
-		var $height = Math.max($win.height() , $body.height());
-		
-		for(var i = 30;i <= $width;i += 10) {
-			_t = (i % 50) ? 10 : 0;
-			jQuery('<div class="h-line"></div>').appendTo('#fe-helper-ruler-top').css({
-				left : i - 1,
-				top : _t + 5,
-				height : _h - _t - 5
-			});
-			if(_t == 0) {
-				jQuery('<div class="h-text">' + i + '</div>').appendTo('#fe-helper-ruler-top').css({
-					left : i + 2
-				});
-			}
-		}
-		for(var i = 0;i <= $height;i += 10) {
-			_l = (i % 50) ? 10 : 0;
-			jQuery('<div class="v-line"></div>').appendTo('#fe-helper-ruler-left').css({
-				left : _l + 5,
-				top : i - 1,
-				width : _w - _l - 5
-			});
-			if(_l == 0) {
-				jQuery('<div class="v-text">' + i + '</div>').appendTo('#fe-helper-ruler-left').css({
-					top : i + 2
-				});
-			}
-		}
-		
-		//处理scroll的时候,标尺跟着移动
-		jQuery(window).scroll(function(e){
-			if(jQuery('#fe-helper-box')[0]) {
-				//水平标尺定位
-				jQuery('#fe-helper-ruler-top').css('left',0 - jQuery('body').scrollLeft());
-				//垂直标尺
-				jQuery('#fe-helper-ruler-left').css('top',0 - jQuery('body').scrollTop());
-			}
-		});
-	
-	};
-	
-	/**
-	 * 执行栅格系统检测
-	 */
-	var _detect = function(callback){
-		
-		//创建栅格
-		_createGrid();
-		
-		//执行回调
-		if(callback && typeof callback == "function") {
-			callback.call(null);
-		}
-	};
-	
-	return {
-		detect : _detect
-	};
-})();

+ 0 - 1
chrome/static/js/mod/mod_background.js

@@ -21,5 +21,4 @@ importScript("js/core/core.js");
 importScript("js/core/fe-const.js");
 importScript("js/core/network.js");
 importScript("js/fe-option.js");
-importScript("js/notification/fe-notification.js");
 importScript("js/fe-background.js");

+ 0 - 2
chrome/static/js/mod/mod_manifest.js

@@ -30,9 +30,7 @@ importScript("js/fcp/js/fcp-js.js");
 importScript("js/fcp/fcp-tabs.js");
 importScript("js/fcp/fcp-main.js");
 			
-importScript("js/grid/grid-main.js");
 importScript("js/fe-helper.js");
-importScript("js/notification/fe-notification.js");
 importScript("js/wpo/fe-calc-wpo.js");
 
 importScript("js/jsonformat/json-format-dealer.js");

+ 0 - 70
chrome/static/js/notification/fe-notification.js

@@ -1,70 +0,0 @@
-/**
- * 桌面提醒
- * @author zhaoxianlie
- */
-baidu.feNotification = (function(){
-	
-	/**
-	 * html式,可以简单的用查询变量传递参数
-	 * @param {string} notify_file 提醒页面路径:相对路径
-	 */
-	var notifyHtml = function(notify_file) {
-        if(!window.webkitNotifications) {
-            return;
-        }
-	    var encode = encodeURIComponent;
-	    var notification = webkitNotifications.createHTMLNotification(
-	        chrome.extension.getURL(notify_file)
-	    );
-	    notification.show();
-
-	    return notification;
-	};
-
-	/**
-	 * 文本格式,可以设置一个图标和标题
-	 * @param {Object} options
-	 * @config {string} type notification的类型,可选值:html、text
-	 * @config {string} icon 图标
-	 * @config {string} title 标题
-	 * @config {string} message 内容
-	 */
-	var notifyText = function(options){
-        if(!window.webkitNotifications) {
-            return;
-        }
-		if(!options.icon) {
-			options.icon = "static/img/fe-48.png";
-		}
-		if(!options.title) {
-			options.title = "\u5C0F\u63D0\u793A";
-		}
-		//创建提醒
-	    var notification = webkitNotifications.createNotification(
-	        chrome.runtime.getURL(options.icon),
-	        options.title,
-	        options.message
-	    );
-	    notification.show();
-
-	    //是否配置了自动关闭
-	    if(options.autoClose !== false) {
-		    // 显示完之后默认5秒关闭,具体还要看用户是否进行了自定义配置
-		    notification.ondisplay = function(e) {
-				var userComstomNotificationTime = localStorage.getItem("opt_item_notification");
-		        setTimeout(function() { notification.cancel(); }, userComstomNotificationTime || 5000);
-		    }
-	    }
-
-	    return notification;
-	};
-	
-	return {
-		notifyHtml : notifyHtml,
-		notifyText : notifyText
-	};
-})();
-
-
-
-

+ 1 - 1
chrome/static/js/wpo/fe-wpo.js

@@ -14,7 +14,7 @@ baidu.pageLoadTime = (function(){
 	var init = function(){
         // 获得wpo信息
         var wpoStr = decodeURIComponent(location.search.substring(1));
-        var wpo = JSON.parse(wpoStr);
+        var wpo = JSON.parse(decodeURIComponent(atob(wpoStr)));
 
         // 页面信息
         document.getElementById("pageTitle").innerHTML = wpo.pageInfo.title || "无";

File diff suppressed because it is too large
+ 0 - 0
chrome/template/fehelper_options.html


Some files were not shown because too many files changed in this diff