shift = don't close

This commit is contained in:
Soph :3 2024-11-26 18:07:33 +02:00
parent f9dcdf8044
commit e5afe772e3
Signed by: sophie
GPG key ID: EDA5D222A0C270F2

View file

@ -96,6 +96,15 @@ if(window.PvInternals.services_client) {
style.innerHTML = `pv-chat>div button:nth-child(3){position:absolute;right:40px;z-index:26;cursor:url(88b4a467a18e813218f8.cur),auto;font-size:1em;border:none;height:46px;aspect-ratio:1;padding:0;border-radius:0;box-shadow:none;margin:0;flex:0;color:var(--color-text)}pv-chat>div button:nth-child(3)>img:hover{transform-origin:50% 50%;transform:scale(1.4);transition:.1s}pv-chat>div input[type=text]{padding:0 90px 0 14px}.emoji-container{display:grid;grid-template-columns:auto auto auto auto auto auto}.emoji-container>*{text-align:center;margin:2px}` style.innerHTML = `pv-chat>div button:nth-child(3){position:absolute;right:40px;z-index:26;cursor:url(88b4a467a18e813218f8.cur),auto;font-size:1em;border:none;height:46px;aspect-ratio:1;padding:0;border-radius:0;box-shadow:none;margin:0;flex:0;color:var(--color-text)}pv-chat>div button:nth-child(3)>img:hover{transform-origin:50% 50%;transform:scale(1.4);transition:.1s}pv-chat>div input[type=text]{padding:0 90px 0 14px}.emoji-container{display:grid;grid-template-columns:auto auto auto auto auto auto}.emoji-container>*{text-align:center;margin:2px}`
document.head.appendChild(style); document.head.appendChild(style);
let shiftHeldDown = false; // ShiftLeft/Right or False
document.addEventListener("keydown", (e) => {
if(!shiftHeldDown) shiftHeldDown = e.code;
})
document.addEventListener("keyup", (e) => {
if(e.code == shiftHeldDown) shiftHeldDown = false;
})
const pv = window.PvInternals; const pv = window.PvInternals;
const emojiRequest = await fetch("emojis.json"); const emojiRequest = await fetch("emojis.json");
@ -117,6 +126,7 @@ if(window.PvInternals.services_client) {
//#region Modal //#region Modal
class PvmeEmojiPicker extends pv.components_pv_popup_pv_popup { class PvmeEmojiPicker extends pv.components_pv_popup_pv_popup {
constructor() { constructor() {
super(); super();
@ -148,7 +158,7 @@ if(window.PvInternals.services_client) {
// #region Modal info // #region Modal info
const info = document.createElement("p") const info = document.createElement("p")
info.innerText = "Write 'discord' for discord emoijs, anything else for normal ones." info.innerText = "Write 'discord' for discord emoijs, anything else for normal ones.\nHold shift before opening emoji picker to spam emojis."
content.appendChild(info); content.appendChild(info);
//#endregion //#endregion
@ -173,7 +183,8 @@ if(window.PvInternals.services_client) {
div.addEventListener("click", () => { div.addEventListener("click", () => {
const chat = document.querySelector("pv-chat"); const chat = document.querySelector("pv-chat");
chat.input.value += z[1] + " "; chat.input.value += z[1] + " ";
pv.PopupManager.closeModals(); console.log(shiftHeldDown)
if(!shiftHeldDown) pv.PopupManager.closeModals();
setTimeout(() => { setTimeout(() => {
document.querySelector("pv-chat").input.scrollLeft = document.querySelector("pv-chat").input.scrollWidth; document.querySelector("pv-chat").input.scrollLeft = document.querySelector("pv-chat").input.scrollWidth;
}, 50) }, 50)
@ -186,7 +197,8 @@ if(window.PvInternals.services_client) {
img.addEventListener("click", () => { img.addEventListener("click", () => {
const chat = document.querySelector("pv-chat"); const chat = document.querySelector("pv-chat");
chat.input.value += z + " "; chat.input.value += z + " ";
pv.PopupManager.closeModals(); console.log(shiftHeldDown)
if(!shiftHeldDown) pv.PopupManager.closeModals();
setTimeout(() => { setTimeout(() => {
document.querySelector("pv-chat").input.scrollLeft = document.querySelector("pv-chat").input.scrollWidth; document.querySelector("pv-chat").input.scrollLeft = document.querySelector("pv-chat").input.scrollWidth;
}, 50) }, 50)