Joyreactor Delmor_S' Script

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

当前为 2019-10-05 提交的版本,查看 最新版本

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