mirror of https://github.com/kurisufriend/mlFE
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
805 B
29 lines
805 B
function parseinfo(info)
|
|
{
|
|
document.getElementById("title").innerHTML = info["name"];
|
|
console.log(info);
|
|
}
|
|
function loadmangos(info)
|
|
{
|
|
let listing = document.getElementById("listing");
|
|
info.forEach(manga =>
|
|
{
|
|
let row = listing.insertRow(-1);
|
|
let title = row.insertCell(-1);
|
|
title.innerHTML = manga["titles"][0];
|
|
let author = row.insertCell(-1);
|
|
author.innerHTML = manga["author"];
|
|
let time = row.insertCell(-1);
|
|
time.innerHTML = new Date(manga["last_updated"]).toLocaleDateString("en-US");
|
|
});
|
|
console.log(info);
|
|
}
|
|
function load(url = "https://test.cynic.moe")
|
|
{
|
|
fetch(url+"/info")
|
|
.then(response => response.json())
|
|
.then(data => parseinfo(data));
|
|
fetch(url+"/manga/search?sort")
|
|
.then(response => response.json())
|
|
.then(data => loadmangos(data));
|
|
} |