greatshack

Vire colonne droite et change taille image noel shack avec "I" + active les gif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         greatshack
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  Vire colonne droite et change taille image noel shack avec "I" + active les gif
// @author       You
// @match        http://www.jeuxvideo.com/forums/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';
    document.getElementById('forum-right-col').outerHTML = "";
    document.getElementById('forum-main-col').removeAttribute('class');
    let imgs = document.getElementsByClassName('img-shack');
    let curs = 0;
    (function()
     {
        let i = 0;
        while(i<imgs.length)
        {
            imgs[i].onerror = function(){
                this.onerror = function(){
                    this.src = this.src.replace('.gif', '.png');
                    this.src = this.src.replace('fichiers', 'minis');};
                this.src = this.src.replace('minis', 'fichiers');
            };
            imgs[i].src = imgs[i].src.replace('.png', '.gif');
            i++;
        }
    })();

    let normal = function(){
        let i = 0;
        while(i<imgs.length)
        {
            imgs[i].src = imgs[i].src.replace('fichiers', 'minis');
            imgs[i].src = imgs[i].src.replace('.jpg', '.png');
            imgs[i].src = imgs[i].src.replace('.jpeg', '.png');
            imgs[i].src = imgs[i].src.replace('.gif', '.png');
            imgs[i].height = 51;
            imgs[i].width = 68;
            i++;
        }
    };
    let grand = function(){
        let i = 0;
        while(i<imgs.length)
        {
            imgs[i].onerror = function(){
                this.src = this.src.replace('.png', '.jpg');
                this.onerror = function(){
                    this.src = this.src.replace('.jpg', '.gif');
                    this.onerror = function(){
                        this.src = this.src.replace('.gif', '.jpeg');
                    };
                };
            };
            imgs[i].src = imgs[i].src.replace('minis', 'fichiers');
            imgs[i].height = 200;
            imgs[i].width = 200;
            i++;
        }
    };
    let reel = function(){
        let i = 0;
        while(i<imgs.length)
        {
            imgs[i].removeAttribute('height');
            imgs[i].removeAttribute('width');
            i++;
        }
    };
    window.onkeypress = function(e) {
        var key = e.keyCode ? e.keyCode : e.which;
        //console.log(key);
        if(key === 105)
            curs = (curs == 2) ? 0 : curs+1;
        if (curs === 0)
            normal();
        if (curs === 1)
            grand();
        if (curs === 2)
            reel();
    };
})();