FossilOrigin-Name: c62ed43b115d05ed5ceca3b258da63cbdd4081b3f034ff741f7b33e2d1f2daaa
This commit is contained in:
nekobit 2022-08-22 01:08:35 +00:00
parent d033f363c3
commit 1b347848e8
4 changed files with 95 additions and 95 deletions

View file

@ -24,8 +24,11 @@ sub generate_emoji
sub emoji_picker
{
my ($ssn, $data, $emojis) = @_;
my ($data, $emojis) = @_;
my %vars = (
e => $emojis
);
to_template(\%vars, \$data->{'emoji_picker.tt'});
}

View file

@ -103,22 +103,23 @@ char* construct_emoji_picker(char* status_id, size_t* size)
emojis[EMO_CAT_OBJECTS] = construct_func_strings(construct_emoji_voidwrap, args + EMO_CAT_OBJECTS, EMOJO_CAT_SYMBOLS - EMOJO_CAT_OBJECTS, len + 5);
emojis[EMO_CAT_SYMBOLS] = construct_func_strings(construct_emoji_voidwrap, args + EMO_CAT_SYMBOLS, EMOJO_CAT_FLAGS - EMOJO_CAT_SYMBOLS, len + 6);
emojis[EMO_CAT_FLAGS] = construct_func_strings(construct_emoji_voidwrap, args + EMO_CAT_FLAGS, EMOJO_CAT_MAX - EMOJO_CAT_FLAGS, len + 6);
struct emoji_picker_template data = {
.emojis_smileys = emojis[EMO_CAT_SMILEYS],
.emojis_animals = emojis[EMO_CAT_ANIMALS],
.emojis_food = emojis[EMO_CAT_FOOD],
.emojis_travel = emojis[EMO_CAT_TRAVEL],
.emojis_activities = emojis[EMO_CAT_ACTIVITIES],
.emojis_objects = emojis[EMO_CAT_OBJECTS],
.emojis_symbols = emojis[EMO_CAT_SYMBOLS],
.emojis_flags = emojis[EMO_CAT_FLAGS],
};
emoji_picker_html = tmpl_gen_emoji_picker(&data, size);
PERL_STACK_INIT;
XPUSHs(newRV_noinc((SV*)template_files));
AV* av = newAV();
for (int i = 0; i < EMO_CAT_LEN; ++i)
{
av_store(av, i, newSVpv(emojis + i, len + i));
}
XPUSHs(newRV_inc((SV*)av));
PERL_STACK_SCALAR_CALL("emojis::emoji_picker");
char* dup = PERL_GET_STACK_EXIT;
// Cleanup
for (size_t i = 0; i < EMO_CAT_LEN; ++i)
free(emojis[i]);
return emoji_picker_html;
return dup;
}
HV* perlify_emoji(struct mstdnt_emoji* const emoji)

View file

