Reddit Fix RTL

Script that fixes Arabic language in Reddit

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name           Reddit Fix RTL
// @version        1.0
// @description    Script that fixes Arabic language in Reddit
// @author         me
// @match          https://*.reddit.com/*
// @namespace https://greasyfork.org/users/1348053
// ==/UserScript==

(function () {
  function logger(text) {
    console.log(`Arabic Reddit: ${text}`);
  }

  function addStyle(styleString) {
    const style = document.createElement("style");
    style.textContent = styleString;
    document.head.append(style);
  }

  function fixDir() {
    logger(`fixing dir`);

    // Fix direction in CSS
    addStyle(`
          p, h1, a, .title.may-blank,h2  {
            unicode-bidi: plaintext;
            text-align: start;
          }`);
  }

  function fixArabic() {
    fixDir();
  }

  fixArabic();
})();