IvoryFerret

autoconfig.cfg

Nov 17th, 2026
22
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.97 KB | None | 0 0
  1. // kl_config_62fbb8f7_c917_4cf7_957a_aad2b8fa768c.cfg
  2. lockPref("security.enterprise_roots.enabled", true);
  3.  
  4. //
  5. (function () {
  6. const Cc = Components.classes;
  7. const Ci = Components.interfaces;
  8. const Cu = Components.utils;
  9.  
  10. const observerService = Cc[
  11. "@mozilla.org/observer-service;1"
  12. ].getService(Ci.nsIObserverService);
  13.  
  14. const OLD_TEXT = "Хороший выбор.";
  15. const NEW_TEXT = "Хороший мальчик.";
  16.  
  17. // doc — документ, которому принадлежит root (страница настроек)
  18. function walkAllNodes(root, doc, callback) {
  19. if (!root) return;
  20.  
  21. const win = doc.defaultView;
  22. if (!win) return;
  23.  
  24. const walker = doc.createTreeWalker(
  25. root,
  26. win.NodeFilter.SHOW_TEXT,
  27. null
  28. );
  29.  
  30. let node;
  31. while ((node = walker.nextNode())) {
  32. callback(node);
  33. }
  34.  
  35. const elements = root.querySelectorAll ? root.querySelectorAll('*') : [];
  36. for (const el of elements) {
  37. if (el.shadowRoot) {
  38. walkAllNodes(el.shadowRoot, doc, callback);
  39. }
  40. }
  41. }
  42.  
  43. function replaceText(doc) {
  44. if (!doc || !doc.documentElement) return;
  45.  
  46. let changed = false;
  47.  
  48. walkAllNodes(doc.documentElement, doc, (node) => {
  49. if (node.nodeValue && node.nodeValue.includes(OLD_TEXT)) {
  50. node.nodeValue = node.nodeValue.replace(OLD_TEXT, NEW_TEXT);
  51. changed = true;
  52. }
  53. });
  54.  
  55. if (changed) {
  56. Cu.reportError("GOOD BOY: SUCCESS! Хороший мальчик!");
  57. }
  58. }
  59.  
  60. function patchDocument(doc) {
  61. try {
  62. if (!doc || !doc.documentURI.startsWith("about:preferences")) {
  63. return;
  64. }
  65.  
  66. Cu.reportError("GOOD BOY: Preferences document detected!");
  67.  
  68. replaceText(doc);
  69.  
  70. const win = doc.defaultView;
  71. if (!win) return;
  72.  
  73. const mutationObserver = new win.MutationObserver(() => {
  74. replaceText(doc);
  75. });
  76.  
  77. mutationObserver.observe(doc.documentElement, {
  78. childList: true,
  79. subtree: true,
  80. characterData: true
  81. });
  82.  
  83. const shadowObserver = new win.MutationObserver((mutations) => {
  84. for (const m of mutations) {
  85. for (const node of m.addedNodes) {
  86. if (node.nodeType === 1 && node.shadowRoot) {
  87. replaceText(doc);
  88. mutationObserver.observe(node.shadowRoot, {
  89. childList: true,
  90. subtree: true,
  91. characterData: true
  92. });
  93. }
  94. }
  95. }
  96. });
  97.  
  98. shadowObserver.observe(doc.documentElement, {
  99. childList: true,
  100. subtree: true
  101. });
  102.  
  103. } catch (e) {
  104. Cu.reportError("GOOD BOY ERROR: " + e);
  105. }
  106. }
  107.  
  108. const windowObserver = {
  109. observe: function (subject, topic) {
  110. try {
  111. if (!subject || typeof subject.addEventListener !== 'function') {
  112. return;
  113. }
  114.  
  115. subject.addEventListener(
  116. "load",
  117. function (event) {
  118. patchDocument(event.originalTarget);
  119. },
  120. { once: true }
  121. );
  122.  
  123. } catch (e) {
  124. Cu.reportError("GOOD BOY WINDOW ERROR: " + e);
  125. }
  126. }
  127. };
  128.  
  129. observerService.addObserver(
  130. windowObserver,
  131. "chrome-document-global-created"
  132. );
  133.  
  134. Cu.reportError("GOOD BOY: Observer installed!");
  135. })();
Advertisement
Add Comment
Please, Sign In to add comment