greatshack

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==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();
    };
})();