-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbackground.js
More file actions
21 lines (21 loc) · 797 Bytes
/
background.js
File metadata and controls
21 lines (21 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
* @author Atef Ben Ali
*/
// Called when the user clicks on the browser action.
chrome.browserAction.onClicked.addListener(function() {
// No tabs or host permissions needed!
chrome.tabs.executeScript({
code:
'if(document.getElementsByClassName("CodeMirror-lines")[0]) {' +
'document.getElementsByClassName("CodeMirror-lines")[0].setAttribute("style", "direction: rtl");' +
"}" +
'if(document.getElementById("readme")) {' +
'document.getElementById("readme").setAttribute("style", "direction: rtl");' +
"}" +
'if(document.querySelectorAll("table[data-tab-size]").length) {' +
'document.querySelectorAll("table[data-tab-size]").forEach((el) => {' +
'el.setAttribute("style", "direction: rtl")' +
"});" +
"}"
});
});