-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
54 lines (48 loc) · 2.07 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// script.js
document.addEventListener('DOMContentLoaded', () => {
// Dev Menu Toggle
document.getElementById('dev-menu-toggle').addEventListener('click', () => {
const devMenu = document.getElementById('dev-menu');
devMenu.classList.toggle('hidden');
});
// Settings Toggle
document.getElementById('settings-toggle').addEventListener('click', () => {
const settingsMenu = document.getElementById('settings-menu');
settingsMenu.classList.toggle('hidden');
});
// NG GPTs Toggle
document.getElementById('ng-gpt-toggle').addEventListener('click', () => {
const ngGptSection = document.getElementById('ng-gpt-section');
ngGptSection.classList.toggle('hidden');
});
// Send Message
document.getElementById('send-message').addEventListener('click', () => {
const input = document.getElementById('chat-input');
const message = input.value.trim();
if (message) {
const chatBox = document.getElementById('chat-box');
const messageElement = document.createElement('div');
messageElement.classList.add('chat-message');
messageElement.textContent = message;
chatBox.appendChild(messageElement);
input.value = '';
}
});
// Save Chat
document.getElementById('save-chat').addEventListener('click', () => {
// Implement chat saving logic
const chatBox = document.getElementById('chat-box');
const messages = chatBox.querySelectorAll('.chat-message');
const chatData = Array.from(messages).map(msg => msg.textContent).join('\n');
// Create a .ntggpt file
const blob = new Blob([chatData], { type: 'text/plain' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = 'chat.ntggpt';
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
});
});