google plus rtl fix

Fix rtl in posts and comments in google plus

  1. // ==UserScript==
  2. // @name google plus rtl fix
  3. // @namespace https://plus.google.com/105980437314936889817
  4. // @version 0.3.2
  5. // @description Fix rtl in posts and comments in google plus
  6. // @author Javad
  7. // @include https://plus.google.com/*
  8. // @include https://plus.google.com
  9. // @grant GM_addStyle
  10. // ==/UserScript==
  11. GM_addStyle(".GcESAf, .jxKp7, .H68wj { width: 800px !important; max-width: 800px !important;} .svmwUe , .qhIQqf div , .wftCae{font-size:18px;}");
  12. (function () {
  13. 'use strict';
  14. var text = document.querySelectorAll('div.ahil4d');
  15. var resharetext = document.querySelectorAll('.J3fjEb div');
  16. for (var i = 0; i < text.length; i++) {
  17. text[i].dir = "auto";
  18. console.log("fortext");
  19. resharetext[i].dir = "auto";
  20. console.log("forreshare");
  21. }
  22. var comment1 = document.querySelectorAll('.g6UaYd div');
  23. for (var k = 0; k < comment1.length; k++) {
  24. comment1[k].style.textAlign = "initial";
  25. console.log('comment');
  26. }
  27.  
  28. var observer = new MutationObserver(function (mutations) {
  29. mutations.forEach(function (mutation) {
  30.  
  31. var comment = document.querySelectorAll('.g6UaYd div');
  32. if (comment !== null) {
  33. for (var j = 0; j < comment.length; j++) {
  34. comment[j].style.textAlign = "initial";
  35.  
  36. }
  37. }
  38. mutation.addedNodes.forEach(function (node) {
  39. var reshare = node.querySelectorAll('div.ahil4d');
  40. var resharetop = node.querySelectorAll('.J3fjEb div');
  41. var comment = node.querySelectorAll('.g6UaYd div');
  42. var photo = node.querySelectorAll('.mUbCce.fKz7Od');
  43. if (reshare !== null) {
  44. for (var a = 0; a < reshare.length; a++) {
  45. reshare[a].dir = "auto";
  46. console.log('reshare');
  47. }
  48. }
  49. if (resharetop !== null) {
  50. for (var b = 0; b < resharetop.length; b++) {
  51. resharetop[b].dir = "auto";
  52. console.log('resharetop');
  53.  
  54. }
  55. }
  56. if (comment !== null) {
  57. for (var j = 0; j < comment.length; j++) {
  58. comment[j].style.textAlign = "initial";
  59. console.log('comment');
  60.  
  61. }
  62. }
  63. if (photo !== null) {
  64. for (var d = 0; d < photo.length; d++) {
  65. photo[d].tabIndex = "-1";
  66. console.log('photo');
  67. }
  68. } else {
  69. console.log("notfound");
  70. }
  71. });
  72. });
  73. });
  74. observer.observe(document, {
  75. childList : true,
  76. subtree : true,
  77. attributes : true,
  78. characterData : false,
  79. });
  80. })();