RARBG Show thumbnails in torrent lists (Plain JavaScript)

Shows the thumbnail on every item of the torrent list, highlight matched torrent in searchpattern

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         RARBG Show thumbnails in torrent lists (Plain JavaScript)
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Shows the thumbnail on every item of the torrent list, highlight matched torrent in searchpattern
// @include     /^(https?:)?\/\/(www\.)?rarbg\.(is|to|com)\/(torrents\.php.*|catalog\/.*|top10)$/
// ==/UserScript==

(function() {
    'use strict';
    var searchpattern = [
        'webrip'
    ];
    searchpattern.forEach(function(el, i){
        searchpattern[i] = el.toLowerCase();
    });
    var matches = document.querySelectorAll('.lista2 .lista a');
    var regExp = /\\'([^)]+)\\'/;
    if(matches && matches.length) {
        for(var i=0; i<matches.length; i++) {
            if(matches[i] && matches[i].onmouseover) {
                var inh = matches[i].innerHTML.toLowerCase();
                for(var j=0; j<searchpattern.length; j++) {
                    if(inh.includes(searchpattern[j])) {
                        matches[i].style.color = '#ff4db0';
                        matches[i].style.background = 'pink';
                        break;
                    }
                }
                var match = regExp.exec(matches[i].onmouseover);
                if(match) {
                    matches[i].parentNode.previousSibling.innerHTML = '<img src="'+match[1]+'"></img>';
                }
            }
        }
    }
})();