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

[help] torrentkitty支持真实size的展示 #37

Closed
FateScript opened this issue Apr 14, 2021 · 1 comment
Closed

[help] torrentkitty支持真实size的展示 #37

FateScript opened this issue Apr 14, 2021 · 1 comment

Comments

@FateScript
Copy link

Hello, 我尝试让torrentkitty展示文件的真实size, 写了如下函数

query_size: function (url) {
    let promise = request('https://www.torkitty.com' + url, "", 15000);
    return promise.then((result) => {
        var doc = Common.parsetext(result.responseText);
        var raw_size = "None";
        if(doc) {
            var summary_table = doc.body.getElementsByClassName("wrapper")[1].getElementsByClassName("detailSummary")[0];
            raw_size = summary_table.rows[3].cells[1].innerText
        }
        console.log(url);
        console.log(raw_size);
        return Promise.resolve(raw_size);
     });
 },

但是因为js是异步执行的,所以data array中的size是没办法展示出来的(log没有问题),本人js小白,求教怎样才能在table里显示query后的真实size?
这个功能实现之后会pr到本repo

@hobbyfang
Copy link
Owner

你这个需要后续的table显示,放到获取结束之后的Promise同步调用才可以,不然就会默认为异步处理了

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

2 participants