diff --git a/README.md b/README.md index f9f0155..940f7a1 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ 2. 增加新标签页打开的选项。 3. 修复快捷键问题。 4. 选项页修改了保存按钮。 +5. 给按钮增加了一个外框,用以区分其他插件。 - ### 2.1.0 更新一波图标,默认增加抖音 diff --git a/bg.js b/bg.js index a318c94..b95cf5f 100644 --- a/bg.js +++ b/bg.js @@ -443,12 +443,38 @@ var OneClick = Class(ObjectClass, { setShortcut: function (s) { localStorage.setItem(('shortcut'), s); }, - // move to an action proxy if necessary; + setIogo: function (tab, path) { + console.log("setting logo..."); + var cvs = document.createElement('canvas'); + var img = document.createElement('img'); + img.onload = function () { + var ctx = cvs.getContext('2d'); + ctx.globalAlpha = 0.7; + var upPath = new Path2D(); + upPath.roundRect(0, 0, 32, 16, [7.5, 7.5, 0, 0]); + ctx.fillStyle = "#fff"; + ctx.fill(upPath, "evenodd"); + + var downPath = new Path2D(); + downPath.roundRect(0, 16, 32, 16, [0, 0, 7.5, 7.5]); + ctx.fillStyle = "#000"; + ctx.fill(downPath, "evenodd"); + + ctx.globalAlpha = 1; + ctx.drawImage(img, 2, 2, 28, 28); + chrome.pageAction.setIcon({ + imageData: ctx.getImageData(0, 0, 32, 32), + tabId: tab.id + }); + }; + img.src = path; + }, swichSupport: function (tab, site) { - chrome.pageAction.setIcon({ - tabId: tab.id, - path: site.getIcon() - }); + // chrome.pageAction.setIcon({ + // tabId: tab.id, + // path: site.getIcon() + // }); + this.setIogo(tab, site.getIcon()); chrome.pageAction.setTitle({ tabId: tab.id, title: site.getTip() @@ -534,4 +560,4 @@ var App = new OneClick(); function main() { App.start(); } -main(); +main(); \ No newline at end of file diff --git a/icon/baidu.png b/icon/baidu.png index 98ff521..2118f03 100644 Binary files a/icon/baidu.png and b/icon/baidu.png differ diff --git a/manifest.json b/manifest.json index 69dcd2c..5deef2c 100644 --- a/manifest.json +++ b/manifest.json @@ -25,5 +25,5 @@ "*://*/*" ], "short_name": "一键切换", - "version": "2.3.4" + "version": "2.3.5" } \ No newline at end of file