anka-213 / webcomic_reader

Webcomic Reader userscript at
https://openuserjs.org/scripts/anka-213/Webcomic_Reader
MIT License
120 stars 27 forks source link

Mangadex's update broke it again #122

Open SirMrMister opened 6 years ago

SirMrMister commented 6 years ago

Before the update that added the sidebar what worked was what onetimeuser123 posted at https://github.com/anka-213/webcomic_reader/issues/102 .

Not anymore though.

blindbox commented 6 years ago

@SirMrMister Switch to legacy mode in the settings page of mangadex (as in, the site's settings page, not the userscript's).

Yoposoc commented 6 years ago

I've tried this too but it's not working. Here are my mangadex settings: https://my.mixtape.moe/sadhlv.jpg

blindbox commented 6 years ago

Here's my settings under Site Settings, see if they're the same as yours.

URL: Beginning of URL


https://mangadex.org/chapter/

Image: CSS selector

img#current_page

Back: function (html, pos)

var backLink = '';
            var page = parseInt(html.match(/data\-page=\"(\d+)\"/)[1]);
            if (page <= 1) {
                var prevChapter = parseInt(html.match(/var prev_chapter_id = (\d+);/)[1]);
                if (prevChapter != "0") {
                    var prevPages = parseInt(html.match(/var prev_pages = (\d+);/)[1]);
                    backLink = "/chapter/" + prevChapter + "/" + prevPages;
                }
            } else {
                var prevPage = page - 1;
                backLink = decodeURI(link[pos]).split("/").slice(0, -1).join("/") + "/" + prevPage;
            }
            return backLink;

Next: function(html, pos)

var nextLink = '';
            var page = parseInt(html.match(/data\-page=\"(\d+)\"/)[1]);
            var lastPage = parseInt(xpath('//select[@id="jump_page"]/option[last()]/@value', html));
            if (page >= lastPage) {
                var nextChapter = parseInt(html.match(/var next_chapter_id = (\d+);/)[1]);
                if (nextChapter != "0") {
                    nextLink = "/chapter/" + nextChapter + "/1";
                }
            } else {
                var nextPage = page + 1;
                nextLink = decodeURI(link[pos]).split("/").slice(0, -1).join("/") + "/" + nextPage;
            }
            return nextLink;

First: function(html)

var chapter = parseInt(html.match(/var chapter_id = (\d+);/)[1]);
            return "/" + chapter + "/1";

Last: function(html)

var chapter = parseInt(html.match(/var chapter_id = (\d+);/)[1]);
            var lastPage = xpath('//select[@id="jump_page"]/option[last()]/@value', html);
            return "/" + chapter + "/" + lastPage;

No change on the others

image

EDIT: Maybe it matters where you set it to Legacy (which I believe is unlikely...) ?

Because here's where I changed it to legacy (Top right dropdown with you username > Settings)

image

Yoposoc commented 6 years ago

Well, I can't even get to changing the settings of webcomic reader on mangadex because no part of webcomic reader comes up. It's as if it doesn't recognize the site.

My mangadex account settings are the same.

blindbox commented 6 years ago

You need to add mangadex.org to the user includes list in your script settings.

Then you can get to Webcomic Reader settings here.

image

Yoposoc commented 6 years ago

@blindbox ah, thanks. With your connect I rechecked my @include and I had a typo. I included all your custom site settings exactly, but it's still not working a4yyd67vzcqc_waterfox_2018-09-20_09-52-10 1 Here are my legacy reader settings.

Yoposoc commented 6 years ago

Ok, I think I know what's happening. After I put in the custom settings, even if I press apply and save, the custom settings aren't saved. When I go back to the site settings page, it's set to default settings.... No idea what to do.