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:
parent
46d3e8f567
commit
6cfe0ca4fb
@ -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,12 +28,28 @@ export function picker(callback, anchor) {
|
|||||||
div.style.maxHeight = '16em';
|
div.style.maxHeight = '16em';
|
||||||
div.style.overflow = 'scroll';
|
div.style.overflow = 'scroll';
|
||||||
div.style.fontWeight = 'bold';
|
div.style.fontWeight = 'bold';
|
||||||
div.style.cursor = 'pointer';
|
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) {
|
Object.entries(json).forEach(function(row) {
|
||||||
let header = document.createElement('div');
|
let header = document.createElement('div');
|
||||||
header.appendChild(document.createTextNode(row[0]));
|
header.appendChild(document.createTextNode(row[0]));
|
||||||
div.appendChild(header);
|
list.appendChild(header);
|
||||||
|
let any = false;
|
||||||
for (let entry of row[1]) {
|
for (let entry of row[1]) {
|
||||||
|
if (search &&
|
||||||
|
search.length &&
|
||||||
|
entry.name.indexOf(search) == -1) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let emoji = document.createElement('span');
|
let emoji = document.createElement('span');
|
||||||
const k_size = '1.25em';
|
const k_size = '1.25em';
|
||||||
emoji.style.width = k_size;
|
emoji.style.width = k_size;
|
||||||
@ -44,18 +60,27 @@ export function picker(callback, anchor) {
|
|||||||
emoji.style.minHeight = k_size;
|
emoji.style.minHeight = k_size;
|
||||||
emoji.style.display = 'inline-block';
|
emoji.style.display = 'inline-block';
|
||||||
emoji.style.overflow = 'hidden';
|
emoji.style.overflow = 'hidden';
|
||||||
|
emoji.style.cursor = 'pointer';
|
||||||
emoji.onclick = function() {
|
emoji.onclick = function() {
|
||||||
callback(entry);
|
callback(entry);
|
||||||
div.parentElement.removeChild(div);
|
div.parentElement.removeChild(div);
|
||||||
}
|
}
|
||||||
|
emoji.title = entry.name;
|
||||||
emoji.appendChild(document.createTextNode(entry.emoji));
|
emoji.appendChild(document.createTextNode(entry.emoji));
|
||||||
div.appendChild(emoji);
|
list.appendChild(emoji);
|
||||||
|
any = true;
|
||||||
|
}
|
||||||
|
if (!any) {
|
||||||
|
list.removeChild(header);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
refresh();
|
||||||
|
input.oninput = refresh;
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
if (anchor) {
|
if (anchor) {
|
||||||
let rect = anchor.getBoundingClientRect();
|
let rect = anchor.getBoundingClientRect();
|
||||||
if (rect.top < window.clientHeight / 2) {
|
if (rect.top < window.innerHeight / 2) {
|
||||||
div.style.top = rect.bottom + 'px';
|
div.style.top = rect.bottom + 'px';
|
||||||
} else {
|
} else {
|
||||||
div.style.top = (rect.top - div.clientHeight) + 'px';
|
div.style.top = (rect.top - div.clientHeight) + 'px';
|
||||||
|
@ -117,6 +117,7 @@ tfrpc.register(function push_posts(posts) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
tfrpc.register(function push_votes(votes) {
|
tfrpc.register(function push_votes(votes) {
|
||||||
|
Vue.set(g_data, 'votes', {});
|
||||||
votes.forEach(function(vote) {
|
votes.forEach(function(vote) {
|
||||||
var content = JSON.parse(vote.content);
|
var content = JSON.parse(vote.content);
|
||||||
var link = content.vote.link;
|
var link = content.vote.link;
|
||||||
@ -179,7 +180,7 @@ window.addEventListener('load', function() {
|
|||||||
data: g_data,
|
data: g_data,
|
||||||
watch: {
|
watch: {
|
||||||
whoami: function(newValue, oldValue) {
|
whoami: function(newValue, oldValue) {
|
||||||
tfrpc.rpc.refresh(newValue, this.selected, true);
|
tfrpc.rpc.refresh(newValue, this.selected, oldValue !== undefined);
|
||||||
},
|
},
|
||||||
selected: function(newValue, oldValue) {
|
selected: function(newValue, oldValue) {
|
||||||
let self = this;
|
let self = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user