vvc
This commit is contained in:
parent
953a1fdc86
commit
39b6e6b67e
2 changed files with 76 additions and 66 deletions
|
@ -1,14 +1,18 @@
|
||||||
let loaded = false;
|
const fav = document.getElementById('EMOJIS_favorite')
|
||||||
|
const search_bar = document.getElementById('emoji_search')
|
||||||
|
const search_container = document.getElementById('emoji-tab-search')
|
||||||
|
let emojis = 1
|
||||||
|
|
||||||
|
|
||||||
function loadEmojis(form) {
|
function loadEmojis(form) {
|
||||||
if (loaded == false)
|
if (emojis == 1)
|
||||||
{
|
{
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
xhr.open("GET", '/marsey_list', true);
|
xhr.open("GET", '/marsey_list', true);
|
||||||
xhr.setRequestHeader('xhr', 'xhr');
|
xhr.setRequestHeader('xhr', 'xhr');
|
||||||
var f = new FormData();
|
var f = new FormData();
|
||||||
xhr.onload = function() {
|
xhr.onload = function() {
|
||||||
const emojis = {
|
emojis = {
|
||||||
'marsey': JSON.parse(xhr.response),
|
'marsey': JSON.parse(xhr.response),
|
||||||
|
|
||||||
'platy': ['plarsy','platyabused','platyblizzard','platyboxer','platydevil','platyfear','platygirlmagic','platygolong','platyhaes','platyking','platylove','platyneet','platyold','platypatience','platypopcorn','platyrich','platysarcasm','platysilly','platysleeping','platythink','platytired','platytuxedomask','platyblush','platybruh','platycaveman','platycheer','platydown','platyeyes','platyheart','platylol','platymicdrop','platynooo','platysalute','platyseethe','platythumbsup','platywave'],
|
'platy': ['plarsy','platyabused','platyblizzard','platyboxer','platydevil','platyfear','platygirlmagic','platygolong','platyhaes','platyking','platylove','platyneet','platyold','platypatience','platypopcorn','platyrich','platysarcasm','platysilly','platysleeping','platythink','platytired','platytuxedomask','platyblush','platybruh','platycaveman','platycheer','platydown','platyeyes','platyheart','platylol','platymicdrop','platynooo','platysalute','platyseethe','platythumbsup','platywave'],
|
||||||
|
@ -25,14 +29,19 @@ function loadEmojis(form) {
|
||||||
|
|
||||||
'wolf': ['wolfangry','wolfbrains','wolfcry','wolfdead','wolfdevilish','wolffacepalm','wolfhappy','wolfidea','wolfkoala','wolflaugh','wolflove','wolfmeditate','wolfphone','wolfrainbow','wolfroses','wolfsad','wolfsfear','wolfsleep','wolftear','wolfthink','wolfthumbsup','wolfupsidedown','wolfvictory','wolfwave','wolfwink'],
|
'wolf': ['wolfangry','wolfbrains','wolfcry','wolfdead','wolfdevilish','wolffacepalm','wolfhappy','wolfidea','wolfkoala','wolflaugh','wolflove','wolfmeditate','wolfphone','wolfrainbow','wolfroses','wolfsad','wolfsfear','wolfsleep','wolftear','wolfthink','wolfthumbsup','wolfupsidedown','wolfvictory','wolfwave','wolfwink'],
|
||||||
|
|
||||||
'misc': ['etika','sneed','retardedchildren','bruh','autism','doot','kylieface','queenyes','wholesomeseal','chadyescapy','gigachadglow','gigachadorthodox','gigachad','gigachad2','gigachad3']}
|
'misc': ['etika','sneed','retardedchildren','bruh','autism','doot','kylieface','queenyes','wholesomeseal','chadyescapy','gigachadglow','gigachadorthodox','gigachad','gigachad2','gigachad3']
|
||||||
|
}
|
||||||
|
loadEmojis(form);
|
||||||
|
}
|
||||||
|
xhr.send(f);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fav.setAttribute('data-form-destination', form)
|
||||||
|
|
||||||
document.getElementById('EMOJIS_favorite').setAttribute('data-form-destination', form)
|
const commentBox = document.getElementById(form)
|
||||||
|
|
||||||
const commentBox = document.getElementById(form);
|
|
||||||
commentBox.setAttribute('data-curr-pos', commentBox.selectionStart);
|
commentBox.setAttribute('data-curr-pos', commentBox.selectionStart);
|
||||||
|
|
||||||
if (document.getElementById('EMOJIS_favorite').innerHTML == "")
|
if (fav.innerHTML == "")
|
||||||
{
|
{
|
||||||
let str = ""
|
let str = ""
|
||||||
const favorite_emojis = JSON.parse(localStorage.getItem("favorite_emojis"))
|
const favorite_emojis = JSON.parse(localStorage.getItem("favorite_emojis"))
|
||||||
|
@ -45,10 +54,12 @@ function loadEmojis(form) {
|
||||||
for (const emoji of Object.keys(sortable).slice(0, 25))
|
for (const emoji of Object.keys(sortable).slice(0, 25))
|
||||||
str += `<button class="btn m-1 px-0 emoji2" onclick="getEmoji('${emoji}')" data-bs-toggle="tooltip" title=":${emoji}:" delay:="0"><img loading="lazy" width=50 src="/static/assets/images/emojis/${emoji}.webp" alt="${emoji}-emoji"></button>`
|
str += `<button class="btn m-1 px-0 emoji2" onclick="getEmoji('${emoji}')" data-bs-toggle="tooltip" title=":${emoji}:" delay:="0"><img loading="lazy" width=50 src="/static/assets/images/emojis/${emoji}.webp" alt="${emoji}-emoji"></button>`
|
||||||
|
|
||||||
document.getElementById('EMOJIS_favorite').innerHTML = str
|
fav.innerHTML = str
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (search_bar.value == "") {
|
||||||
|
search_container.innerHTML = ""
|
||||||
|
document.getElementById("tab-content").classList.remove("d-none");
|
||||||
if (document.getElementById("EMOJIS_marsey").innerHTML == "")
|
if (document.getElementById("EMOJIS_marsey").innerHTML == "")
|
||||||
{
|
{
|
||||||
for (const [k, v] of Object.entries(emojis)) {
|
for (const [k, v] of Object.entries(emojis)) {
|
||||||
|
@ -67,46 +78,45 @@ function loadEmojis(form) {
|
||||||
}
|
}
|
||||||
|
|
||||||
container.innerHTML = str
|
container.innerHTML = str
|
||||||
document.getElementById('emoji-tab-search').innerHTML = ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
loaded == true;
|
|
||||||
}
|
}
|
||||||
xhr.send(f);
|
else {
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
document.getElementById("emoji_search").oninput = function () {
|
|
||||||
let str = ''
|
let str = ''
|
||||||
for (let i = 0; i < emojis.length; i++) {
|
for (const [key, value] of Object.entries(emojis)) {
|
||||||
let arr = emojis[i].emojis
|
if (key == "marsey")
|
||||||
|
|
||||||
let container = document.getElementById(`EMOJIS_${emojis[i].type}`)
|
|
||||||
for (let j = 0; j < arr.length; j++) {
|
|
||||||
if (arr[j].match(search_bar.value.toLowerCase()) || search_bar.value.toLowerCase().match(arr[j])) {
|
|
||||||
str += `<button class="btn m-1 px-0 emoji2" onclick="getEmoji('${arr[j]}')" style="background: None!important; width:60px; overflow: hidden; border: none;" data-bs-toggle="tooltip" title=":${arr[j]}:" delay:="0"><img loading="lazy" width=50 src="/static/assets/images/emojis/${arr[j]}.webp" alt="${arr[j]}-emoji"></button>`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (i == 0)
|
|
||||||
{
|
{
|
||||||
let arr2 = emojis[i].emojis;
|
for (const [key, v] of Object.entries(value)) {
|
||||||
for (const [key, value] of Object.entries(arr2)) {
|
|
||||||
if (str.includes(`'${key}'`)) continue;
|
if (str.includes(`'${key}'`)) continue;
|
||||||
if (key.match(search_bar.value.toLowerCase()) || search_bar.value.toLowerCase().match(key) || value.match(search_bar.value.toLowerCase())) {
|
if (key.match(search_bar.value.toLowerCase()) || search_bar.value.toLowerCase().match(key) || v.match(search_bar.value.toLowerCase())) {
|
||||||
str += `<button class="btn m-1 px-0 emoji2" onclick="getEmoji('${key}')" data-bs-toggle="tooltip" title=":${key}:" delay:="0"><img loading="lazy" width=50 src="/static/assets/images/emojis/${key}.webp" alt="${key}-emoji"></button>`;
|
str += `<button class="btn m-1 px-0 emoji2" onclick="getEmoji('${key}')" data-bs-toggle="tooltip" title=":${key}:" delay:="0"><img loading="lazy" width=50 src="/static/assets/images/emojis/${key}.webp" alt="${key}-emoji"></button>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
container.innerHTML = ""
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (let i = 0; i < value.length; i++) {
|
||||||
|
if (value[i].match(search_bar.value.toLowerCase()) || search_bar.value.toLowerCase().match(value[i])) {
|
||||||
|
str += `<button class="btn m-1 px-0 emoji2" onclick="getEmoji('${value[i]}')" style="background: None!important; width:60px; overflow: hidden; border: none;" data-bs-toggle="tooltip" title=":${value[i]}:" delay:="0"><img loading="lazy" width=50 src="/static/assets/images/emojis/${value[i]}.webp" alt="${value[i]}-emoji"></button>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
document.getElementById('emoji-tab-search').innerHTML = str
|
}
|
||||||
|
}
|
||||||
|
document.getElementById("tab-content").classList.add("d-none");
|
||||||
|
search_container.innerHTML = str
|
||||||
|
}
|
||||||
|
search_bar.oninput = function () {
|
||||||
|
loadEmojis(form);
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getEmoji(searchTerm) {
|
function getEmoji(searchTerm) {
|
||||||
const form = document.getElementById('EMOJIS_favorite').getAttribute('data-form-destination')
|
const form = fav.getAttribute('data-form-destination')
|
||||||
const commentBox = document.getElementById(form);
|
const commentBox = document.getElementById(form)
|
||||||
const old = commentBox.value;
|
const old = commentBox.value;
|
||||||
const curPos = parseInt(commentBox.getAttribute('data-curr-pos'));
|
const curPos = parseInt(commentBox.getAttribute('data-curr-pos'));
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
<div class="modal-body p-0" id="emoji-modal-body">
|
<div class="modal-body p-0" id="emoji-modal-body">
|
||||||
<div id="emoji-tab-search"></div>
|
<div id="emoji-tab-search"></div>
|
||||||
<div id="no-emojis-found"></div>
|
<div id="no-emojis-found"></div>
|
||||||
<div class="tab-content">
|
<div id="tab-content" class="tab-content">
|
||||||
<div class="tab-pane fade show active" id="emoji-tab-favorite">
|
<div class="tab-pane fade show active" id="emoji-tab-favorite">
|
||||||
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_favorite"></div>
|
<div class="d-flex flex-wrap py-3 pl-2" id="EMOJIS_favorite"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue