Proxer-Longstrip-Reader

Dieses Script fügt auf Proxer die Möglichkeit hinzu, Mangas im Longstrip-Format zu lesen

Stan na 09-10-2015. Zobacz najnowsza wersja.

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         Proxer-Longstrip-Reader
// @namespace    
// @version      0.6.9
// @description  Dieses Script fügt auf Proxer die Möglichkeit hinzu, Mangas im Longstrip-Format zu lesen
// @author       Dominik Bissinger alias Nihongasuki
// @include      http://proxer.me/*
// @include      https://proxer.me/*
// @include      http://www.proxer.me/*
// @include      https://www.proxer.me/*        
// @run-at       document-start
// @grant        GM_setValue
// @grant        GM_getValue
// @grant        unsafeWindow
// ==/UserScript==

//Startet die Funktion "addButton" beim Laden der Seite
document.addEventListener('DOMContentLoaded', function(event) {
    addButton();
});

//Fügt den Button "Longstrip-Reader" zu "Anker" hinzu und startet die Longstrip-Funktion beim Seitenaufruf
var addButton = function() {
    var i = 0;
    var test = setInterval(function () {
        if (i > 10) {
            var ulm = document.getElementById("leftNav");
            var li = document.createElement("li");
            li.setAttribute("id","ankerTop");
            li.setAttribute("class","topmenu");
            ulm.appendChild(li);
            document.getElementById('ankerTop').innerHTML = '<a href="javascript:;">Tools ▾</a><ul id="anker"></ul>';
        }
        if (document.getElementById('anker') !== null) {
            var ul = document.getElementById("anker");
            var li = document.createElement("li");
            li.setAttribute("id","longstrip");
            ul.appendChild(li);
            var x = GM_getValue("onOff",0);
            if (x === 0) {
                document.getElementById('longstrip').innerHTML = '<a href="javascript:;">Longstrip-Reader <img src="https://proxer.me/images/misc/kreuz.png" width="15" height="15"></a>';
            }else{
                document.getElementById('longstrip').innerHTML = '<a href="javascript:;">Longstrip-Reader <img src="https://proxer.me/images/misc/haken.png" width="15" height="15"></a>';
            };
            document.getElementById('longstrip').addEventListener("click",function () {
            onOff();
            });
            longstrip();
            clearInterval(test);
        };
        i++;
    },100);
};

//Toggle Longstrip-Reader
var onOff = function () {
    var x = GM_getValue("onOff",0);
    if (x === 0) {
        GM_setValue("onOff",1);
        document.getElementById('longstrip').innerHTML = '<a href="javascript:;">Longstrip-Reader <img src="https://proxer.me/images/misc/haken.png" width="15" height="15"></a>';
    }else{
        GM_setValue("onOff",0);
        document.getElementById('longstrip').innerHTML = '<a href="javascript:;">Longstrip-Reader <img src="https://proxer.me/images/misc/kreuz.png" width="15" height="15"></a>';
    };
    longstrip();
};

//Longstrip-Reader
var longstrip = function () {
    var x = GM_getValue("onOff",0);
    if (x === 0) {
        return;
    };
    if (window.location.href.indexOf('read') > -1) {
        if (window.location.href.indexOf('forum') > -1) {
            return;
        };
        var href = window.location.href;
        var info = href.match(/(\d[\d\.]*)/g);
        var i = 1;
        var x = 0;
        
        //Lösche Seitenanzeige
        document.getElementById("navigation").style.display = "none";
        
        //Ändere die Navigationseinstellungen
        window.addEventListener("keydown", changeChapter, false);
        
        //setze die Bilder
        var number = parseInt(info[1],10);
        var nextChap = number + 1;
        document.getElementById('reader').innerHTML = "<a href='javascript:;' onclick='return false;' id='master'></a>";
        
        //nächstes Kapitel bei Klick
        document.getElementById('master').addEventListener ("click", function (event) {
            window.location = unsafeWindow.nextChapter+'/#top';
        });
        var master = document.getElementById('master');
        document.getElementById('reader').style.maxWidth = "none";
        document.getElementById('reader').style.textAlign = "center";
        var pagesNumber = unsafeWindow.pages.length;
        var loop = function () {
            var br = document.createElement("br");
            var element = document.createElement("img");
            var url = unsafeWindow.serverurl+unsafeWindow.pages[x][0];
            element.setAttribute("class","chapterImage");
            element.setAttribute("src",url);
            element.setAttribute("width",unsafeWindow.pages[x][2]);
            element.setAttribute("height",unsafeWindow.pages[x][1]);
            element.setAttribute("style","opacity: 1; max-width: 100%; text-align: center; height: auto;");
            master.appendChild(element);
            master.appendChild(br);
            i++;
            x++;
            if (i <= pagesNumber) {
                setTimeout(loop,1000);
            };
        };
        loop();
    };
};

//Weiterleitung zum nächsten Kapitel/zur Kapitelseite des momentanen Kapitels
var changeChapter = function (event) {
    var lang = "";
    if (window.location.href.indexOf('forum') > -1) {
        return;
    };
    if (window.location.href.indexOf('en') > -1) {
        lang = "en";
    }else if (window.location.href.indexOf('de') > -1) {
        lang = "de";
    };
    // D oder Weiter oder Linke Maustaste
    if (event.keyCode === 68 || event.keyCode === 39) {
        window.location = unsafeWindow.nextChapter+'/#top';
    // A oder Zurück
    }else if (event.keyCode === 65 || event.keyCode === 37) {
        var div = document.getElementById('breadcrumb');
        var a = div.getElementsByTagName('a');
        if (lang !== "") {
            window.location = a[1].href;
        }else{
            window.location = a[0].href;
        };
    };
};