Improve the style of the PR list (both interface and code)
parent
c418d54aec
commit
c8a3b49c82
@ -1,44 +1,34 @@
|
||||
fetch("/up.json").then(function(response) {
|
||||
return response.json().then(function(json) {
|
||||
for(i = 0; i < json.length; i++) {
|
||||
let id = json[i];
|
||||
fetch("https://api.github.com/repos/Plume-org/Plume/pulls/"+id, {mode: 'cors'}).then(
|
||||
fetch('/up.json')
|
||||
.then(r => r.json())
|
||||
.then(json => {
|
||||
for (const id of json) {
|
||||
fetch(`https://api.github.com/repos/Plume-org/Plume/pulls/${id}`, { mode: 'cors' })
|
||||
.then(r => r.json())
|
||||
.catch(() => {
|
||||
return {
|
||||
title: ''
|
||||
}
|
||||
})
|
||||
.then(json => {
|
||||
const linkTest = document.createElement('a')
|
||||
linkTest.href = `https://pr-${id}.joinplu.me/`
|
||||
linkTest.innerText = `#${id}: ${json.title || ''}`
|
||||
const linkGitHub = document.createElement('a')
|
||||
linkGitHub.href = `https://github.com/Plume-org/Plume/pull/${id}`
|
||||
linkGitHub.innerText = 'View on Github'
|
||||
|
||||
function(response) {
|
||||
return response.json().then(function(json) {
|
||||
let link_test = document.createElement("a");
|
||||
link_test.href = "https://pr-" + id + ".joinplu.me/";
|
||||
let link_github = document.createElement("a");
|
||||
link_github.href = "https://github.com/Plume-org/Plume/pull/" + id;
|
||||
link_github.innerText = "(view on Github)";
|
||||
if(json.title === undefined) {
|
||||
link_test.innerText = "#" + id;
|
||||
} else {
|
||||
link_test.innerText = "#" + id + " " + json.title;
|
||||
}
|
||||
let li = document.createElement("li");
|
||||
li.appendChild(link_test);
|
||||
li.append(" ⋅ ");
|
||||
li.appendChild(link_github);
|
||||
document.getElementById("list").appendChild(li);
|
||||
})
|
||||
}
|
||||
const pTest = document.createElement('p')
|
||||
pTest.classList.add('grow')
|
||||
pTest.appendChild(linkTest)
|
||||
const pGitHub = document.createElement('p')
|
||||
pGitHub.appendChild(linkGitHub)
|
||||
|
||||
).catch(
|
||||
function() {
|
||||
let link_test = document.createElement("a");
|
||||
link_test.href = "https://pr-" + id + ".joinplu.me/";
|
||||
let link_github = document.createElement("a");
|
||||
link_github.href = "https://github.com/Plume-org/Plume/pull/" + id;
|
||||
link_github.innerText = "(view on Github)";
|
||||
link_test.innerText = "#" + id;
|
||||
let li = document.createElement("li");
|
||||
li.appendChild(link_test);
|
||||
li.append(" ⋅ ");
|
||||
li.appendChild(link_github);
|
||||
document.getElementById("list").appendChild(li);
|
||||
}
|
||||
)
|
||||
const li = document.createElement('li')
|
||||
li.appendChild(pTest)
|
||||
li.appendChild(pGitHub)
|
||||
li.classList.add('flex')
|
||||
document.getElementById('list').appendChild(li)
|
||||
})
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue