├── icons ├── icon_ltr16.png ├── icon_ltr48.png ├── icon_rtl16.png ├── icon_rtl48.png ├── icon_ltr128.png ├── icon_rtl128.png ├── icon_default128.png ├── icon_default16.png └── icon_default48.png ├── manifest.json ├── readme.md └── background.js /icons/icon_ltr16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_ltr16.png -------------------------------------------------------------------------------- /icons/icon_ltr48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_ltr48.png -------------------------------------------------------------------------------- /icons/icon_rtl16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_rtl16.png -------------------------------------------------------------------------------- /icons/icon_rtl48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_rtl48.png -------------------------------------------------------------------------------- /icons/icon_ltr128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_ltr128.png -------------------------------------------------------------------------------- /icons/icon_rtl128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_rtl128.png -------------------------------------------------------------------------------- /icons/icon_default128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_default128.png -------------------------------------------------------------------------------- /icons/icon_default16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_default16.png -------------------------------------------------------------------------------- /icons/icon_default48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diakohamidian/rtl-deep-seek/HEAD/icons/icon_default48.png -------------------------------------------------------------------------------- /manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "manifest_version": 3, 3 | "name": "RTL for Deepseek", 4 | "version": "1.0", 5 | "description": "Toggle RTL direction on chat.deepseek.com and change icon based on state.", 6 | "permissions": ["storage", "scripting", "activeTab"], 7 | "action": { 8 | "default_icon": { 9 | "16": "icons/icon_ltr16.png", 10 | "48": "icons/icon_ltr48.png", 11 | "128": "icons/icon_ltr128.png" 12 | } 13 | }, 14 | "background": { 15 | "service_worker": "background.js" 16 | }, 17 | "icons": { 18 | "16": "icons/icon_ltr16.png", 19 | "48": "icons/icon_ltr48.png", 20 | "128": "icons/icon_ltr128.png" 21 | } 22 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | Here’s a simple explanation and guide for a Chrome extension that toggles the text direction of the website **deepseek.com** from LTR (Left-to-Right) to RTL (Right-to-Left) when the user clicks on the extension. Additionally, I’ll include installation instructions. 2 | 3 | --- 4 | 5 | ### **Extension Purpose** 6 | This Chrome extension allows users to toggle the text direction on the website **deepseek.com** from **LTR** (default direction) to **RTL** (Right-to-Left) for better readability in languages like Persian or Arabic. 7 | 8 | --- 9 | 10 | ### **How It Works** 11 | 1. After installing the extension, a browser icon will appear in the Chrome toolbar. 12 | 2. When visiting **deepseek.com**, click the extension icon. 13 | 3. The extension will switch the website's text direction to **RTL**, making it more suitable for right-to-left languages. 14 | 4. Clicking the icon again will reset the text direction to its default **LTR** layout. 15 | 16 | --- 17 | 18 | ### **How to Install the Extension on Chrome** 19 | 20 | 1. **Download the Extension Files** 21 | - Get the extension files (e.g., `manifest.json`, `popup.html`, `content.js`) from the developer or create them yourself. 22 | 23 | 2. **Enable Developer Mode** 24 | - Open Chrome and navigate to `chrome://extensions/`. 25 | - In the top-right corner, enable the **Developer mode** toggle. 26 | 27 | 3. **Load the Extension** 28 | - Click the **"Load unpacked"** button. 29 | - Select the folder containing the extension files. 30 | 31 | 4. **Use the Extension** 32 | - Visit **deepseek.com**, then click the extension icon in the toolbar to toggle text direction. 33 | 34 | --- 35 | 36 | Let me know if you'd like the actual code for this extension! I can provide a full implementation, including `manifest.json`, `content.js`, and a basic popup interface. -------------------------------------------------------------------------------- /background.js: -------------------------------------------------------------------------------- 1 | function isTargetURL(url) { 2 | return url && typeof url === 'string' && url.includes('chat.deepseek.com'); 3 | } 4 | const DirectionState = { 5 | get(callback) { 6 | chrome.storage.local.get(['isRTL'], (result) => { 7 | callback(result.isRTL || false); 8 | }); 9 | }, 10 | set(isRTL) { 11 | chrome.storage.local.set({ isRTL }); 12 | }, 13 | }; 14 | function updateIcon(isRTL) { 15 | const iconPath = isRTL 16 | ? { "16": "icons/icon_rtl16.png", "48": "icons/icon_rtl48.png", "128": "icons/icon_rtl128.png" } 17 | : { "16": "icons/icon_ltr16.png", "48": "icons/icon_ltr48.png", "128": "icons/icon_ltr128.png" }; 18 | chrome.action.setIcon({ path: iconPath }); 19 | } 20 | function setRTLDirection(isRTL) { 21 | document.documentElement.style.direction = isRTL ? 'rtl' : 'ltr'; 22 | const codeBlocks = document.querySelectorAll('.md-code-block'); 23 | codeBlocks.forEach((block) => (block.style.direction = 'ltr')); 24 | 25 | const observer = new MutationObserver((mutations) => { 26 | mutations.forEach((mutation) => { 27 | mutation.addedNodes.forEach((node) => { 28 | if (node.nodeType === 1 && node.classList.contains('md-code-block')) { 29 | node.style.direction = 'ltr'; 30 | } 31 | }); 32 | }); 33 | }); 34 | 35 | observer.observe(document.body, { childList: true, subtree: true }); 36 | window._rtlObserver = observer; 37 | } 38 | 39 | function stopObserver() { 40 | if (window._rtlObserver) { 41 | window._rtlObserver.disconnect(); 42 | delete window._rtlObserver; 43 | } 44 | } 45 | 46 | function applyStoredDirection(tab) { 47 | if (isTargetURL(tab.url)) { 48 | DirectionState.get((isRTL) => { 49 | chrome.scripting.executeScript({ 50 | target: { tabId: tab.id }, 51 | function: setRTLDirection, 52 | args: [isRTL], 53 | }); 54 | updateIcon(isRTL); 55 | }); 56 | } 57 | } 58 | 59 | chrome.action.onClicked.addListener((tab) => { 60 | if (isTargetURL(tab.url)) { 61 | DirectionState.get((isRTL) => { 62 | const newState = !isRTL; 63 | DirectionState.set(newState); 64 | chrome.scripting.executeScript({ 65 | target: { tabId: tab.id }, 66 | function: setRTLDirection, 67 | args: [newState], 68 | }); 69 | updateIcon(newState); 70 | }); 71 | } else { 72 | chrome.tabs.update(tab.id, { url: 'https://chat.deepseek.com' }); 73 | } 74 | }); 75 | 76 | function handleTabChange(tab) { 77 | if (isTargetURL(tab.url)) { 78 | applyStoredDirection(tab); 79 | } 80 | } 81 | 82 | chrome.tabs.onActivated.addListener((activeInfo) => { 83 | chrome.tabs.get(activeInfo.tabId, handleTabChange); 84 | }); 85 | 86 | chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => { 87 | if (changeInfo.status === 'complete' && isTargetURL(tab.url)) { 88 | handleTabChange(tab); 89 | } 90 | }); 91 | 92 | chrome.storage.onChanged.addListener((changes, namespace) => { 93 | if (namespace === 'local' && changes.isRTL) { 94 | chrome.tabs.query({ active: true, currentWindow: true }, (tabs) => { 95 | const tab = tabs[0]; 96 | applyStoredDirection(tab); 97 | }); 98 | } 99 | }); 100 | 101 | chrome.runtime.onInstalled.addListener(() => { 102 | chrome.storage.local.get(['isRTL'], (result) => { 103 | if (result.isRTL === undefined) { 104 | chrome.storage.local.set({ isRTL: true }); 105 | } 106 | }); 107 | }); 108 | //create by diako :) --------------------------------------------------------------------------------