Script Hapoel Sans Bugs

J'ai essayé de faire un script sans bugs...

  1. // ==UserScript==
  2. // @name Script Hapoel Sans Bugs
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @description J'ai essayé de faire un script sans bugs...
  6. // @author 3lXouif_Hapoel (Positron)
  7. // @match https://www.jeuxvideo.com/*
  8. // @match http://www.jeuxvideo.com/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. function replace() {
  13. var y = document.getElementsByTagName("P");
  14. var i;
  15. for (i = 0; i < y.length; i++) {
  16. var reg=new RegExp(":hapoel:", "g");
  17. y[i].innerHTML = y[i].innerHTML.replace(reg,"<img border='0'src='http://image.noelshack.com/fichiers/2018/36/5/1536354479-hapoel.gif' alt=':hapoel:' />");
  18. reg=new RegExp(":hapoelia:", "g");
  19. y[i].innerHTML = y[i].innerHTML.replace(reg,"<img border='0'src='https://wiki.jvflux.com/images/8/85/Hapoelia.gif' alt=':hapoelia:' />");
  20. reg=new RegExp(":hapoel2:", "g");
  21. y[i].innerHTML = y[i].innerHTML.replace(reg,"<img border='0'src='https://cdn.discordapp.com/emojis/718481781501853707.png' width=16 height=16 alt=':hapoel2:' />");
  22. }
  23. }
  24. var userInput = document.getElementById('message_topic');
  25. userInput.onkeyup = function() {
  26. if(document.getElementById('message_topic').indexOf(":hapoel:") !== -1 || document.getElementById('message_topic').indexOf(":hapoelia:") !== -1 || document.getElementById('message_topic').indexOf(":hapoel2:") !== -1){
  27. replace()
  28. }
  29. };
  30.  
  31. replace()