您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enhance reddit.com with Arabic support
// ==UserScript== // @name Arabic Reddit Enhancements // @namespace http://tampermonkey.net/ // @version 0.1 // @description Enhance reddit.com with Arabic support // @author You // @match *://*.reddit.com/* // @grant none // ==/UserScript== (function () { 'use strict'; function logger(text) { console.log(`Arabic Reddit: ${text}`); } function fixDir() { logger(`fixing dir`); const allTags = document.querySelectorAll("*"); allTags.forEach((e) => e.setAttribute("dir", "auto")); // check if it works in development if (typeof GM_info !== "undefined") { addStyle(` :dir(rtl) { background-color: red; }`); } // Create an observer instance const observer = new MutationObserver((mutations) => { mutations.forEach(() => { const allTags = document.querySelectorAll("*"); allTags.forEach((e) => e.setAttribute("dir", "auto")); }); }); observer.observe(document.body, { childList: true, subtree: true }); } function fixArabic() { fixDir(); } // run on page load / changes window.addEventListener("popstate", () => fixArabic()); // run on page load document.addEventListener("DOMContentLoaded", () => fixArabic()); fixArabic(); })();