forked from cory/tildefriends
		
	Assign all stock apps an emoji, show them in the app list, and let the editor set them.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4242 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		| @@ -1,18 +1,28 @@ | ||||
| async function fetch_info(apps) { | ||||
| 	let result = {}; | ||||
| 	for (let [key, value] of Object.entries(apps)) { | ||||
| 		let blob = await ssb.blobGet(value); | ||||
| 		blob = blob ? utf8Decode(blob) : '{}'; | ||||
| 		result[key] = JSON.parse(blob); | ||||
| 	} | ||||
| 	return result; | ||||
| } | ||||
|  | ||||
| async function main() { | ||||
| 	var apps = await core.apps(); | ||||
| 	var core_apps = await core.apps('core'); | ||||
| 	var apps = await fetch_info(await core.apps()); | ||||
| 	var core_apps = await fetch_info(await core.apps('core')); | ||||
| 	var doc = `<!DOCTYPE html> | ||||
| <html> | ||||
| <head> | ||||
| 	<style> | ||||
| 		.container { | ||||
| 			display: grid; | ||||
| 			grid-template-columns: repeat(auto-fill, 8em); | ||||
| 			grid-template-columns: repeat(auto-fill, 64px); | ||||
| 			justify-content: space-around; | ||||
| 		} | ||||
| 		.app { | ||||
| 			height: 8em; | ||||
| 			width: 8em; | ||||
| 			height: 96px; | ||||
| 			width: 64px; | ||||
| 			display: flex; | ||||
| 			flex-direction: column; | ||||
| 			align-items: center; | ||||
| @@ -21,7 +31,7 @@ async function main() { | ||||
| 		} | ||||
| 		.app > a { | ||||
| 			text-decoration: none; | ||||
| 			max-width: 8em; | ||||
| 			max-width: 64px; | ||||
| 			text-overflow: ellipsis ellipsis; | ||||
| 			overflow: hidden; | ||||
| 		} | ||||
| @@ -42,7 +52,7 @@ async function main() { | ||||
|  | ||||
| 			let icon_a = document.createElement('a'); | ||||
| 			let icon = document.createElement('div'); | ||||
| 			icon.appendChild(document.createTextNode('📦')); | ||||
| 			icon.appendChild(document.createTextNode(apps[app].emoji || '📦')); | ||||
| 			icon.style.fontSize = 'xxx-large'; | ||||
| 			icon_a.appendChild(icon); | ||||
| 			icon_a.href = '/~' + name + '/' + app + '/'; | ||||
| @@ -63,4 +73,4 @@ async function main() { | ||||
| 	app.setDocument(doc); | ||||
| } | ||||
|  | ||||
| main(); | ||||
| main(); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user