stanley commited on
Commit
d88655d
·
1 Parent(s): 2d08e14

firebase index

Browse files
Files changed (1) hide show
  1. index.html +109 -7
index.html CHANGED
@@ -139,6 +139,64 @@ html, body {
139
  background-color: #713870; /* Change this to the desired hover background color */
140
  }
141
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
 
143
 
144
 
@@ -150,6 +208,12 @@ html, body {
150
  <div id="hamburger-menu">
151
  <i class="fa fa-eye" aria-hidden="true"></i>
152
  </div>
 
 
 
 
 
 
153
  <button type="button" class="control" id="export">Export</button>
154
  <button type="button" class="control" id="outpaint">Outpaint</button>
155
  <button type="button" class="control" id="undo">Undo</button>
@@ -191,10 +255,6 @@ html, body {
191
  <input type="file" name="state" id="upload_state" accept=".sdinf" hidden>
192
  <div style="position: relative;">
193
  <div id="toolbar" style></div>
194
- <!--
195
- <div id="toolbar_container">
196
- <div id="toolbar" style></div>
197
- </div> -->
198
 
199
  </div>
200
  </div>
@@ -204,6 +264,42 @@ html, body {
204
 
205
  // alert("starting js");
206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
207
  function aws(name, x, y) {
208
  return `coming from javascript ${name} ${x} ${y}`;
209
  }
@@ -448,10 +544,16 @@ function overrideW2uiStyles() {
448
 
449
  }
450
 
451
- // Execute style function to start checking
452
- overrideW2uiStyles();
 
 
 
 
 
 
 
453
 
454
- //window.addEventListener("applyCustomStyles", overrideW2uiStyles);
455
  // alert("js loaded");
456
  </script>
457
 
 
139
  background-color: #713870; /* Change this to the desired hover background color */
140
  }
141
 
142
+ #popup.popup-hidden {
143
+ display: none;
144
+ }
145
+
146
+ #popup {
147
+ position: fixed;
148
+ top: 0;
149
+ left: 0;
150
+ width: 100%;
151
+ height: 100%;
152
+ background-color: rgba(0, 0, 0, 0.5);
153
+ display: flex;
154
+ justify-content: center;
155
+ align-items: center;
156
+ z-index: 2000;
157
+ }
158
+
159
+ #popup-content {
160
+ background-color: #1F2937; /* Nighttime mode background color */
161
+ padding: 20px;
162
+ border-radius: 10px;
163
+ max-width: 80%;
164
+ max-height: 80%;
165
+ overflow-y: auto;
166
+ color: #ffffff; /* Nighttime mode text color */
167
+ }
168
+ #popup-content h2 {
169
+ font-weight: bold;
170
+ font-size: 16px;
171
+ background-color: #6B46C1;
172
+ border-radius: 10px;
173
+ padding: 5px;
174
+ color: #ffffff;
175
+ display: inline-block;
176
+ }
177
+
178
+ #prompt-list {
179
+ list-style-type: none;
180
+ padding: 0;
181
+ margin: 0;
182
+ }
183
+
184
+ .prompt-item {
185
+ display: flex;
186
+ flex-wrap: wrap;
187
+ justify-content: space-between;
188
+ padding: 5px 0;
189
+ }
190
+
191
+ .prompt-item span {
192
+ max-width: 68%;
193
+ word-wrap: break-word;
194
+ }
195
+
196
+ .prompt-item:nth-child(even) {
197
+ background-color: #2D3748; /* Nighttime mode alternate row color */
198
+ }
199
+
200
 
201
 
202
 
 
208
  <div id="hamburger-menu">
209
  <i class="fa fa-eye" aria-hidden="true"></i>
210
  </div>
211
+ <div id="popup" class="popup-hidden">
212
+ <div id="popup-content">
213
+ <h2>Prompt History</h2>
214
+ <ul id="prompt-list"></ul>
215
+ </div>
216
+ </div>
217
  <button type="button" class="control" id="export">Export</button>
218
  <button type="button" class="control" id="outpaint">Outpaint</button>
219
  <button type="button" class="control" id="undo">Undo</button>
 
255
  <input type="file" name="state" id="upload_state" accept=".sdinf" hidden>
256
  <div style="position: relative;">
257
  <div id="toolbar" style></div>
 
 
 
 
258
 
259
  </div>
260
  </div>
 
264
 
265
  // alert("starting js");
266
 
267
+ function togglePopup() {
268
+ const popup = document.getElementById("popup");
269
+ const hamburgerMenu = document.getElementById("hamburger-menu");
270
+ if (popup.classList.contains("popup-hidden")) {
271
+ popup.classList.remove("popup-hidden");
272
+ hamburgerMenu.classList.add("open");
273
+ fetchPromptsFromFirebase();
274
+ } else {
275
+ popup.classList.add("popup-hidden");
276
+ hamburgerMenu.classList.remove("open");
277
+ }
278
+ }
279
+
280
+ function fetchPromptsFromFirebase() {
281
+ const promptList = document.getElementById("prompt-list");
282
+ const database = firebase.database();
283
+ const inputsRef = database.ref("inputs");
284
+
285
+ inputsRef.on("value", (snapshot) => {
286
+ const prompts = snapshot.val();
287
+ promptList.innerHTML = "";
288
+ const keys = Object.keys(prompts).reverse();
289
+ for (const key of keys) {
290
+ const promptItem = document.createElement("li");
291
+ promptItem.classList.add("prompt-item");
292
+ const promptText = document.createElement("span");
293
+ promptText.textContent = prompts[key].prompt;
294
+ const timestamp = document.createElement("span");
295
+ timestamp.textContent = new Date(prompts[key].timestamp * 1000).toLocaleString();
296
+ promptItem.appendChild(promptText);
297
+ promptItem.appendChild(timestamp);
298
+ promptList.appendChild(promptItem);
299
+ }
300
+ });
301
+ }
302
+
303
  function aws(name, x, y) {
304
  return `coming from javascript ${name} ${x} ${y}`;
305
  }
 
544
 
545
  }
546
 
547
+ // Execute style function to start checking
548
+ overrideW2uiStyles();
549
+
550
+ document.getElementById("hamburger-menu").addEventListener("click", togglePopup);
551
+ document.getElementById("popup").addEventListener("click", (event) => {
552
+ if (event.target === event.currentTarget) {
553
+ togglePopup();
554
+ }
555
+ });
556
 
 
557
  // alert("js loaded");
558
  </script>
559