nire0510 / Trello RTL

// ==UserScript==
// @name         Trello RTL
// @namespace    http://nirelbaz.com/
// @version      0.1
// @description  Automatically changes the text direction to RTL whenever the text in card is in Hebrew
// @author       Nir Elbaz
// @match        https://trello.com/*
// @grant        none
// ==/UserScript==

// create an observer instance
var strLastDisplayMode = '',
    observer;

// Observer action:
observer = new MutationObserver(function (mutations) {
  mutations.forEach(function(mutation) {
    // Check if display style property of observed element has changed:
    if (mutation.type === 'attributes' && mutation.attributeName === 'style' && mutation.target.style.display !== strLastDisplayMode) {
      // Store latest display mode to avoid multiple execution of this script:
      strLastDisplayMode = mutation.target.style.display;
      // If card is visible, change direction and display style properties:
      if (mutation.target.style.display === 'block') {
        (function (elmParent) {
          window.setTimeout(function () {
            [].forEach.call(elmParent.querySelectorAll('h2, .js-card-desc p, .js-comment p'), function (elem) {
              if(elem.innerText && elem.innerText.search(/[א-ת]+/g) >= 0 && elem.style.direction !== 'rtl') {
                elem.style.direction = 'rtl';
                if (elem.tagName === 'H2') {
                  elem.style.display = 'inline-block';
                }
              }
            });
          }, 2000);
        })(mutation.target);
      }
    }
  });    
});
 
// Observer init:
observer.observe(document.querySelector('.window'), {
    attributes: true,
    childList: false,
    characterData: false
  }
);