MapoMagpie / eh-view-enhance

Manga Viewer + Downloader, Focus on experience and low load on the site. Support: e-hentai.org | exhentai.org | pixiv.net | 18comic.vip | nhentai.net | hitomi.la | rule34.xxx | danbooru.donmai.us | gelbooru.com | twitter.com
MIT License
363 stars 12 forks source link

Multiple page Hitomi.la closes viewer #45

Closed lnp5131 closed 7 months ago

lnp5131 commented 7 months ago

Using left or right to navigate in Hitomi.la for large enough galleries to have multiple pages would close the viewer on left/right. Opening the viewer again would show no pages if on page 2 or higher. image The script responsible is likely https://ltn.hitomi.la/gallery.js

MapoMagpie commented 7 months ago

fix: keyboard event propagation;

lnp5131 commented 1 month ago

The issue returned ever since the rename to Comic Looms. The same script is responsible.

$(document).keydown(function(e) {
        var evtobj = window.event ? event : e;
        if (evtobj.altKey || evtobj.ctrlKey || evtobj.shiftKey || evtobj.metaKey) return;

        var current_page_el = $(".currentPage");

        switch (e.which) {
                case 37: //left
                        if (current_page_el.prev().children().length) {
                                window.location.hash = current_page_el.prev().children()[0].hash;
                        }
                        break;
                case 39: //right
                        if (current_page_el.next().children().length) {
                                window.location.hash = current_page_el.next().children()[0].hash;
                        }
                        break;
                default: return;
        }

        e.preventDefault();
});
lnp5131 commented 1 month ago

@MapoMagpie Keydown event listener was replaced by a keyup event listener in the rewrite. Reverting back to keydown fixes this issue.