From a14c791ea4378ff23655f51cd10505aa016b60b9 Mon Sep 17 00:00:00 2001 From: scoful <1269717999@qq.com> Date: Tue, 7 Jan 2020 18:39:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dbug=EF=BC=8C=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- css/popup.css | 4 ++-- js/background.js | 6 ++++-- js/popup.js | 18 ++++++++++++++++-- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index d6b0cd8..25b5aba 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ 6. 点击插件图标,列出当前所有打开的tab的标题,并可以直接点击标题切换、关闭 7. 集成json工具页,目前只有格式化json功能 8. 匹配广州图书馆wifi登录页,登录后会自动2小时倒计时弹窗提醒(广图的wifi有效期2小时) -9. 匹配百度网盘外链转存页,支持不需勾选一键转存,打破超过3000文件数限制 +9. 匹配百度网盘外链转存页,支持不需勾选一键转存,打破超过3000文件数限制(只支持最新的外链分享,即那种生成分享链接和提取码的方式) 10. 中英国际化切换,渣渣英语,渣渣翻译,包涵包涵 @@ -128,7 +128,7 @@ 格式化json结构 -14. 匹配百度网盘 +14. 匹配百度网盘(只支持最新的外链分享,即那种生成分享链接和提取码的方式) 在打开链接为https://pan.baidu.com/s/ 才会触发,页面上多一个按钮,不用勾选要转存的文件,直接点击按钮,默认一次性转存这个外链分享的所有文件,用于突破百度网盘的文件外链转存个数限制(目前是一个文件夹调用一次转存api,效率有点低,还需多多测试) diff --git a/css/popup.css b/css/popup.css index d3730e6..f5b53e0 100644 --- a/css/popup.css +++ b/css/popup.css @@ -1,6 +1,6 @@ .menu-entry { text-align: center; - font-size: 13px; + font-size: 100%; background: #fefefe; padding: 10px; } @@ -28,7 +28,7 @@ .row{ border-top: 1px solid #eee; - font-size: 13px; + font-size: 100%; } .delete-link { diff --git a/js/background.js b/js/background.js index 603fef0..2bf7f7a 100644 --- a/js/background.js +++ b/js/background.js @@ -397,8 +397,10 @@ function translateFunc(txt) { url: url, success: function (data, status) { if (status == "success") { - console.log(data.translation[0]); - sendMessageToContentScript("translateResult", data.translation[0]); + if (data.translation) { + console.log(data.translation[0]); + sendMessageToContentScript("translateResult", data.translation[0]); + } } else { sendMessageToContentScript("translateResult", "--FAILED--!"); } diff --git a/js/popup.js b/js/popup.js index a793b18..5f52cd6 100644 --- a/js/popup.js +++ b/js/popup.js @@ -211,6 +211,16 @@ tabs.view = function () { return tabs.vm.list.map(function (tab, i) { + var favIconUrl = tab.favIconUrl + if (favIconUrl && typeof (favIconUrl) != undefined && favIconUrl.indexOf("chrome") != -1) { + favIconUrl = "./images/48.png" + } + if (!favIconUrl) { + favIconUrl = "./images/48.png" + } + if (typeof (favIconUrl) == undefined) { + favIconUrl = "./images/48.png" + } return m('div.row', { onclick: function () { chrome.tabs.highlight({ tabs: i }, function callback() { @@ -222,8 +232,12 @@ tabs.vm.rmTab(i); event.stopPropagation(); } - }), m('img', { src: tab.favIconUrl, height: '10', width: '10' }), - ' ', m("span", {}, tab.title)]) + }), + m('img', { + src: favIconUrl, height: '15', width: '15' + }), + ' ', + m("span", {}, tab.title)]) ]); }); };