author/op subheading

main
BuildTools 4 years ago
parent d172bbea2a
commit be176bf58a
  1. 1
      index.html
  2. 9
      js/main.js

@ -35,6 +35,7 @@ load();
</head> </head>
<body> <body>
<h1 id="title">loading...</h1> <h1 id="title">loading...</h1>
<h3 id="op">anonymous</h3>
<table id="listing"> <table id="listing">
<tr> <tr>
<td><b id="c1">title</b></td> <td><b id="c1">title</b></td>

@ -1,6 +1,7 @@
function setheader(header) function setheader(header, author = null)
{ {
document.getElementById("title").innerHTML = header; document.getElementById("title").innerHTML = header;
document.getElementById("op").innerHTML = author;
} }
function loadmangos(info, url) function loadmangos(info, url)
{ {
@ -23,19 +24,17 @@ function loadmangos(info, url)
let time = row.insertCell(-1); let time = row.insertCell(-1);
time.innerHTML = new Date(manga["last_updated"]).toLocaleDateString("en-US"); time.innerHTML = new Date(manga["last_updated"]).toLocaleDateString("en-US");
}); });
console.log(info);
} }
function loadchapters(manga, chapters) function loadchapters(manga, chapters)
{ {
if (manga) if (manga)
{ {
setheader(manga["titles"][0]); setheader(manga["titles"][0], manga["authors"][0]);
} }
if (chapters) if (chapters)
{ {
document.getElementById("c2").innerHTML = "pages"; document.getElementById("c2").innerHTML = "pages";
document.getElementById("c3").innerHTML = "date"; document.getElementById("c3").innerHTML = "date";
console.log(chapters);
let listing = document.getElementById("listing"); let listing = document.getElementById("listing");
chapters.forEach(chapter => chapters.forEach(chapter =>
{ {
@ -70,7 +69,7 @@ function load(url = "https://test.cynic.moe")
{ {
fetch(url+"/info") fetch(url+"/info")
.then(response => response.json()) .then(response => response.json())
.then(data => setheader(data["name"]+" v"+data["version"])); .then(data => setheader(data["name"]+" v"+data["version"], data["operator"]));
fetch(url+"/manga/search?sort") fetch(url+"/manga/search?sort")
.then(response => response.json()) .then(response => response.json())
.then(data => loadmangos(data, url)); .then(data => loadmangos(data, url));

Loading…
Cancel
Save