@ -22,10 +22,6 @@
#include <stdlib.h>
#include "easprintf.h"
// Templates
#include "../static/custom_emoji_reaction.ctmpl"
#include "../static/emoji_reaction.ctmpl"
#include "../static/emoji_reactions.ctmpl"
struct construct_emoji_reactions_args
{

View file

@ -1,81 +1,81 @@
<div class="emoji-picker">
<table class="tabs ui-table">
<tr>
<td>
<label for="cat-smileys">
<span class="tab-btn btn btn-alt">😃</span>
</label>
</td>
<td>
<label for="cat-animals">
<span class="tab-btn btn btn-alt">🐻</span>
</label>
</td>
<td>
<label for="cat-food">
<span class="tab-btn btn btn-alt">🍔</span>
</label>
</td>
<td>
<label for="cat-travel">
<span class="tab-btn btn btn-alt">🚀</span>
</label>
</td>
<td>
<label for="cat-activities">
<span class="tab-btn btn btn-alt">⚽</span>
</label>
</td>
<td>
<label for="cat-objects">
<span class="tab-btn btn btn-alt">🔧</span>
</label>
</td>
<td>
<label for="cat-symbols">
<span class="tab-btn btn btn-alt">🔢</span>
</label>
</td>
<td>
<label for="cat-flags">
<span class="tab-btn btn btn-alt">🎌</span>
</label>
</td>
</tr>
</table>
<table class="tabs ui-table">
<tr>
<td>
<label for="cat-smileys">
<span class="tab-btn btn btn-alt">😃</span>
</label>
</td>
<td>
<label for="cat-animals">
<span class="tab-btn btn btn-alt">🐻</span>
</label>
</td>
<td>
<label for="cat-food">
<span class="tab-btn btn btn-alt">🍔</span>
</label>
</td>
<td>
<label for="cat-travel">
<span class="tab-btn btn btn-alt">🚀</span>
</label>
</td>
<td>
<label for="cat-activities">
<span class="tab-btn btn btn-alt">⚽</span>
</label>
</td>
<td>
<label for="cat-objects">
<span class="tab-btn btn btn-alt">🔧</span>
</label>
</td>
<td>
<label for="cat-symbols">
<span class="tab-btn btn btn-alt">🔢</span>
</label>
</td>
<td>
<label for="cat-flags">
<span class="tab-btn btn btn-alt">🎌</span>
</label>
</td>
</tr>
</table>
<div class="emoji-picker-emojos-wrapper">
<input type="radio" class="hidden" id="cat-smileys" name="emoji-cat" checked>
<div class="emoji-picker-emojos">
{{%s:emojis_smileys}}
<div class="emoji-picker-emojos-wrapper">
<input type="radio" class="hidden" id="cat-smileys" name="emoji-cat" checked>
<div class="emoji-picker-emojos">
[% e.0 %]
</div>
<input type="radio" class="hidden" id="cat-animals" name="emoji-cat">
<div class="emoji-picker-emojos">
[% e.1 %]
</div>
<input type="radio" class="hidden" id="cat-food" name="emoji-cat">
<div class="emoji-picker-emojos">
[% e.2 %]
</div>
<input type="radio" class="hidden" id="cat-travel" name="emoji-cat">
<div class="emoji-picker-emojos">
[% e.3 %]
</div>
<input type="radio" class="hidden" id="cat-activities" name="emoji-cat">
<div class="emoji-picker-emojos">
[% e.4 %]
</div>
<input type="radio" class="hidden" id="cat-objects" name="emoji-cat">
<div class="emoji-picker-emojos">
[% e.5 %]
</div>
<input type="radio" class="hidden" id="cat-symbols" name="emoji-cat">
<div class="emoji-picker-emojos">
[% e.6 %]
</div>
<input type="radio" class="hidden" id="cat-flags" name="emoji-cat">
<div class="emoji-picker-emojos">
[% e.7 %]
</div>
</div>
<input type="radio" class="hidden" id="cat-animals" name="emoji-cat">
<div class="emoji-picker-emojos">
{{%s:emojis_animals}}
</div>
<input type="radio" class="hidden" id="cat-food" name="emoji-cat">
<div class="emoji-picker-emojos">
{{%s:emojis_food}}
</div>
<input type="radio" class="hidden" id="cat-travel" name="emoji-cat">
<div class="emoji-picker-emojos">
{{%s:emojis_travel}}
</div>
<input type="radio" class="hidden" id="cat-activities" name="emoji-cat">
<div class="emoji-picker-emojos">
{{%s:emojis_activities}}
</div>
<input type="radio" class="hidden" id="cat-objects" name="emoji-cat">
<div class="emoji-picker-emojos">
{{%s:emojis_objects}}
</div>
<input type="radio" class="hidden" id="cat-symbols" name="emoji-cat">
<div class="emoji-picker-emojos">
{{%s:emojis_symbols}}
</div>
<input type="radio" class="hidden" id="cat-flags" name="emoji-cat">
<div class="emoji-picker-emojos">
{{%s:emojis_flags}}
</div>
</div>
</div>