diff options
author | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-05-20 01:28:08 +0200 |
---|---|---|
committer | Heiner Lohaus <hlohaus@users.noreply.github.com> | 2024-05-20 01:28:08 +0200 |
commit | 80b2e9b80774c558cb863841e7e8214fbc0eca67 (patch) | |
tree | 449863877c368037c5951697d37e9bd997cf679a /g4f/gui/client/static/js/chat.v1.js | |
parent | Create windows release, improve styling (diff) | |
download | gpt4free-80b2e9b80774c558cb863841e7e8214fbc0eca67.tar gpt4free-80b2e9b80774c558cb863841e7e8214fbc0eca67.tar.gz gpt4free-80b2e9b80774c558cb863841e7e8214fbc0eca67.tar.bz2 gpt4free-80b2e9b80774c558cb863841e7e8214fbc0eca67.tar.lz gpt4free-80b2e9b80774c558cb863841e7e8214fbc0eca67.tar.xz gpt4free-80b2e9b80774c558cb863841e7e8214fbc0eca67.tar.zst gpt4free-80b2e9b80774c558cb863841e7e8214fbc0eca67.zip |
Diffstat (limited to 'g4f/gui/client/static/js/chat.v1.js')
-rw-r--r-- | g4f/gui/client/static/js/chat.v1.js | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/g4f/gui/client/static/js/chat.v1.js b/g4f/gui/client/static/js/chat.v1.js index 47bfdd3b..9790b261 100644 --- a/g4f/gui/client/static/js/chat.v1.js +++ b/g4f/gui/client/static/js/chat.v1.js @@ -192,6 +192,26 @@ const register_message_buttons = async () => { }) } }); + document.querySelectorAll(".message .fa-whatsapp").forEach(async (el) => { + if (!el.parentElement.href) { + const text = el.parentElement.parentElement.parentElement.innerText; + el.parentElement.href = `https://wa.me/?text=${encodeURIComponent(text)}`; + } + }); + document.querySelectorAll(".message .fa-print").forEach(async (el) => { + if (!("click" in el.dataset)) { + el.dataset.click = "true"; + el.addEventListener("click", async () => { + const message_el = el.parentElement.parentElement.parentElement; + el.classList.add("clicked"); + message_box.scrollTop = 0; + message_el.classList.add("print"); + setTimeout(() => el.classList.remove("clicked"), 1000); + setTimeout(() => message_el.classList.remove("print"), 1000); + window.print() + }) + } + }); } const delete_conversations = async () => { @@ -253,6 +273,8 @@ const handle_ask = async () => { ${count_words_and_tokens(message, get_selected_model())} <i class="fa-solid fa-volume-high"></i> <i class="fa-regular fa-clipboard"></i> + <a><i class="fa-brands fa-whatsapp"></i></a> + <i class="fa-solid fa-print"></i> </div> </div> </div> @@ -625,6 +647,8 @@ const load_conversation = async (conversation_id, scroll=true) => { ${count_words_and_tokens(item.content, next_provider?.model)} <i class="fa-solid fa-volume-high"></i> <i class="fa-regular fa-clipboard"></i> + <a><i class="fa-brands fa-whatsapp"></i></a> + <i class="fa-solid fa-print"></i> </div> </div> </div> |