Skip to content

Instantly share code, notes, and snippets.

@py4
Last active May 13, 2020 21:29
Show Gist options
  • Save py4/f495aef9b8fbf6dd8b1c to your computer and use it in GitHub Desktop.
Save py4/f495aef9b8fbf6dd8b1c to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name RTL tweetdeck
// @namespace http://py4.ir
// @version 0.1
// @description RTL support for tweetdeck without messing LTR.
// @author py4
// @match https://tweetdeck.twitter.com/*
// @grant none
// @include https://tweetdeck.twitter.com/*
// ==/UserScript==
$(document).ready(function() {
$("p.js-tweet-text").each( function(index) {
if(($(this).text().match(/[\u0600-\u06FF\uFB8A\u067E\u0686\u06AF]/)))
$(this).css("direction","rtl");
}
)
$(document).bind('DOMNodeInserted', function(event) {
if(event.target.classList.contains("js-stream-item")) {
p = $(event.target).find(".js-tweet-text");
if(p.text().match(/[\u0600-\u06FF\uFB8A\u067E\u0686\u06AF]/))
p.css("direction","rtl");
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment