bbs.mottoki.com image url replacer

bbs.mottoki.com image url replacerは画像一覧頁のurlをオリジナルフルサイズ画像のurlに差し替えますhttp*://bbs.mottoki.com/index*で動作します

Versione datata 28/01/2020. Vedi la nuova versione l'ultima versione.

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     bbs.mottoki.com image url replacer
// @version  4
// @grant    none
// @include  http*://bbs.mottoki.com/index*
// @description bbs.mottoki.com image url replacerは画像一覧頁のurlをオリジナルフルサイズ画像のurlに差し替えますhttp*://bbs.mottoki.com/index*で動作します
// @description:ja bbs.mottoki.com image url replacerは画像一覧頁のurlをオリジナルフルサイズ画像のurlに差し替えますhttp*://bbs.mottoki.com/index*で動作します
// @namespace https://greasyfork.org/users/10885
// ==/UserScript==
// exampleurl http://bbs.mottoki.com/index?bbs=kimottamakaasann&act=album&thread=&page_album=27
// exampleurl http://bbs.mottoki.com/index?bbs=kimottamakaasann&act=img&img=4965
// exampleurl http://bbs.mottoki.com/img/kimottamakaasann/1578698682-9zq398.jpg

var i = 0;
var j = 0;
var k = 0;
var url_mod = [];
var TagA = [];
var AUrl = [];
var TagImg = [];
var ImgUrl = [];
var ImgIndexExNum = [];

TagA = document.getElementsByTagName("a");
TagImg = document.getElementsByTagName("img");

for (i = 0; i < 82; i++) {
    if (TagA[i] != null || TagA[i] != undefined) {
        if (TagA[i].getAttribute("href") != null || TagA[i].getAttribute("href") != undefined) {
            if (TagA[i].getAttribute("href").includes("/index?bbs=kimottamakaasann&act=img&img=") === true) {
                AUrl[i] = TagA[i].getAttribute("href");
                ImgIndexExNum[k] = i;
                //console.log("TagA("+i+"):"+TagA[i]+" AUrl("+i+") :"+AUrl[i]+" ImgIndexExNum("+k+"):"+ImgIndexExNum[k]);
                k = k + 1;
                
                
            }
        }
    }
}

for (j = 0; j < 23; j++) {
    if (TagImg[j] != null || TagImg[j] != undefined) {
        if (TagImg[j].getAttribute("src") != null || TagImg[j].getAttribute("src") != undefined) {
            if (TagImg[j].getAttribute("src").includes("img/kimottamakaasann/s/") === true) {
                ImgUrl[j] = TagImg[j].getAttribute("src");
                    url_mod[j] = ImgUrl[j].replace(/\/s\//, "/")
                    //console.log("ImgUrl("+j+"):"+ImgUrl[j]+" url_mod("+j+")="+url_mod[j]);
            }
        }
    }
}

k = 0;
for (i = ImgIndexExNum[0] - 1; i < ImgIndexExNum[ImgIndexExNum.length-1] +2; i++) {
                TagA[i].setAttribute("href", url_mod[k]);
                //console.log("TagA("+i+"):"+TagA[i] + "  url_mod("+k+"):"+url_mod[k]);
                k = k + 1;
}