imseldrith commited on
Commit
c79d99a
·
1 Parent(s): 58b83d1

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +52 -589
index.html CHANGED
@@ -1,3 +1,4 @@
 
1
  <!DOCTYPE html>
2
  <html lang="en">
3
 
@@ -12,597 +13,9 @@
12
  <link rel="stylesheet"
13
  href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/github-dark.css">
14
  <script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
 
15
  </head>
16
 
17
- <style>
18
- @import url('https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,200;0,400;0,800;1,200;1,400;1,800&display=swap');
19
-
20
- @import url('https://fonts.googleapis.com/css2?family=Product+Sans&family=Google+Sans+Display:ital@0;1&family=Google+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Google+Sans+Text:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=Material+Symbols+Outlined&family=Space+Mono&display=swap');
21
-
22
- @font-face {
23
- font-family: 'Material Symbols Outlined';
24
- font-style: normal;
25
- font-weight: 400;
26
- src: url(https://fonts.gstatic.com/s/materialsymbolsoutlined/v154/kJF1BvYX7BgnkSrUwT8OhrdQw4oELdPIeeII9v6oDMzByHX9rA6RzaxHMPdY43zj-jCxv3fzvRNU22ZXGJpEpjC_1v-p_4MrImHCIJIZrDCvHOej.woff2) format('woff2');
27
- }
28
-
29
- .material-symbols-outlined {
30
- font-family: 'Material Symbols Outlined';
31
- font-weight: normal;
32
- font-style: normal;
33
- font-size: 1.5rem;
34
- line-height: 1;
35
- letter-spacing: normal;
36
- text-transform: none;
37
- display: inline-block;
38
- white-space: nowrap;
39
- word-wrap: normal;
40
- direction: ltr;
41
- -webkit-font-feature-settings: 'liga';
42
- font-feature-settings: "liga";
43
- -webkit-font-smoothing: antialiased;
44
-
45
- }
46
-
47
- body {
48
- font-family: 'Noto Sans', sans-serif;
49
-
50
- margin: 0;
51
- }
52
-
53
- p {
54
- margin: 0;
55
- margin-bottom: 0.5rem;
56
- padding: 0;
57
- font-size: 1rem;
58
- }
59
-
60
- h1,
61
- h2,
62
- h3,
63
- ol,
64
- ul {
65
- margin: 0;
66
- }
67
-
68
- h1 {
69
- margin-bottom: 0.5rem;
70
- }
71
-
72
- a {
73
- color: #3b82f6;
74
- }
75
-
76
- input,
77
- textarea,
78
- select {
79
- border: 1px solid;
80
- padding: 0.5rem;
81
- border-radius: 0.5rem;
82
- border: none;
83
- font-family: noto sans, sans-serif;
84
- font-size: 1rem;
85
- }
86
-
87
- button:focus {
88
- outline: none;
89
- }
90
-
91
- .form {
92
- display: none;
93
- opacity: 0;
94
- flex-direction: column;
95
- width: 32rem;
96
- gap: 0.5rem;
97
- flex-grow: 1;
98
- justify-content: center;
99
- }
100
-
101
- .overlay {
102
- flex-direction: column;
103
- display: none;
104
- position: fixed;
105
- opacity: 0;
106
- top: 0;
107
- left: 0;
108
- width: 100dvw;
109
- height: 100dvh;
110
- backdrop-filter: blur(2rem);
111
- z-index: 2;
112
- justify-content: flex-start;
113
- align-items: center;
114
- }
115
-
116
- .backButton {
117
- position: absolute;
118
- top: 1rem;
119
- left: 1rem;
120
- border: none;
121
- background-color: transparent;
122
- font-size: 1.5rem;
123
- font-weight: 600;
124
- transition: all 0.2s;
125
-
126
- }
127
-
128
- #btn-hide-sidebar {
129
- display: none;
130
- }
131
-
132
- .message-container {
133
- display: flex;
134
- flex-direction: column-reverse;
135
- overflow-y: auto;
136
- gap: 1rem;
137
- padding-bottom: 2rem;
138
- flex-grow: 1;
139
- }
140
-
141
- .message-box {
142
- display: flex;
143
- position: relative;
144
- }
145
-
146
- .message {
147
-
148
- padding: 1rem;
149
- }
150
-
151
- .message-model {
152
- border-radius: 1rem;
153
- }
154
-
155
- #messageInput {
156
- height: 2.5rem;
157
- box-sizing: border-box;
158
- text-wrap: wrap;
159
- resize: none;
160
- width: 100%;
161
- padding-right: 2rem;
162
- }
163
-
164
- #messageInput::-webkit-scrollbar {
165
- height: 1rem;
166
- width: 0.5rem;
167
- }
168
-
169
- .btn-textual {
170
- background: transparent !important;
171
- margin: 0;
172
- padding: 0;
173
- border: none;
174
- transition: all 0.2s;
175
- cursor: pointer;
176
- font-size: inherit;
177
- }
178
-
179
-
180
-
181
- #btn-send {
182
- position: absolute;
183
- right: 0.5rem;
184
- bottom: 0.5rem;
185
- font-size: 1.5rem;
186
- }
187
-
188
- .btn-array {
189
- display: flex;
190
- flex-direction: row;
191
- gap: 0.5rem;
192
- margin-top: 0.5rem;
193
- }
194
-
195
- .btn-array button {
196
- flex-grow: 1;
197
- }
198
-
199
- .personality-prompt {
200
- display: none;
201
- }
202
-
203
- .prompt-field {
204
- resize: vertical;
205
- height: 7rem;
206
- }
207
-
208
- .container {
209
- box-sizing: border-box;
210
- display: flex;
211
- gap: 0.5rem;
212
- padding: 1rem;
213
-
214
-
215
- width: 100dvw;
216
- height: 100dvh;
217
-
218
- }
219
-
220
- .sidebar {
221
- position: sticky;
222
- top: 1rem;
223
-
224
- display: flex;
225
- flex-direction: column;
226
- overflow-y: auto;
227
- gap: 0.5rem;
228
- padding: 1rem;
229
- width: 25rem;
230
- border-radius: 1rem;
231
- scrollbar-width: thin;
232
- height: calc(100dvh - 4rem);
233
- z-index: 1;
234
- }
235
-
236
- .sidebar-section {
237
- margin-bottom: 1rem;
238
- display: flex;
239
- flex-direction: column;
240
- gap: 0.5rem;
241
- }
242
-
243
- #btn-show-sidebar {
244
- display: none;
245
- }
246
-
247
- .header {
248
- display: flex;
249
-
250
- box-sizing: border-box;
251
- align-items: center;
252
- font-size: 2rem;
253
- font-weight: 800;
254
- gap: 0.5rem;
255
- width: 100%;
256
- }
257
-
258
- .navbar {
259
- position: relative;
260
- display: flex;
261
- flex-direction: row;
262
- border-radius: 0.5rem;
263
- justify-content: space-evenly;
264
- margin-bottom: 1rem;
265
- z-index: 0;
266
- }
267
-
268
- .navbar-tab {
269
- width: 100%;
270
- padding: 0.5rem;
271
- text-align: center;
272
-
273
- z-index: 2;
274
- -webkit-tap-highlight-color: transparent;
275
- cursor: pointer;
276
-
277
- }
278
-
279
-
280
-
281
- .navbar-tab-highlight {
282
- padding: 0;
283
- margin: 0;
284
- position: absolute;
285
- border-radius: 0.5rem;
286
- transition: all 0.2s;
287
- height: 100%;
288
- z-index: 1;
289
- /* glow */
290
- box-shadow: 0 0 1rem 0.05rem #29292a3f;
291
- }
292
-
293
- #gemini-pro-branding {
294
- font-family: Google Sans Display, sans-serif;
295
- color: #7c8a9c;
296
- font-size: 1rem;
297
- font-weight: 400;
298
- }
299
-
300
- #gemin-pro-logo {
301
- width: 2rem;
302
- height: 2rem;
303
- }
304
-
305
- .credits {
306
- margin-top: auto;
307
- display: flex;
308
- padding: 0rem 1rem 0 1rem;
309
-
310
- font-size: 0.75rem;
311
- color: #7c8a9c;
312
-
313
- justify-content: space-between;
314
- align-items: center;
315
- }
316
-
317
- button {
318
- border: none;
319
- background-color: #3b82f6;
320
- color: white;
321
- padding: 0.5rem;
322
- border-radius: 0.5rem;
323
- transition: all 0.2s;
324
- }
325
-
326
- #mainContent {
327
- display: flex;
328
- flex-direction: column;
329
- padding: 2rem;
330
- margin-left: auto;
331
- margin-right: auto;
332
- width: 32rem;
333
- text-align: justify;
334
- }
335
-
336
- .card-personality {
337
- box-sizing: border-box;
338
- -moz-box-sizing: border-box;
339
- -webkit-box-sizing: border-box;
340
- color: #e4e4e4;
341
- background-color: black;
342
- background-size: cover;
343
- background-position: center;
344
- position: relative;
345
-
346
- display: flex;
347
- flex-direction: column;
348
- justify-content: end;
349
- padding: 1rem;
350
- border-radius: 1rem;
351
- height: 10rem;
352
- -webkit-tap-highlight-color: transparent;
353
- cursor: pointer;
354
- text-shadow: 0 0 10px #000000, 0 0 5px #181818;
355
- }
356
-
357
- .edit:hover {
358
- text-shadow: 0 0 10px #e4e4e4, 0 0 5px #dfdfdf;
359
- }
360
-
361
-
362
- .card-personality * {
363
- /* unselectable */
364
- -webkit-user-select: none;
365
- /* Safari */
366
- -moz-user-select: none;
367
- /* Firefox */
368
- -ms-user-select: none;
369
- /* IE10+/Edge */
370
- user-select: none;
371
- /* Standard */
372
-
373
- }
374
-
375
- .card-personality input {
376
- display: none;
377
- }
378
-
379
- .btn-edit-card {
380
- /* top right corner */
381
- position: absolute;
382
- top: 1rem;
383
- right: 1rem;
384
- color: #e4e4e4;
385
- }
386
-
387
- .btn-share-card {
388
- /* bottom right corner */
389
- position: absolute;
390
- top: 1rem;
391
- right: 2.5rem;
392
- font-size: 1rem;
393
- color: #e4e4e4;
394
- }
395
-
396
- #btn-hide-overlay {
397
- padding: 2rem;
398
- }
399
-
400
-
401
-
402
-
403
- @media (max-width: 768px) {
404
- body {
405
- margin: 0;
406
- padding: 0;
407
- }
408
-
409
-
410
- .container {
411
- padding: 0;
412
-
413
- }
414
-
415
- .message-container {
416
- padding-left: 1rem;
417
- padding-right: 1rem;
418
- }
419
-
420
- .sidebar {
421
- top: 0;
422
- height: calc(100dvh - 2rem);
423
- margin: 0;
424
- width: calc(100dvw - 2rem);
425
- position: fixed;
426
- border-radius: 0;
427
- display: none;
428
- }
429
-
430
- .navbar {
431
- position: relative;
432
- }
433
-
434
-
435
- #btn-hide-sidebar {
436
- display: block;
437
- }
438
-
439
- #mainContent {
440
- padding: 0;
441
- margin: 0;
442
- width: 100%;
443
- }
444
-
445
- #mainContent .header {
446
- padding: 2rem;
447
- }
448
-
449
- #messageInput {
450
- border-radius: 0;
451
- }
452
-
453
- #btn-show-sidebar {
454
- display: block;
455
- }
456
- }
457
-
458
-
459
- /* Light theme styles */
460
- @media (prefers-color-scheme: light) {
461
- :focus {
462
- outline: 1px solid #8f9eb3;
463
- }
464
-
465
- body {
466
- background-color: #f0f6ff;
467
- color: #0a0a0a;
468
- }
469
-
470
- a {
471
- color: #444ed6;
472
- }
473
-
474
- .sidebar {
475
- background-color: #d2e2f7;
476
- }
477
-
478
- .navbar {
479
- background-color: rgb(176 205 246);
480
- }
481
-
482
- .navbar-tab {
483
- color: #0a0a0a;
484
- }
485
-
486
- .navbar-tab-highlight {
487
- background-color: #87b0ed;
488
- }
489
-
490
- .btn-textual:hover {
491
- text-shadow: 0 0 10px #000000;
492
- }
493
-
494
- button {
495
- background-color: #83b5f7;
496
-
497
- color: #2b3d59;
498
- }
499
-
500
- button:hover {
501
- background-color: rgb(63, 191, 255);
502
- }
503
-
504
-
505
- input,
506
- textarea,
507
- select {
508
- background-color: #f0f6ff;
509
- outline: 1px solid #8f9eb3;
510
- }
511
-
512
- input::placeholder,
513
- textarea::placeholder {
514
- color: #7c8a9c;
515
- }
516
-
517
- .message-model {
518
- background-color: #d2e2f7;
519
- }
520
- }
521
-
522
- /* Dark theme styles */
523
- @media (prefers-color-scheme: dark) {
524
- :root {
525
- color-scheme: dark;
526
- }
527
-
528
- :focus {
529
- outline: 1px solid #73859e;
530
- }
531
-
532
-
533
-
534
- body {
535
- background-color: #151e24;
536
- color: #e4e4e4;
537
- }
538
-
539
- a {
540
- color: #92d9eb;
541
- }
542
-
543
-
544
-
545
- .sidebar {
546
- background-color: #1a2733;
547
- }
548
-
549
- .navbar {
550
- background-color: #00000047;
551
- }
552
-
553
- .navbar-tab {
554
- color: #e4e4e4;
555
- }
556
-
557
- .navbar-tab-highlight {
558
- background-color: #22486b;
559
-
560
- box-shadow: 0 0 1rem 0.05rem #29292aac;
561
- }
562
-
563
- button {
564
- background-color: #22486b;
565
- color: #c9d3ee;
566
- }
567
-
568
- button:hover {
569
- background-color: #31689c;
570
- }
571
-
572
- .btn-textual {
573
- color: #e4e4e4;
574
- }
575
-
576
- .btn-textual:hover {
577
- text-shadow: 0 0 10px #ffffff, 0 0 5px #dfdfdf;
578
- }
579
-
580
- .edit:hover {
581
- text-shadow: 0 0 10px #ffffff, 0 0 5px #dfdfdf;
582
- /* Change #00ff00 to the color you want */
583
- }
584
-
585
- input,
586
- textarea,
587
- select {
588
- background-color: #283542;
589
-
590
- color: #e4e4e4;
591
- border: none;
592
- }
593
-
594
- input::placeholder,
595
- textarea::placeholder {
596
- color: #849caf;
597
- }
598
-
599
-
600
- .message-model {
601
- background-color: #1a2733;
602
- }
603
- }
604
- </style>
605
-
606
  <body>
