Last active
August 26, 2018 15:23
-
-
Save shahinism/64e17194592e962a6ccc91867b223197 to your computer and use it in GitHub Desktop.
Slack Bidirectional Text (Add RTL support to slack)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How does it work?