Skip to content

Commit

Permalink
加入 adLinks,隨機顯示廣告連結
Browse files Browse the repository at this point in the history
  • Loading branch information
joe committed Dec 14, 2024
1 parent 5081f54 commit 18d94e0
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 52 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -747,14 +747,21 @@ ChatGPT 雖然很厲害,但也有它的極限,所以我們要加強自己的

### 1.3.5 版

送審日期:2024/12/12
通過日期:2024/12/13
送審日期:2024/12/12
通過日期:2024/12/13

- 加入 ig 連結,並隨機顯示 ig 或 pinkoi 連結

### 1.3.6 版

送審日期:2024/12/13
通過日期:2024/12/15
送審日期:2024/12/13
通過日期:2024/12/15

- 去除限制 TW 才顯示連結

### 1.3.7 版

送審日期:2024/12/14
通過日期:2024/12/16

- 去除限制 TW 才顯示連結
- 加入 adLinks,隨機顯示廣告連結
84 changes: 38 additions & 46 deletions js/content.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,37 @@ const supportGemini = !window.location.href.includes("chatgpt.com");
const supportClaude = window.location.href.includes("claude.ai");
const userLanguage = navigator.language || chrome.i18n.getUILanguage();
const isTW = userLanguage?.includes("zh-TW");
const isShowIgButton = Math.random() < 0.5;

const adLinks = [
`<div class="friend-links">
<a
id="ig-button"
href="https://www.instagram.com/dearfine_metal"
target="_blank"
>
${isTW ? '緻金工 DearFine' : 'DearFine'}
</a>
</div>`,
`<div class="friend-links">
<a
id="pinkoi-button"
href="https://www.pinkoi.com/store/dearfine"
target="_blank"
>
${isTW ? '緻金工 DearFine' : 'DearFine'}
</a>
</div>`,
`<div class="buy-me-a-coffee">
<a href="https://www.buymeacoffee.com/Joe.lin" target="_blank">
<img style="scale: 0.9;" src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=Joe.lin&button_colour=FFDD00&font_colour=000000&font_family=Inter&outline_colour=000000&coffee_colour=ffffff?${new Date().getTime()}" />
</a>
</div>`
]

function getRandomAdLink() {
const randomIndex = Math.floor(Math.random() * adLinks.length);
return adLinks[randomIndex];
}

const supportChatGPT = !supportGemini && !supportClaude;

Expand Down Expand Up @@ -1912,15 +1942,7 @@ function findGroupAndIndex(promptId) {
<button id="dialog-cancel" class="secondary" tabindex="5">${i18n(
"button_cancel"
)} ( esc )</button>
<div class="friend-links">
<a
id="${isShowIgButton ? 'ig-button' : 'pinkoi-button'}"
href="${isShowIgButton ? 'https://www.instagram.com/dearfine_metal' : 'https://www.pinkoi.com/store/dearfine'}"
target="_blank"
>
${isTW ? '緻金工 DearFine' : 'DearFine'}
</a>
</div>
${getRandomAdLink()}
</div>
</div>
</div>
Expand Down Expand Up @@ -2274,12 +2296,7 @@ function findGroupAndIndex(promptId) {
<button tabindex="100" id="dialog2-cancel" class="secondary">${i18n(
"button_cancel"
)} ( esc ) </button>
<div class="buy-me-a-coffee">
<a href="https://www.buymeacoffee.com/Joe.lin" target="_blank">
<img style="scale: 0.9;"
src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=Joe.lin&button_colour=FFDD00&font_colour=000000&font_family=Inter&outline_colour=000000&coffee_colour=ffffff?${new Date().getTime()}" />
</a>
</div>
${getRandomAdLink()}
</div>
</div>
Expand Down Expand Up @@ -2683,11 +2700,7 @@ function findGroupAndIndex(promptId) {
<button tabindex="1000" id="dialog4-cancel" class="secondary">${i18n(
"button_cancel"
)} ( esc ) </button>
<div class="buy-me-a-coffee">
<a href="https://www.buymeacoffee.com/Joe.lin" target="_blank">
<img style="scale: 0.9;" src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=Joe.lin&button_colour=FFDD00&font_colour=000000&font_family=Inter&outline_colour=000000&coffee_colour=ffffff?${new Date().getTime()}" />
</a>
</div>
${getRandomAdLink()}
</div>
</div>
Expand Down Expand Up @@ -2744,11 +2757,7 @@ function findGroupAndIndex(promptId) {
<button id="dialog5-cancel" class="secondary">${i18n(
"button_close"
)} ( esc ) </button>
<div class="buy-me-a-coffee">
<a href="https://www.buymeacoffee.com/Joe.lin" target="_blank">
<img style="scale: 0.9;" src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=Joe.lin&button_colour=FFDD00&font_colour=000000&font_family=Inter&outline_colour=000000&coffee_colour=ffffff?${new Date().getTime()}" />
</a>
</div>
${getRandomAdLink()}
</div>
</div>
Expand Down Expand Up @@ -2836,12 +2845,7 @@ function findGroupAndIndex(promptId) {
<button tabindex="1000" id="dialog6-cancel" class="secondary">${i18n(
"button_cancel"
)} ( esc ) </button>
<div class="buy-me-a-coffee">
<a href="https://www.buymeacoffee.com/Joe.lin" target="_blank">
<img style="scale: 0.9;"
src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=Joe.lin&button_colour=FFDD00&font_colour=000000&font_family=Inter&outline_colour=000000&coffee_colour=ffffff?${new Date().getTime()}" />
</a>
</div>
${getRandomAdLink()}
</div>
</div>
</div>
Expand Down Expand Up @@ -2869,15 +2873,7 @@ function findGroupAndIndex(promptId) {
<button tabindex="100" id="dialog7-cancel" class="secondary">${i18n(
"button_cancel"
)} ( esc ) </button>
<div class="friend-links">
<a
id="${isShowIgButton ? 'ig-button' : 'pinkoi-button'}"
href="${isShowIgButton ? 'https://www.instagram.com/dearfine_metal' : 'https://www.pinkoi.com/store/dearfine'}"
target="_blank"
>
${isTW ? '緻金工 DearFine' : 'DearFine'}
</a>
</div>
${getRandomAdLink()}
</div>
</div>
</div>
Expand All @@ -2895,11 +2891,7 @@ function findGroupAndIndex(promptId) {
<button tabindex="100" id="dialog8-cancel" class="secondary">${i18n(
"button_cancel"
)} ( esc ) </button>
<div class="buy-me-a-coffee">
<a href="https://www.buymeacoffee.com/Joe.lin" target="_blank">
<img style="scale: 0.9;" src="https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=Joe.lin&button_colour=FFDD00&font_colour=000000&font_family=Inter&outline_colour=000000&coffee_colour=ffffff?${new Date().getTime()}" />
</a>
</div>
${getRandomAdLink()}
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"name": "__MSG_extension_name__",
"description": "__MSG_extension_description__",
"author": "Joe",
"version": "1.3.6",
"version": "1.3.7",
"default_locale": "en",
"icons": {
"16": "images/icon/16.png",
Expand Down

0 comments on commit 18d94e0

Please sign in to comment.