607
  <div class="container">
608
  <div class="sidebar">
@@ -642,6 +55,7 @@
642
  <div class="btn-array" id="btn-array-personality-section">
643
  <button id="btn-add-personality">Add Personality</button>
644
  <button id="btn-import-personality">Import</button>
 
645
  </div>
646
  </div>
647
 
@@ -839,6 +253,7 @@
839
  const editDefaultPersonalityButton = document.querySelector("#btn-edit-personality-default");
840
  const submitNewPersonalityButton = document.querySelector("#btn-submit-personality");
841
  const updatePersonalityButton = document.querySelector("#updatePersonality");
 
842
 
843
  const sendMessageButton = document.querySelector("#btn-send");
844
 
@@ -1013,6 +428,44 @@
1013
  closeOverlay();
1014
  }
1015
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1016
  async function run() {
1017
  const msg = document.querySelector("#messageInput");
1018
  const msgText = msg.value;
@@ -1160,6 +613,16 @@
1160
  sendMessageButton.addEventListener("click", run);
1161
 
1162
 
 
 
 
 
 
 
 
 
 
 
1163
  // ...
1164
  </script>
1165
 
 
1
+
2
  <!DOCTYPE html>
3
  <html lang="en">
4
 
 
13
  <link rel="stylesheet"
14
  href="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/github-dark.css">
15
  <script src="https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js"></script>
16
+ <link rel="stylesheet" type="text/css" href="style.css">
17
  </head>
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 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="btn-add-personality">Add Personality</button>
57
  <button id="btn-import-personality">Import</button>
58
+ <button id="btn-save-personalities">Save</button>
59
  </div>
60
  </div>
61
 
 
253
  const editDefaultPersonalityButton = document.querySelector("#btn-edit-personality-default");
254
  const submitNewPersonalityButton = document.querySelector("#btn-submit-personality");
255
  const updatePersonalityButton = document.querySelector("#updatePersonality");
256
+ const savePersonalitiesButton = document.querySelector("#btn-save-personalities");
257
 
258
  const sendMessageButton = document.querySelector("#btn-send");
259
 
 
428
  closeOverlay();
429
  }
