AsianSister.com image FullRes

Sets full image resolution without redirect, also allow download image in full resolution on page load

Fra 20.04.2020. Se den seneste versjonen.

// ==UserScript==
// @name:pl      AsianSister.com Maksymalna rozdzielczość obrazów
// @name:en      AsianSister.com image FullRes
// @name         AsianSister.com image FullRes
// @namespace    AsianSister.comImageFullRes
// @version      2.2
// @description:en  Sets full image resolution without redirect, also allow download image in full resolution
// @description:pl  Zmienia rozdzielczość zdjęć na pełną, pozwala rówież na pobieranie zdjęć
// @author       TheUnsleepingAlchemist
// @match        https://asiansister.com/view_*
// @grant        GM_addStyle
// @grant        GM_download
// @run-at       document-idle
// @noframes
// @description Sets full image resolution without redirect, also allow download image in full resolution on page load
// ==/UserScript==


(function () {
    GM_addStyle(`
.downloadButton {
width: 100%;
border: none;
border-radius: 4px;
font-size: 25px;
margin: 0 auto;
position: relative;
height: 70px;
background-color: #404040;
color: #dddddd;
cursor: pointer;
transition: all 150ms;
}
.downloadButton:hover {
background-color: #505050;
}
img#vipCover {
display: none !important;
}
img#img01 {
width: auto !important;
margin: 0 !important;
top: unset;
left: unset;
}
.showMiniImage {
background: none !important;
}
.lazyload.loaded {
opacity: 1 !important;
}
#myModal {
align-items: center;
justify-content: center;
}
.showMiniImage {
width: auto;
max-width: 100%;
height: auto;
margin: 0 auto;
}
.imgContainer {
padding: 20px;
width: 90vw;
display: flex;
flex-wrap: wrap;
flex-direction: column;
justify-content: center;
align-items: center;
}`)

    let reg = /_t.jpg/i,
        images = null,
        array = [],
        downloaded = 0,
        downloadButton = document.createElement("button");

    document.querySelectorAll(".rootContant")[1].classList.add("imgContainer");
    downloadButton.classList.add("downloadButton");
    downloadButton.innerText = "Download"
    document.querySelector(".second_contant").append(downloadButton);
    downloadButton.addEventListener("click", () => {
        let downloading = setInterval(function() {
            if (downloaded === array.length) {
                clearInterval(downloading);
            }
            else {
                GM_download(`${array[downloaded]}`, `${document.querySelector(".second_contant > center > h1").innerText}_${downloaded + 1}`)
                downloaded++;
            }
        }, 100);
    })
    images = document.querySelectorAll(".showMiniImage")
    for (let i = 0; i < images.length; i++) {
        let image = images[i]
        if (image.dataset.src.match(reg)) {
            image.setAttribute("src", `https://asiansister.com/${image.dataset.src.slice(0,-6)}.jpg`);
        }
        if (!image.classList.contains("loaded")) {
            image.classList.add("loaded")
            image.setAttribute("data-was-processed", true);
        }
        array.push(`https://asiansister.com/${image.dataset.src.slice(0,-6)}.jpg`)
    }


    console.log(images.length)
    setTimeout(function(){
        window.scrollTo(0,1);
    }, 1);

    window.addEventListener('scroll', () => {
        document.querySelector("#desktopScroll").classList.remove("desktopTopMenu2");
        document.querySelector("#desktopScroll").classList.add("desktopTopMenu1")
    });
}());