Joyreactor Delmor_S' Script

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

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name        Joyreactor Delmor_S' Script
// @grant       none
// @include     *reactor.cc*
// @include     *joyreactor.cc*
// @include     *reactor.com*
// @include     *jr-proxy.com*
// @run-at      document-idle
// @description Script automatically replaces all the Joyreactor posts' .jpeg images with their .jpg versions.
// @version     1.1.1
// @require	http://cdnjs.cloudflare.com/ajax/libs/jquery/1.8.3/jquery.min.js
// @namespace https://greasyfork.org/users/4638
// ==/UserScript==

setTimeout(function() {
    var tempHTML = $('body').html();

    if (tempHTML.includes('Лучше выключите этот глючный userscript.') || tempHTML.includes('Если у вас установлен блокировщик рекламы')) {
        //alert('Пробую перезагрузить страницу...');
        location.reload();
    }

    $('div[class*="image"] img').each(function() {
        var tempSrc = $(this).attr('src');
        tempSrc = tempSrc.replace(/\.jpeg/g, '.jpg?' + new Date().getTime());
        tempSrc = tempSrc.replace(/\.png/g, '.png?' + new Date().getTime()); 
        $(this).attr('src', tempSrc);
    });

    $('div[class*="image"] img').on({
        'error': function() {
            var tempSrc = $(this).attr('src');
            tempSrc = tempSrc.replace(/\.jpeg/g, '.jpg?' + new Date().getTime());
            tempSrc = tempSrc.replace(/\.png/g, '.png?' + new Date().getTime()); 
            $(this).attr('src', tempSrc);
         }
    });

    $('div[class*="uhead_nick"] img').on({
        'error': function() {
            var tempSrc = $(this).attr('src');
            $(this).attr('src', "");
            $(this).attr('src', tempSrc);
         }
    });

}, 1000);