add utility function to simplify releases.js
This commit is contained in:
parent
7da9a2aa29
commit
91603e5506
@ -6,6 +6,11 @@ const devices = ["raven", "oriole", "barbet", "redfin", "bramble", "sunfish", "c
|
|||||||
const channels = ["stable", "beta"];
|
const channels = ["stable", "beta"];
|
||||||
const delayMs = 1000 * 60 * 5;
|
const delayMs = 1000 * 60 * 5;
|
||||||
|
|
||||||
|
function updateLink(link, text, url) {
|
||||||
|
link.innerText = text;
|
||||||
|
link.setAttribute("href", url);
|
||||||
|
}
|
||||||
|
|
||||||
async function updateReleases() {
|
async function updateReleases() {
|
||||||
const requests = [];
|
const requests = [];
|
||||||
|
|
||||||
@ -30,17 +35,10 @@ async function updateReleases() {
|
|||||||
const release = document.getElementById(device + "-" + channel);
|
const release = document.getElementById(device + "-" + channel);
|
||||||
const links = release.getElementsByTagName("a");
|
const links = release.getElementsByTagName("a");
|
||||||
|
|
||||||
links[1].innerText = tag;
|
updateLink(links[1], tag, versionBaseUrl + tag);
|
||||||
links[1].setAttribute("href", versionBaseUrl + tag);
|
updateLink(links[2], factoryFilename, factoryUrl);
|
||||||
|
updateLink(links[3], factoryFilename + ".sig", factoryUrl + ".sig");
|
||||||
links[2].innerText = factoryFilename;
|
updateLink(links[4], updateFilename, updateUrl);
|
||||||
links[2].setAttribute("href", factoryUrl);
|
|
||||||
|
|
||||||
links[3].innerText = factoryFilename + ".sig";
|
|
||||||
links[3].setAttribute("href", factoryUrl + ".sig");
|
|
||||||
|
|
||||||
links[4].innerText = updateFilename;
|
|
||||||
links[4].setAttribute("href", updateUrl);
|
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user