BNDong / Cnblogs-Theme-SimpleMemory

🍭 Cnblogs theme _ Basic theme : SimpleMemory

Home Page:https://bndong.github.io/Cnblogs-Theme-SimpleMemory/v2.1/dist/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

请求修复 主页banner标语获取源jinrishici 调用方式错误

caiyuyag opened this issue · comments

调用 今日诗词开放接口 不应该直接 GET https://v2.jinrishici.com/one.json ,这仅适用于浏览器直接访问 ,不适用于网站调用。
依照 今日诗词开放接口 - 调用文档,应使用 通用高级安装代码 调用,具体见 文档
不然就会被限制诗词质量,在我的blog上表现为只有《春江花月夜》这首诗中的诗句。

目前我自己暂时做了修复:

s = {
                        async: !0,
                        crossDomain: !0,
                        url: "https://v2.jinrishici.com/one.json",
                        method: "GET"
                    },
                    $.ajax(s).done((e=>{
                        if (e && "success" === e.status)
                            o.html(e.data.content).css("display", "-webkit-box"),
                            $("#hitokotoAuthor").text("《" + e.data.origin.title + "》 - " + e.data.origin.dynasty + " - " + e.data.origin.author).show();
                        else {
                            let e = t.__tools.randomNum(0, n.length - 1);
                            o.html(n[e]).css("display", "-webkit-box")
                        }
                        return t.__tools.setDomHomePosition(),
                        !1
                    }
                    ))

改为

jinrishici.load(function(result) {
                        o.html(result.data.content).css("display", "-webkit-box"),
                        $("#hitokotoAuthor").text("《" + result.data.origin.title + "》 - " + result.data.origin.dynasty + " - " + result.data.origin.author).show();
    					console.log(result)
                        return t.__tools.setDomHomePosition(),
                        !1
                    });

并加上<script src="https://sdk.jinrishici.com/v2/browser/jinrishici.js" charset="utf-8"></script>
望作者尽快修复,谢谢

下一版调整

已调整