Cartel Empire - ceReplace

Replaces text globally in Cartel Empire (except in chat)

  1. // ==UserScript==
  2. // @name Cartel Empire - ceReplace
  3. // @namespace cartel.ovh
  4. // @version 1.00
  5. // @description Replaces text globally in Cartel Empire (except in chat)
  6. // @author ZoomStop
  7. // @match https://cartelempire.online/*
  8. // @icon https://www.google.com/s2/favicons?sz=64&domain=cartelempire.online
  9. // @license MIT
  10. // ==/UserScript==
  11. //
  12. // Define replacements below in Replace_Terms
  13. // On the left put the text to search, on the right put the text to replace the text on the left with
  14. // Add additional lines as needed following this format:
  15. // [ "Text To Search For", "Text to Replace With" ],
  16. //
  17.  
  18. (function() { 'use strict';
  19. const Replace_Terms = [
  20. ["£","$"],
  21. ["Team 1", "✅ Team 1"],
  22. ["Team 2", "✅ Team 2"],
  23. ["Team 3", "✅ Team 3"],
  24. ["Team 4", "✅ Team 4"],
  25. ["Team 5", "✅ Team 5"],
  26. ];
  27.  
  28. function replaceStringsOnPage() {
  29. $('*').contents().each(function () {
  30. if (this.nodeType === 3) {
  31. if ($(this).closest('.chatContainer').length === 0) {
  32. var nodeValue = this.nodeValue;
  33. Replace_Terms.forEach(function (replacement) {
  34. if (!nodeValue.includes(replacement[1])) {
  35. nodeValue = nodeValue.replace(new RegExp(replacement[0], 'g'), replacement[1]);
  36. }
  37. });
  38. this.nodeValue = nodeValue;
  39. }
  40. }
  41. });
  42. }
  43.  
  44. function observeMutations() {
  45. var observer = new MutationObserver(function(mutations) {
  46. mutations.forEach(function(mutation) {
  47. if (mutation.addedNodes && mutation.addedNodes.length > 0) {
  48. mutation.addedNodes.forEach(function(node) {
  49. if (node.nodeType === 1 && ($(node).hasClass("modal-backdrop") || $(node).hasClass("offerListWrapper"))) {
  50. replaceStringsOnPage();
  51. }
  52. });
  53. }
  54. });
  55. });
  56. observer.observe(document.body, { childList: true, subtree: true });
  57. }
  58.  
  59. $(document).ready(function() {
  60. replaceStringsOnPage();
  61. observeMutations();
  62. });
  63. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址