forked from cory/tildefriends
Cory McWilliams
ec52e62908
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4163 ed5197a5-7fde-0310-b194-c3ffbd925b24
31 lines
816 B
JavaScript
31 lines
816 B
JavaScript
async function main() {
|
|
var apps = await core.apps();
|
|
var core_apps = await core.apps('core');
|
|
var doc = `<!DOCTYPE html>
|
|
<html>
|
|
<body style="background: #888">
|
|
<h1>Apps</h1>
|
|
<ul id="apps"></ul>
|
|
<h1>Core Apps</h1>
|
|
<ul id="core_apps"></ul>
|
|
</body>
|
|
<script>
|
|
function populate_apps(id, name, apps) {
|
|
var list = document.getElementById(id);
|
|
for (let app of Object.keys(apps).sort()) {
|
|
var li = list.appendChild(document.createElement('li'));
|
|
var a = document.createElement('a');
|
|
a.innerText = app;
|
|
a.href = '/~' + name + '/' + app + '/';
|
|
a.target = '_top';
|
|
li.appendChild(a);
|
|
}
|
|
}
|
|
populate_apps('apps', '${core.user.credentials?.session?.name}', ${JSON.stringify(apps)});
|
|
populate_apps('core_apps', 'core', ${JSON.stringify(core_apps)});
|
|
</script>
|
|
</html>`
|
|
app.setDocument(doc);
|
|
}
|
|
|
|
main(); |