Skip to content

Instantly share code, notes, and snippets.

@shahinism
Last active August 26, 2018 15:23
Show Gist options
  • Save shahinism/64e17194592e962a6ccc91867b223197 to your computer and use it in GitHub Desktop.
Save shahinism/64e17194592e962a6ccc91867b223197 to your computer and use it in GitHub Desktop.
Slack Bidirectional Text (Add RTL support to slack)
// ==UserScript==
// @name Slack Bidirectional Text (Add RTL support to slack)
// @namespace http://bit.ly/2kHm59H
// @version 1.0
// @description Set auto direction for all message boxes
// @author Shahin
// @include https://*.slack.com/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
const observer = new MutationObserver((mutations) => {
document.querySelectorAll('span.message_body, textarea#msg_input').forEach((item)=>{item.setAttribute('dir', 'auto');});
});
// Notify me of everything!
const observerConfig = {
attributes: true,
childList: true,
characterData: true
};
var targetNode = document.body;
observer.observe(targetNode, observerConfig);
})();
@angellandros
Copy link

How does it work?

@pejhar
Copy link

pejhar commented Aug 26, 2018

How does it work? dude

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment