From 7015e3e3b5dcb02d59af45d2ce003e462b7c0300 Mon Sep 17 00:00:00 2001 From: XimilalaXiang <199751282+XimilalaXiang@users.noreply.github.com> Date: Thu, 21 May 2026 04:26:52 +0000 Subject: [PATCH 1/2] feat: add X (Twitter) as a new search engine option - Add X search URL (x.com/search?q=) as engine10 in search.js - Add X logo SVG icon in index.html - Add dropdown item and radio button option for X in settings - Register xEngine in translationMap and elementsMap in languages.js - Add xEngine translation key to all 26 locale files - Update CHANGELOG.md Co-authored-by: Cursor --- CHANGELOG.md | 1 + index.html | 22 ++++++++++++++++++++++ locales/ar_SA.js | 1 + locales/bn.js | 1 + locales/cs.js | 1 + locales/de.js | 1 + locales/el.js | 1 + locales/en.js | 1 + locales/es.js | 1 + locales/fa.js | 1 + locales/fr.js | 1 + locales/hi.js | 1 + locales/hu.js | 1 + locales/idn.js | 1 + locales/it.js | 1 + locales/ja.js | 1 + locales/ko.js | 1 + locales/mr.js | 1 + locales/pl.js | 1 + locales/pt.js | 1 + locales/ru.js | 1 + locales/sv.js | 1 + locales/ta.js | 1 + locales/th.js | 1 + locales/uk.js | 1 + locales/uz.js | 1 + locales/zh.js | 1 + locales/zh_TW.js | 1 + scripts/languages.js | 2 ++ scripts/search.js | 3 ++- 30 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 773dce90..8baf3b4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ and this project partially follows [Semantic Versioning](https://semver.org/spec ### Added +- Added X (Twitter) as a new search engine option with full localization support ([@XimilalaXiang](https://github.com/XimilalaXiang)) - Added support for touch-swipe and mouse-wheel gestures on the search engine icon to switch search engines when they are hidden ([@prem-k-r](https://github.com/prem-k-r)) ([#145](https://github.com/prem-k-r/MaterialYouNewTab/pull/145)) - Added support for custom shortcut icons via upload, URL, or pasted SVG ([@smurf11k](https://github.com/smurf11k)), ([@prem-k-r](https://github.com/prem-k-r)) ([#187](https://github.com/prem-k-r/MaterialYouNewTab/pull/187/)), ([#199](https://github.com/prem-k-r/MaterialYouNewTab/pull/199/)) - Added Daily Quote option to show one quote per day instead of refreshing on every new tab ([@KomeshBathula](https://github.com/KomeshBathula)) ([#141](https://github.com/prem-k-r/MaterialYouNewTab/pull/141)) diff --git a/index.html b/index.html index 39a32e34..0766a0dc 100644 --- a/index.html +++ b/index.html @@ -770,6 +770,13 @@

Edit Bookmark

Quora + + @@ -864,6 +871,13 @@

Edit Bookmark

+ + + + + + +
+ + + + + +
+ diff --git a/locales/ar_SA.js b/locales/ar_SA.js index 9a035e02..b2b8e8af 100644 --- a/locales/ar_SA.js +++ b/locales/ar_SA.js @@ -147,6 +147,7 @@ const ar_SA = { redditEngine: "ريديت", wikipediaEngine: "ويكيبيديا", quoraEngine: "كورا", + xEngine: "X", // AI Tools ai_tools: "أدوات الذكاء الاصطناعي", diff --git a/locales/bn.js b/locales/bn.js index 450cf07f..28df0b8e 100644 --- a/locales/bn.js +++ b/locales/bn.js @@ -151,6 +151,7 @@ const bn = { "redditEngine": "রেডিট", "wikipediaEngine": "উইকিপিডিয়া", "quoraEngine": "কোরা", + "xEngine": "X", // AI Tools "ai_tools": "এআই টুলস", diff --git a/locales/cs.js b/locales/cs.js index 63c6a1b4..73344cd3 100644 --- a/locales/cs.js +++ b/locales/cs.js @@ -150,6 +150,7 @@ const cs = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedie", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AI nástroje", diff --git a/locales/de.js b/locales/de.js index c2c7d0af..3847672f 100644 --- a/locales/de.js +++ b/locales/de.js @@ -132,6 +132,7 @@ const de = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "KI-Werkzeuge", diff --git a/locales/el.js b/locales/el.js index a31a6a84..57e14d28 100644 --- a/locales/el.js +++ b/locales/el.js @@ -134,6 +134,7 @@ const el = { "redditEngine": "Reddit", "wikipediaEngine": "Βικιπαίδεια", "quoraEngine": "Quora", + "xEngine": "X", // Εργαλεία AI "ai_tools": "Εργαλεία AI", diff --git a/locales/en.js b/locales/en.js index 0c62fa36..6c39f582 100644 --- a/locales/en.js +++ b/locales/en.js @@ -149,6 +149,7 @@ const en = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AI Tools", diff --git a/locales/es.js b/locales/es.js index ea9ff245..1e80df81 100644 --- a/locales/es.js +++ b/locales/es.js @@ -140,6 +140,7 @@ const es = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "Herramientas de IA", diff --git a/locales/fa.js b/locales/fa.js index ea46aee6..ddf7e0d5 100644 --- a/locales/fa.js +++ b/locales/fa.js @@ -147,6 +147,7 @@ const fa = { redditEngine: "ردیت", wikipediaEngine: "ویکی‌پدیا", quoraEngine: "کورا", + xEngine: "X", // AI Tools ai_tools: "ابزارهای هوش مصنوعی", diff --git a/locales/fr.js b/locales/fr.js index 04cc7884..8f083119 100644 --- a/locales/fr.js +++ b/locales/fr.js @@ -145,6 +145,7 @@ const fr = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "Outils IA", diff --git a/locales/hi.js b/locales/hi.js index 86123300..b32a38df 100644 --- a/locales/hi.js +++ b/locales/hi.js @@ -151,6 +151,7 @@ const hi = { "redditEngine": "रेडिट", "wikipediaEngine": "विकिपीडिया", "quoraEngine": "क्वोरा", + "xEngine": "X", // AI Tools "ai_tools": "AI उपकरण", diff --git a/locales/hu.js b/locales/hu.js index ff8ce56e..66e2eae8 100644 --- a/locales/hu.js +++ b/locales/hu.js @@ -145,6 +145,7 @@ const hu = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "MI Eszközök", diff --git a/locales/idn.js b/locales/idn.js index a722701a..1ff713e7 100644 --- a/locales/idn.js +++ b/locales/idn.js @@ -149,6 +149,7 @@ const idn = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "Utilitas AI", diff --git a/locales/it.js b/locales/it.js index cfe15046..819f10e2 100644 --- a/locales/it.js +++ b/locales/it.js @@ -127,6 +127,7 @@ const it = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "Strumenti IA", diff --git a/locales/ja.js b/locales/ja.js index 9189221e..6532cc7e 100644 --- a/locales/ja.js +++ b/locales/ja.js @@ -149,6 +149,7 @@ const ja = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AIツール", diff --git a/locales/ko.js b/locales/ko.js index db42307f..bc053aaa 100644 --- a/locales/ko.js +++ b/locales/ko.js @@ -132,6 +132,7 @@ const ko = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AI 도구", diff --git a/locales/mr.js b/locales/mr.js index f48a7aef..02f54c6f 100644 --- a/locales/mr.js +++ b/locales/mr.js @@ -142,6 +142,7 @@ const mr = { "redditEngine": "रेडिट", "wikipediaEngine": "विकिपीडिया", "quoraEngine": "क्वोरा", + "xEngine": "X", // AI Tools "ai_tools": "AI साधने", diff --git a/locales/pl.js b/locales/pl.js index 7812e2f1..199526a2 100644 --- a/locales/pl.js +++ b/locales/pl.js @@ -132,6 +132,7 @@ const pl = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "Narzędzia AI", diff --git a/locales/pt.js b/locales/pt.js index 31fd6e79..6591d48b 100644 --- a/locales/pt.js +++ b/locales/pt.js @@ -132,6 +132,7 @@ const pt = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipédia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "Ferramentas de IA", diff --git a/locales/ru.js b/locales/ru.js index 8d1c5ac0..2b5a996c 100644 --- a/locales/ru.js +++ b/locales/ru.js @@ -141,6 +141,7 @@ const ru = { "redditEngine": "Reddit", "wikipediaEngine": "Википедия", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "Нейросети", diff --git a/locales/sv.js b/locales/sv.js index 1796c501..43c72d4e 100644 --- a/locales/sv.js +++ b/locales/sv.js @@ -138,6 +138,7 @@ const sv = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AI-verktyg", diff --git a/locales/ta.js b/locales/ta.js index 21758713..4274967c 100644 --- a/locales/ta.js +++ b/locales/ta.js @@ -132,6 +132,7 @@ const ta = { "redditEngine": "ரெடிட்", "wikipediaEngine": "விக்கிப்பீடியா", "quoraEngine": "கோரா", + "xEngine": "X", // AI Tools "ai_tools": "செஅ கருவிகள்", diff --git a/locales/th.js b/locales/th.js index 721e58e9..dd237926 100644 --- a/locales/th.js +++ b/locales/th.js @@ -131,6 +131,7 @@ const th = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "เครื่องมือ AI", diff --git a/locales/uk.js b/locales/uk.js index 88e48177..7b8342f3 100644 --- a/locales/uk.js +++ b/locales/uk.js @@ -141,6 +141,7 @@ const uk = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AI Інструменти", diff --git a/locales/uz.js b/locales/uz.js index 1856d86b..17d717da 100644 --- a/locales/uz.js +++ b/locales/uz.js @@ -141,6 +141,7 @@ const uz = { "redditEngine": "Reddit", "wikipediaEngine": "Wikipedia", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AI Vositalari", diff --git a/locales/zh.js b/locales/zh.js index 1a63062c..17ea33c5 100644 --- a/locales/zh.js +++ b/locales/zh.js @@ -132,6 +132,7 @@ const zh = { "redditEngine": "Reddit", "wikipediaEngine": "维基百科", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AI工具", diff --git a/locales/zh_TW.js b/locales/zh_TW.js index 6a689a1a..59c8112d 100644 --- a/locales/zh_TW.js +++ b/locales/zh_TW.js @@ -132,6 +132,7 @@ const zh_TW = { "redditEngine": "Reddit", "wikipediaEngine": "維基百科", "quoraEngine": "Quora", + "xEngine": "X", // AI Tools "ai_tools": "AI 工具", diff --git a/scripts/languages.js b/scripts/languages.js index 2ba01e09..a25507d3 100644 --- a/scripts/languages.js +++ b/scripts/languages.js @@ -192,6 +192,7 @@ function applyLanguage(lang) { "redditEngine", "wikipediaEngine", "quoraEngine", + "xEngine", "chatGPT", "gemini", "copilot", @@ -268,6 +269,7 @@ function applyLanguage(lang) { { id: "redditEngineDD", key: "redditEngine" }, { id: "wikipediaEngineDD", key: "wikipediaEngine" }, { id: "quoraEngineDD", key: "quoraEngine" }, + { id: "xEngineDD", key: "xEngine" }, { id: "bookmarksHover", key: "bookmarksHeading" }, { id: "saveproxy", key: "saveAPI" }, { id: "saveLoc", key: "saveAPI" }, diff --git a/scripts/search.js b/scripts/search.js index b1b8f7a7..53d325c4 100644 --- a/scripts/search.js +++ b/scripts/search.js @@ -19,7 +19,8 @@ const searchQueryURLs = { engine6: "https://www.google.com/search?tbm=isch&q=", engine7: "https://www.reddit.com/search/?q=", engine8: `https://${languageCode}.wikipedia.org/wiki/Special:Search?search=`, - engine9: "https://www.quora.com/search?q=" + engine9: "https://www.quora.com/search?q=", + engine10: "https://x.com/search?q=" }; // Showing border or outline when you click on the searchbar From 08ee1c7796b642794d07caeff73415647a5b0ced Mon Sep 17 00:00:00 2001 From: XimilalaXiang <199751282+XimilalaXiang@users.noreply.github.com> Date: Thu, 21 May 2026 04:48:03 +0000 Subject: [PATCH 2/2] fix: use replace instead of charAt for engine number parsing Fix single-character engine ID extraction that breaks engine10. The previous code used charAt(value.length - 1) which only reads the last character, causing engine10 to be parsed as "0" instead of "10". Replace all 4 occurrences with replace("engine", "") to correctly handle multi-digit engine numbers. Co-authored-by: Cursor --- scripts/search.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/search.js b/scripts/search.js index 53d325c4..34e3f3e3 100644 --- a/scripts/search.js +++ b/scripts/search.js @@ -167,7 +167,7 @@ document.querySelectorAll(".search-engine").forEach((engineDiv) => { radioButton.checked = true; - const radioButtonValue = radioButton.value.charAt(radioButton.value.length - 1); + const radioButtonValue = radioButton.value.replace("engine", ""); const selector = `[data-engine="${radioButtonValue}"]`; @@ -238,8 +238,7 @@ const storedSearchEngine = localStorage.getItem(`selectedSearchEngine-${activeSe toggleSearchEngines(activeSearchMode); if (storedSearchEngine) { - // Find Serial Number - SN with the help of charAt. - const storedSearchEngineSN = storedSearchEngine.charAt(storedSearchEngine.length - 1); + const storedSearchEngineSN = storedSearchEngine.replace("engine", ""); const defaultDropdownSN = document.querySelector("*[data-default]").getAttribute("data-engine"); // check if the default selected search engine is same as the stored one. @@ -374,8 +373,7 @@ hideSearchWith.addEventListener("change", (e) => { const selectedRadioButton = document.querySelector(`input[name="search-engine"][value="${storedSearchEngine}"]`); selectedRadioButton.checked = true; - // Ensure UI is updated properly - const storedSearchEngineSN = storedSearchEngine.charAt(storedSearchEngine.length - 1); + const storedSearchEngineSN = storedSearchEngine.replace("engine", ""); const selector = `*[data-engine="${storedSearchEngineSN}"]`; swapDropdown(selector); @@ -450,7 +448,7 @@ function switchEngine(direction) { setTimeout(() => { radioButton.checked = true; - const radioButtonValue = radioButton.value.charAt(radioButton.value.length - 1); + const radioButtonValue = radioButton.value.replace("engine", ""); const selector = `[data-engine="${radioButtonValue}"]`; swapDropdown(selector);