Kaynağa Gözat

wpo bug fix

Alien 11 yıl önce
ebeveyn
işleme
92bed90ac2

+ 1 - 1
chrome/manifest.json

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

+ 1 - 1
chrome/online.manifest.json

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

+ 1 - 0
chrome/static/css/fe-helper.css

@@ -61,6 +61,7 @@
 #fe-helper-main-tab .rst-content .x-tag{
 	color:#00f;
 	font-weight:bold;
+    word-wrap: break-word;
 }
 #fe-helper-main-tab .rst-content .x-attr{
 	color:#b00;

+ 5 - 3
chrome/static/js/fe-background.js

@@ -67,13 +67,15 @@ var BgPageInstance = (function(){
 	 */
 	var _showPageWpoInfo = function(wpoInfo){
 		chrome.tabs.getSelected(null,function(tab){
-			_notificationCache[tab.id].cancel();	
-			if(!wpoInfo) {
+            try{
+                _notificationCache[tab.id].cancel();
+            }catch (e){}
+            if(!wpoInfo) {
 				baidu.feNotification.notifyText({
 					message : "对不起,检测失败"
 				});	
 			}else{
-                if(webkitNotifications.createHTMLNotification) {
+                if(window.webkitNotifications && webkitNotifications.createHTMLNotification) {
                     baidu.feNotification.notifyHtml("template/fehelper_wpo.html?" + JSON.stringify(wpoInfo));
                 } else {
                     chrome.tabs.create({

+ 6 - 0
chrome/static/js/jsonformat/contentscript-jsonformat.js

@@ -28,6 +28,12 @@ baidu.csJsonFormat = (function () {
         jQuery('<link id="_fehelper_fcp_css_" href="' + fcpCss + '" rel="stylesheet" type="text/css" />').appendTo('head');
     };
 
+    /**
+     * 将escape过的HTML再反解回来
+     * @param txt
+     * @return {String|XML}
+     * @private
+     */
     var _unEscapeHTML = function(txt) {
         return txt.replace(/&amp;/g,'&').replace(/&gt;/g,'>')
             .replace(/&lt;/g,'<').replace(/&quot;/g,'"')

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

@@ -9,6 +9,9 @@ baidu.feNotification = (function(){
 	 * @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)
@@ -27,6 +30,9 @@ baidu.feNotification = (function(){
 	 * @config {string} message 内容
 	 */
 	var notifyText = function(options){
+        if(!window.webkitNotifications) {
+            return;
+        }
 		if(!options.icon) {
 			options.icon = "static/img/fe-48.png";
 		}