Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bw的自动翻页代码求更新 #138

Open
dlsx000 opened this issue Mar 10, 2023 · 7 comments
Open

bw的自动翻页代码求更新 #138

dlsx000 opened this issue Mar 10, 2023 · 7 comments

Comments

@dlsx000
Copy link

dlsx000 commented Mar 10, 2023

之前的失效了,不知该怎么改

@jawsh1102
Copy link

jawsh1102 commented Mar 10, 2023

I'm getting the same error, the page turn function won't work. Hopefully it can be fixed soon

@xuzhengyi1995
Copy link
Owner

Updated, please use:

  window.i=0;setInterval(()=>{NFBR.a6G.Initializer.d9M.menu.options.a6l.moveToPage(window.i);console.log(window.i);window.i++;},3000)

@jawsh1102
Copy link

Updated, please use:

  window.i=0;setInterval(()=>{NFBR.a6G.Initializer.d9M.menu.options.a6l.moveToPage(window.i);console.log(window.i);window.i++;},3000)

Thank you! Works perfectly again.

@jawsh1102
Copy link

The same error is happening again with the new command
image

@ww9592447
Copy link

新函數 NFBR.a6G.Initializer.L7v.menu.options.a6l.moveToPage

@xuzhengyi1995
Copy link
Owner

新函數 NFBR.a6G.Initializer.L7v.menu.options.a6l.moveToPage

Thanks!
Will consider adding an auto click turn pages feature in the browser, so we could auto turn pages no matter how they update the script.

@chierinyan
Copy link

新函數 NFBR.a6G.Initializer.L7v.menu.options.a6l.moveToPage

Thanks! Will consider adding an auto click turn pages feature in the browser, so we could auto turn pages no matter how they update the script.

Before we implement that, here's a workaround to detect updated javascript, rewritten from website_actions.

I've also added the check_is_loading function which avoids missing pages.

It's tested on bookwalker.com.tw, and should also work for bookwalker.jp

I'd appreciate others testing it and letting me know if it works for you as well.

function isLoaded() {
    for (e of document.querySelectorAll('.loading')) {
        if (getComputedStyle(e).visibility === "visible") return false;
    }
    return true;
}


let options;
for (key of Object.keys(NFBR.a6G.Initializer)) {
    if (Object.keys(NFBR.a6G.Initializer[key]).includes('menu')) {
        options = NFBR.a6G.Initializer[key].menu.options.a6l;
        break;
    }
}

options.setSpreadDouble(false);

const total = parseInt(document.querySelector('#pageSliderCounter').innerText.split('/')[1])

const checkLoading = setInterval(function() {
    const current = parseInt(document.querySelector('#pageSliderCounter').innerText.split('/')[0])
    console.log('Waiting for page', current);
    if (isLoaded()) {
        console.log('Page loaded');
        if (current < total) {
            options.moveToNext();
        } else {
            console.log('Finished!');
            clearInterval(checkLoading);
        }
    }
}, 1000);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants