Anti mike

Zmienia nick mikowi na cb. Zbugowane ale ojtam. Wazne ze działa

  1. // ==UserScript==
  2. // @name Anti mike
  3. // @namespace http://mongla.net
  4. // @version 0.1
  5. // @description Zmienia nick mikowi na cb. Zbugowane ale ojtam. Wazne ze działa
  6. // @match http://www.ufs.pl/*
  7. // ==/UserScript==
  8.  
  9. function doSomeWork (jNode) {
  10.  
  11. jNode.replaceWith('Mike');
  12. }
  13.  
  14. waitForKeyElements ("font:contains('msmsmikeshinoda')", doSomeWork);
  15.  
  16. /*--- waitForKeyElements(): A utility function, for Greasemonkey scripts,
  17. that detects and handles AJAXed content.
  18. Usage example:
  19. waitForKeyElements (
  20. "div.comments"
  21. , commentCallbackFunction
  22. );
  23. //--- Page-specific function to do what we want when the node is found.
  24. function commentCallbackFunction (jNode) {
  25. jNode.text ("This comment changed by waitForKeyElements().");
  26. }
  27. IMPORTANT: This function requires your script to have loaded jQuery.
  28. */
  29. function waitForKeyElements (
  30. selectorTxt, /* Required: The jQuery selector string that
  31. specifies the desired element(s).
  32. */
  33. actionFunction, /* Required: The code to run when elements are
  34. found. It is passed a jNode to the matched
  35. element.
  36. */
  37. bWaitOnce, /* Optional: If false, will continue to scan for
  38. new elements even after the first match is
  39. found.
  40. */
  41. iframeSelector /* Optional: If set, identifies the iframe to
  42. search.
  43. */
  44. ) {
  45. var targetNodes, btargetsFound;
  46. if (typeof iframeSelector == "undefined")
  47. targetNodes = $(selectorTxt);
  48. else
  49. targetNodes = $(iframeSelector).contents ()
  50. .find (selectorTxt);
  51. if (targetNodes && targetNodes.length > 0) {
  52. btargetsFound = true;
  53. /*--- Found target node(s). Go through each and act if they
  54. are new.
  55. */
  56. targetNodes.each ( function () {
  57. var jThis = $(this);
  58. var alreadyFound = jThis.data ('alreadyFound') || false;
  59. if (!alreadyFound) {
  60. //--- Call the payload function.
  61. var cancelFound = actionFunction (jThis);
  62. if (cancelFound)
  63. btargetsFound = false;
  64. else
  65. jThis.data ('alreadyFound', true);
  66. }
  67. } );
  68. }
  69. else {
  70. btargetsFound = false;
  71. }
  72. //--- Get the timer-control variable for this selector.
  73. var controlObj = waitForKeyElements.controlObj || {};
  74. var controlKey = selectorTxt.replace (/[^\w]/g, "_");
  75. var timeControl = controlObj [controlKey];
  76. //--- Now set or clear the timer as appropriate.
  77. if (btargetsFound && bWaitOnce && timeControl) {
  78. //--- The only condition where we need to clear the timer.
  79. clearInterval (timeControl);
  80. delete controlObj [controlKey]
  81. }
  82. else {
  83. //--- Set a timer, if needed.
  84. if ( ! timeControl) {
  85. timeControl = setInterval ( function () {
  86. waitForKeyElements ( selectorTxt,
  87. actionFunction,
  88. bWaitOnce,
  89. iframeSelector
  90. );
  91. },
  92. 300
  93. );
  94. controlObj [controlKey] = timeControl;
  95. }
  96. }
  97. waitForKeyElements.controlObj = controlObj;
  98. }