Joyreactor Delmor_S' Script

Script automatically replaces all the Joyreactor posts' .jpeg images with their .jpg versions.

  1. // ==UserScript==
  2. // @name Joyreactor Delmor_S' Script
  3. // @grant none
  4. // @include *reactor.cc*
  5. // @include *joyreactor.cc*
  6. // @include *reactor.com*
  7. // @include *jr-proxy.com*
  8. // @run-at document-idle
  9. // @description Script automatically replaces all the Joyreactor posts' .jpeg images with their .jpg versions.
  10. // @version 1.1.1
  11. // @require http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js
  12. // @namespace https://greasyfork.org/users/4638
  13. // ==/UserScript==
  14.  
  15. setTimeout(function() {
  16. var tempHTML = $('body').html();
  17.  
  18. if (tempHTML.includes('Лучше выключите этот глючный userscript.') || tempHTML.includes('Если у вас установлен блокировщик рекламы')) {
  19. //alert('Пробую перезагрузить страницу...');
  20. location.reload();
  21. }
  22.  
  23. $('div[class*="image"] img').each(function() {
  24. var tempSrc = $(this).attr('src');
  25. tempSrc = tempSrc.replace(/\.jpeg/g, '.jpg?' + new Date().getTime());
  26. tempSrc = tempSrc.replace(/\.png/g, '.png?' + new Date().getTime());
  27. $(this).attr('src', tempSrc);
  28. });
  29.  
  30. $('div[class*="image"] img').on({
  31. 'error': function() {
  32. var tempSrc = $(this).attr('src');
  33. tempSrc = tempSrc.replace(/\.jpeg/g, '.jpg?' + new Date().getTime());
  34. tempSrc = tempSrc.replace(/\.png/g, '.png?' + new Date().getTime());
  35. $(this).attr('src', tempSrc);
  36. }
  37. });
  38.  
  39. $('div[class*="uhead_nick"] img').on({
  40. 'error': function() {
  41. var tempSrc = $(this).attr('src');
  42. $(this).attr('src', "");
  43. $(this).attr('src', tempSrc);
  44. }
  45. });
  46.  
  47. }, 1000);