From f0d9878a941ef60baa19bf67ec07c66844df3b9e Mon Sep 17 00:00:00 2001 From: qcrao Date: Fri, 20 Oct 2023 11:33:13 +0800 Subject: [PATCH] add Sponsor button --- background.js | 5 +++++ manifest.json | 6 +++++- popup.css | 48 +++++++++++++++++++++++++++++++++++++++--------- popup.html | 10 +++++++++- 4 files changed, 58 insertions(+), 11 deletions(-) create mode 100644 background.js diff --git a/background.js b/background.js new file mode 100644 index 0000000..80441e6 --- /dev/null +++ b/background.js @@ -0,0 +1,5 @@ +chrome.runtime.onMessage.addListener((message, sender, sendResponse) => { + if (message.action === "openTab") { + chrome.tabs.create({url: message.url}); + } +}); diff --git a/manifest.json b/manifest.json index 3114f4f..4a2789d 100644 --- a/manifest.json +++ b/manifest.json @@ -13,8 +13,12 @@ }, "permissions": [ "scripting", - "activeTab" + "activeTab", + "tabs" ], + "background": { + "service_worker": "background.js" + }, "content_scripts": [ { "matches": [ diff --git a/popup.css b/popup.css index 32c5fef..e49a1f3 100644 --- a/popup.css +++ b/popup.css @@ -79,15 +79,45 @@ body { text-align: center; border-top: 1px solid #ccc; padding-top: 10px; + display: flex; /* 添加这一行使得.footer下的直接子元素并排排列 */ + justify-content: center; /* 使得子元素在中心对齐 */ + gap: 10px; /* 如果需要,可以添加这一行以在子元素之间创建一些空间 */ } - button#remove-checkboxes { - background-color: #badb34; - border-color: #b6b929; - } +.footer button { + font-size: inherit; /* 这行代码使按钮的字体大小继承自其父元素,即.footer */ + background-color: #383E46; + border-color: #78838F; +} - button#toggle-checkboxes { - background-color: #2287da; - border-color: #2758ab; - } - \ No newline at end of file +button#remove-checkboxes { + background-color: #badb34; + border-color: #b6b929; +} + +button#toggle-checkboxes { + background-color: #2287da; + border-color: #2758ab; +} + +#sponsorLink { + display: inline-flex; + align-items: center; + padding: 10px 20px; + background-color: #383E46; + border-color: #78838F; + border-radius: 5px; + color: #fff; + text-decoration: none; + cursor: pointer; + transition: background-color 0.3s ease; +} + +#sponsorLink .icon-text { + display: flex; + align-items: center; +} + +#sponsorLink:hover { + background-color: #993366; +} \ No newline at end of file diff --git a/popup.html b/popup.html index 598b412..8d2cc6d 100644 --- a/popup.html +++ b/popup.html @@ -17,10 +17,18 @@ - + + +