diff --git a/README.md b/README.md index cfa9f50..fa06e9c 100644 --- a/README.md +++ b/README.md @@ -785,4 +785,11 @@ ChatGPT 雖然很厲害,但也有它的極限,所以我們要加強自己的 送審日期:2024/12/19 通過日期:2024/12/21 -- 增加 AD 輪撥功能 \ No newline at end of file +- 增加 AD 輪撥功能 + +### 1.4.1 版 + +送審日期:2024/12/21 +通過日期:2024/12/23 + +- 調整 pt 取得來源 \ No newline at end of file diff --git a/js/content.js b/js/content.js index fb26ce8..70189b5 100644 --- a/js/content.js +++ b/js/content.js @@ -3,98 +3,57 @@ const supportClaude = window.location.href.includes("claude.ai"); const userLanguage = navigator.language || chrome.i18n.getUILanguage(); const isTW = userLanguage?.includes("zh-TW"); -const adLinks = [ - ` - ${isTW ? '緻金工 DearFine' : 'DearFine'} - - `, - ` - - - `, - ` - ${isTW ? '緻金工 DearFine' : 'DearFine'} - - `, - ` - - ${isTW ? '緻金工 DearFine' : 'DearFine'} - - `, - ` - - ${isTW ? '緻金工 💍 🌼 🆕' : 'DearFine 💍 🌼 🆕'} - - `, - ` - - ${isTW ? '緻金工 🌼 ✨' : 'DearFine 🌼 ✨'} - - `, - ` - ${isTW ? '緻金工 🦋 ✨' : 'DearFine 🦋 ✨'} - `, - ` - ${isTW ? '緻金工 💍 ✨' : 'DearFine 💍 ✨'} - - `, - ` - ${isTW ? '緻金工 💍 💍 ✨' : 'DearFine 💍 💍 ✨'} - - `, +const defaultPtItem = ` + + +`; + +const ptLinks = [ + defaultPtItem ] +fetch('https://raw.githubusercontent.com/JiaHongL/chat-prompt-configs/refs/heads/main/prompt-config.json?'+new Date().getTime()) + .then(response => { + if (!response?.ok) { + throw new Error(`HTTP error! status: ${response.status}`); + } + return response?.json(); // 將 Response 轉換為 JSON 格式 + }) + .then(data => { + data?.forEach((pt) => { + ptLinks.push(` + + ${isTW ? pt.labelTW : pt.labelEN } + + `); + }) + }) + .then(() => { + getRandomPTLink(); + if(ptLinks.length > 1){ + setInterval(() => { + getRandomPTLink(); + },8000) + } + }) + .catch(error => console.error('載入失敗:', error.message)); + let preRandomIndex = null; -function getRandomAdLink() { - const randomIndex = Math.floor(Math.random() * adLinks.length); +function getRandomPTLink() { + const randomIndex = Math.floor(Math.random() * ptLinks.length); if (preRandomIndex === randomIndex) { - return getRandomAdLink(); + return getRandomPTLink(); } - document.querySelectorAll('.friend-links-2024-12-19-sun-o-ad').forEach((element) => { - element.innerHTML = adLinks[randomIndex]; + document.querySelectorAll('.sun-o-pt-12-25').forEach((element) => { + element.innerHTML = ptLinks[randomIndex]; }); } -setTimeout(() => { - getRandomAdLink(); - setInterval(() => { - getRandomAdLink(); - },7000) -},200); - const supportChatGPT = !supportGemini && !supportClaude; if (supportGemini) { @@ -1502,7 +1461,7 @@ function findGroupAndIndex(promptId) { align-items: center; padding:20px 0px; } - .footer .friend-links-2024-12-19-sun-o-ad { + .footer .sun-o-pt-12-25 { position: absolute; right: 0; } @@ -2020,7 +1979,7 @@ function findGroupAndIndex(promptId) { - +
@@ -2374,7 +2333,7 @@ function findGroupAndIndex(promptId) { - +
@@ -2778,7 +2737,7 @@ function findGroupAndIndex(promptId) { - +
@@ -2835,7 +2794,7 @@ function findGroupAndIndex(promptId) { - +
@@ -2923,7 +2882,7 @@ function findGroupAndIndex(promptId) { - +
@@ -2951,7 +2910,7 @@ function findGroupAndIndex(promptId) { - +
@@ -2969,7 +2928,7 @@ function findGroupAndIndex(promptId) { - +
diff --git a/manifest.json b/manifest.json index 028b57c..6667493 100644 --- a/manifest.json +++ b/manifest.json @@ -3,7 +3,7 @@ "name": "__MSG_extension_name__", "description": "__MSG_extension_description__", "author": "Joe", - "version": "1.4.0", + "version": "1.4.1", "default_locale": "en", "icons": { "16": "images/icon/16.png",