430
 
431
+ //save personalities to local storage
432
+ async function savePersonalities() {
433
+ //get array of personality cards
434
+ const personalityCards = document.querySelectorAll(".card-personality");
435
+
436
+ //create an array of personality objects
437
+ const personalityObjects = [];
438
+ personalityCards.forEach(card => {
439
+ const personalityObject = {
440
+ name: card.querySelector(".personality-title").innerText,
441
+ description: card.querySelector(".personality-description").innerText,
442
+ prompt: card.querySelector(".personality-prompt").innerText,
443
+ image: card.style.backgroundImage.match(/url\((.*?)\)/)[1].replace(/('|")/g, '')
444
+ }
445
+ personalityObjects.push(personalityObject);
446
+ })
447
+
448
+ //stringify the array
449
+ const personalityJSON = JSON.stringify(personalityObjects);
450
+
451
+ //save to local storage
452
+ localStorage.setItem("personalities", personalityJSON);
453
+ }
454
+
455
+ //load personalities from local storage
456
+ async function loadPersonalities() {
457
+ //get the json string from local storage
458
+ const personalityJSON = localStorage.getItem("personalities");
459
+
460
+ //parse the json string into an array
461
+ const personalityObjects = JSON.parse(personalityJSON);
462
+
463
+ //insert each personality into the DOM
464
+ personalityObjects.forEach(personalityObject => {
465
+ insertPersonality(personalityObject);
466
+ })
467
+ }
468
+
469
  async function run() {
470
  const msg = document.querySelector("#messageInput");
471
  const msgText = msg.value;
 
613
  sendMessageButton.addEventListener("click", run);
614
 
615
 
616
+ //load local storage if available
617
+ if (localStorage.getItem("personalities")) {
618
+ loadPersonalities();
619
+ }
620
+
621
+ //save personalities to local storage when closing the window
622
+ window.addEventListener("beforeunload", () => {
623
+ savePersonalities();
624
+ })
625
+
626
  // ...
627
  </script>
628