forked from cory/tildefriends
		
	Slight emoji picker improvements, and fix a problem with showing doubled votes. Though this revealed that loading needs serious work.
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3967 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
		| @@ -1 +1 @@ | ||||
| {"type":"tildefriends-app","files":{"app.js":"&7dCNJFk5RMHTWZC2qR8/UzjS22bXn7ZsPS6L/LIgUOg=.sha256","index.html":"&c+LsaIXIVMFXYjv5PkbgwjzxQ967QYRER5yy0YgpnZo=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&cI/JLy83mOngcqYCEP8Vej8urDvAQAV1WxFsL67/K3M=.sha256","tf-message.js":"&qFKclMumLUufurbQyh2MrjwBG6E9w3L7HLfpelzmxzc=.sha256","tf.js":"&MBqdk+3/ojaycNh92vOngTgvWk6h24vl8Q67MU4KZdI=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&LXyUSm6zSakN/ghJlZ1Qg2VJfV5alhN0gl8F7txIIOU=.sha256","style.css":"&qegBNCrVUihxffRUxGFuG/6u+0Y6d18zHtfNHBZtZ04=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&OkagZLqq/yuT7B/6vYzAhpzphnPZsofQChAOVy6ZZFY=.sha256"}} | ||||
| {"type":"tildefriends-app","files":{"app.js":"&7dCNJFk5RMHTWZC2qR8/UzjS22bXn7ZsPS6L/LIgUOg=.sha256","index.html":"&c+LsaIXIVMFXYjv5PkbgwjzxQ967QYRER5yy0YgpnZo=.sha256","vue-material.js":"&K5cdLqXYCENPak/TCINHQhyJhpS4G9DlZHGwoh/LF2g=.sha256","tf-user.js":"&cI/JLy83mOngcqYCEP8Vej8urDvAQAV1WxFsL67/K3M=.sha256","tf-message.js":"&qFKclMumLUufurbQyh2MrjwBG6E9w3L7HLfpelzmxzc=.sha256","tf.js":"&U4OySOFb2gqZJBgm+dUT44+OigJEgeNnJk3aYilnKNg=.sha256","commonmark.min.js":"&EP0OeR9zyLwZannz+0ga4s9AGES2RLvvIIQYHqqV6+k=.sha256","vue.js":"&g1wvA+yHl1sVC+eufTsg9If7ZeVyMTBU+h0tks7ZNzE=.sha256","vue-material-theme-default-dark.css":"&RP2nr+2CR18BpHHw5ST9a5GJUCOG9n0G2kuGkcQioWE=.sha256","vue-material.min.css":"&kGbUM2QgFSyHZRzqQb0b+0S3EVIlZ0AXpdiAVjIhou8=.sha256","roboto.css":"&jJv43Om673mQO5JK0jj7714s5E+5Yrf82H6LcDx7wUs=.sha256","material-icons.css":"&a28PdcVvgq/DxyIvJAx/e+ZOEtOuHnr3kjLWKyzH11M=.sha256","tf-shared.js":"&LXyUSm6zSakN/ghJlZ1Qg2VJfV5alhN0gl8F7txIIOU=.sha256","style.css":"&qegBNCrVUihxffRUxGFuG/6u+0Y6d18zHtfNHBZtZ04=.sha256","emojis.json":"&h3P4pez+AI4aYdsN0dJ3pbUEFR0276t9AM20caj/W/s=.sha256","emojis.js":"&zgD9eGT2WzOpHkQyraApePUZ7w5NdUFG+ip8KnSVGqw=.sha256"}} | ||||
| @@ -28,34 +28,59 @@ export function picker(callback, anchor) { | ||||
| 		div.style.maxHeight = '16em'; | ||||
| 		div.style.overflow = 'scroll'; | ||||
| 		div.style.fontWeight = 'bold'; | ||||
| 		div.style.cursor = 'pointer'; | ||||
| 		Object.entries(json).forEach(function(row) { | ||||
| 			let header = document.createElement('div'); | ||||
| 			header.appendChild(document.createTextNode(row[0])); | ||||
| 			div.appendChild(header); | ||||
| 			for (let entry of row[1]) { | ||||
| 				let emoji = document.createElement('span'); | ||||
| 				const k_size = '1.25em'; | ||||
| 				emoji.style.width = k_size; | ||||
| 				emoji.style.maxWidth = k_size; | ||||
| 				emoji.style.minWidth = k_size; | ||||
| 				emoji.style.height = k_size; | ||||
| 				emoji.style.maxHeight = k_size; | ||||
| 				emoji.style.minHeight = k_size; | ||||
| 				emoji.style.display = 'inline-block'; | ||||
| 				emoji.style.overflow = 'hidden'; | ||||
| 				emoji.onclick = function() { | ||||
| 					callback(entry); | ||||
| 					div.parentElement.removeChild(div); | ||||
| 				} | ||||
| 				emoji.appendChild(document.createTextNode(entry.emoji)); | ||||
| 				div.appendChild(emoji); | ||||
| 		let input = document.createElement('input'); | ||||
| 		input.type = 'text'; | ||||
| 		div.appendChild(input); | ||||
| 		let list = document.createElement('div'); | ||||
| 		div.appendChild(list); | ||||
| 		function refresh() { | ||||
| 			while (list.firstChild) { | ||||
| 				list.removeChild(list.firstChild); | ||||
| 			} | ||||
| 		}); | ||||
| 			let search = input.value; | ||||
| 			console.log('refrsh', search); | ||||
| 			Object.entries(json).forEach(function(row) { | ||||
| 				let header = document.createElement('div'); | ||||
| 				header.appendChild(document.createTextNode(row[0])); | ||||
| 				list.appendChild(header); | ||||
| 				let any = false; | ||||
| 				for (let entry of row[1]) { | ||||
| 					if (search && | ||||
| 						search.length && | ||||
| 						entry.name.indexOf(search) == -1) { | ||||
| 						continue; | ||||
| 					} | ||||
| 					let emoji = document.createElement('span'); | ||||
| 					const k_size = '1.25em'; | ||||
| 					emoji.style.width = k_size; | ||||
| 					emoji.style.maxWidth = k_size; | ||||
| 					emoji.style.minWidth = k_size; | ||||
| 					emoji.style.height = k_size; | ||||
| 					emoji.style.maxHeight = k_size; | ||||
| 					emoji.style.minHeight = k_size; | ||||
| 					emoji.style.display = 'inline-block'; | ||||
| 					emoji.style.overflow = 'hidden'; | ||||
| 					emoji.style.cursor = 'pointer'; | ||||
| 					emoji.onclick = function() { | ||||
| 						callback(entry); | ||||
| 						div.parentElement.removeChild(div); | ||||
| 					} | ||||
| 					emoji.title = entry.name; | ||||
| 					emoji.appendChild(document.createTextNode(entry.emoji)); | ||||
| 					list.appendChild(emoji); | ||||
| 					any = true; | ||||
| 				} | ||||
| 				if (!any) { | ||||
| 					list.removeChild(header); | ||||
| 				} | ||||
| 			}); | ||||
| 		} | ||||
| 		refresh(); | ||||
| 		input.oninput = refresh; | ||||
| 		document.body.appendChild(div); | ||||
| 		if (anchor) { | ||||
| 			let rect = anchor.getBoundingClientRect(); | ||||
| 			if (rect.top < window.clientHeight / 2) { | ||||
| 			if (rect.top < window.innerHeight / 2) { | ||||
| 				div.style.top = rect.bottom + 'px'; | ||||
| 			} else { | ||||
| 				div.style.top = (rect.top - div.clientHeight) + 'px'; | ||||
|   | ||||
| @@ -117,6 +117,7 @@ tfrpc.register(function push_posts(posts) { | ||||
| }); | ||||
|  | ||||
| tfrpc.register(function push_votes(votes) { | ||||
| 	Vue.set(g_data, 'votes', {}); | ||||
| 	votes.forEach(function(vote) { | ||||
| 		var content = JSON.parse(vote.content); | ||||
| 		var link = content.vote.link; | ||||
| @@ -179,7 +180,7 @@ window.addEventListener('load', function() { | ||||
| 		data: g_data, | ||||
| 		watch: { | ||||
| 			whoami: function(newValue, oldValue) { | ||||
| 				tfrpc.rpc.refresh(newValue, this.selected, true); | ||||
| 				tfrpc.rpc.refresh(newValue, this.selected, oldValue !== undefined); | ||||
| 			}, | ||||
| 			selected: function(newValue, oldValue) { | ||||
| 				let self = this; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user