From 585f500e91a5751d4c4dc0763204efe12b6a6dc6 Mon Sep 17 00:00:00 2001 From: Jomic Date: Thu, 30 May 2024 23:52:00 +0800 Subject: [PATCH] add background broad of the button icon --- README.md | 1 + bg.js | 38 ++++++++++++++++++++++++++++++++------ icon/baidu.png | Bin 2624 -> 2232 bytes manifest.json | 2 +- 4 files changed, 34 insertions(+), 7 deletions(-) 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 98ff521601f8a8ab9f9637d4786470fa0a56cc1f..2118f033c5666ff83eb3562f1c06a2cabb69f7b1 100644 GIT binary patch delta 2208 zcmV;R2w(TW6u1$PFnBkoCFk$l`P`~i%zy9}%~mvZ6}NHYGl@*b z=gpt5RQEP-uKLP>xv{YYS@*0W6tIO8WHS8fnk74XN?##oHzUSEvJL#=DE0_(zYZJ}qrVCyA8Nu3E0V{d1T%u3+t2b2~9Nl2g=Z zYBC`{R$^q7l?Z;dCV2v zVWE%$oCzQVXlMqWl)nZjE7M=iJgEu(%Ze6sIA6qg9zINv6f!h3F*erfnI$=0IUX#N z?eiWDy@7*VN|1kCa}tMs&!s&7neEMcY63Tv&F{~~N04UN|94;-#t z0mhDHV$Pp;IN2qD#HQN*m56@I)v$n+09x}s46?|-ZezoEnUu@^WPt_&q3!p|@Boej zgaSaX2h@6k$OvKN{_VDB+f}H}1AmL4j$Cu+3$Lf_aR_{87j#`nKzw}Npy~0#Gf@*7 zJpxBk7Po6N0va6$iwGPb5fc;_n2`910741nvUQzZXIldQa|2u|yUO3A6(=S(DJD&( zO2#y4A;5>ho*i~5uQVWNWIcR*0hWcOYoro_!mBJ+eIo|NQ0`x^w14UH&|WLB zd7CE4%@ui3QH}8S0qz!ah>2s6b<_bBRR(yt)xmWr@KVdcPEIT}A>aeI3Ro=oqX_*R znMq$Qw?6eQWzFB;sX$Fl+m-LnX+jo!tg&qK3!xwu0-o*+l6Tmnv`i0gujh!KLPIDd zD62A}SqJoYpy2F8<5FH5Tz{Ns`1=XwZ~U9h-giNC2~b^aIFtIV`UA5mdHPcLdPN^Z zjIn}3PFvo4iXuM()S=|I9Xve*m^SkXP8@B;(F{4_rYew{)_^%5s)2qyY+5PKUiz7J zRIh4a-yy9hF}9V?oudZi1Sh{$AbNt#(#sDXw1Qy>Tn6z`TCRt;XMY{a%I)FdEu6fw+Vx$VfNfc$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