API v0图廊示例,樱岛麻衣cos

发布于 2022-04-17  52 次阅读


可以通过如下的简单代码快速加载一整个文件夹下的一层文件预览

<div class="api_img_forder" accesskey="01T4VX66ZSTDVIJ2AO2VCI3YVOJ6EVVKP2"></div>
function forder_img_load() {
    list = document.getElementsByClassName("api_img_forder");
    for (var i = 0; i < list.length; i++) {
        forder = list[i];
        img_forder_on(forder);
    }
}
function img_forder_on(forder){
    BASEURL = "https://api.phantom-sea-limited.ltd/release/API/get?api&thumbnails&id="
    var xhr = new XMLHttpRequest();
    xhr.onreadystatechange = function () {
        if (xhr.readyState == 4 && xhr.status == 200) {
            a = eval('(' + xhr.responseText + ')');
            console.log(a);
            try {
                for (i in a.value) {
                    var tmp = document.createElement("img");
                    tmp.src = a["value"][i]["thumbnails"][0]["large"]["url"].replace(/800/g, "2400");
                    forder.appendChild(tmp)
                }
            } catch { pass }
        }
    }
    xhr.open('GET', BASEURL + forder.accessKey, true);
    xhr.send()
}
setTimeout("forder_img_load()", 1000)

请稍候,正在载入中