jclyo1 commited on
Commit
5bd8c44
1 Parent(s): 2da4724
static/images/check.svg ADDED
static/images/x.svg ADDED
static/index.html CHANGED
@@ -121,9 +121,8 @@
121
  <img id="uploaded-image" class="thumbnail" />
122
  </div>
123
  <div class="col">
124
- Content Credentials
125
- <span id="contentCredentialResults"></span><br />
126
- Digital watermark <span id="digitalWatermarkResults"></span>
127
  </div>
128
  </div>
129
  </div>
@@ -259,7 +258,7 @@
259
  class="form-check-input"
260
  type="checkbox"
261
  value=""
262
- id="terms"
263
  />
264
  <label class="form-check-label" for="defaultCheck1">
265
  By using this demo you agree to the
@@ -267,7 +266,7 @@
267
  </label>
268
  </div>
269
 
270
- <button type="submit" class="btn btn-primary">Submit</button>
271
  </form>
272
 
273
  <div class="how-it-works">
@@ -306,7 +305,7 @@
306
  class="form-check-input"
307
  type="checkbox"
308
  value=""
309
- id="terms"
310
  />
311
  <label class="form-check-label" for="defaultCheck1">
312
  By using this demo you agree to the
@@ -314,7 +313,7 @@
314
  </label>
315
  </div>
316
 
317
- <button type="submit" class="btn btn-primary">Submit</button>
318
  </form>
319
  <div class="how-it-works">
320
  <p><strong>How it works</strong></p>
@@ -349,6 +348,9 @@
349
  const imageGenForm = document.querySelector(".image-gen-form");
350
  const imagePrompt = document.getElementById("prompt");
351
  const model = document.getElementById("model");
 
 
 
352
  const generateImageContainer = document.querySelector(
353
  ".display-generate .image-container"
354
  );
@@ -364,9 +366,22 @@
364
  const verificationOutput = document.getElementById("verification-output");
365
  const certificateList = document.getElementById("certificate-list");
366
  const outputContainer = document.querySelector(".output-container");
367
-
 
 
368
  var certificates = [];
369
 
 
 
 
 
 
 
 
 
 
 
 
370
  generateTab.addEventListener("click", (event) => {
371
  event.target.classList.add("active");
372
  verifyTab.classList.remove("active");
@@ -451,10 +466,17 @@
451
  .then((data) => {
452
  console.log(data);
453
 
454
- document.getElementById("contentCredentialResults").innerHTML =
455
- data.contains_c2pa;
456
- document.getElementById("digitalWatermarkResults").innerHTML =
457
- data.contains_watermark;
 
 
 
 
 
 
 
458
 
459
  if (
460
  data.contains_c2pa == "true" &&
@@ -533,6 +555,9 @@
533
  imageGenForm.addEventListener("submit", async (event) => {
534
  event.preventDefault();
535
 
 
 
 
536
  placeholder = document.querySelector(".display-generate .placeholder");
537
  spinner = document.querySelector(".display-generate .spinner");
538
  generateActionMenu.style.display = "none";
@@ -726,6 +751,7 @@
726
  document.querySelector(".details .algorithm").innerHTML =
727
  certificate.algorithm;
728
 
 
729
  if (certificate.modulus !== undefined) {
730
  document.querySelector(".details .modulus").innerHTML =
731
  certificate.modulus;
@@ -733,6 +759,7 @@
733
  } else {
734
  document.querySelector("#modulusContainers").style.display = "none";
735
  }
 
736
 
737
  if (certificate.namedCurve !== undefined) {
738
  document.querySelector(".details .namedCurve").innerHTML =
 
121
  <img id="uploaded-image" class="thumbnail" />
122
  </div>
123
  <div class="col">
124
+ <div id="content-crendentials-icon"></div> Content Credentials<br />
125
+ <div id="digital-watermark-icon"></div> Digital watermark
 
126
  </div>
127
  </div>
128
  </div>
 
258
  class="form-check-input"
259
  type="checkbox"
260
  value=""
261
+ id="generate-terms"
262
  />
263
  <label class="form-check-label" for="defaultCheck1">
264
  By using this demo you agree to the
 
266
  </label>
267
  </div>
268
 
269
+ <button type="submit" class="btn btn-primary" id="generate-button">Submit</button>
270
  </form>
271
 
272
  <div class="how-it-works">
 
305
  class="form-check-input"
306
  type="checkbox"
307
  value=""
308
+ id="verify-terms"
309
  />
310
  <label class="form-check-label" for="defaultCheck1">
311
  By using this demo you agree to the
 
313
  </label>
314
  </div>
315
 
316
+ <button type="submit" class="btn btn-primary" id="verify-button">Submit</button>
317
  </form>
318
  <div class="how-it-works">
319
  <p><strong>How it works</strong></p>
 
348
  const imageGenForm = document.querySelector(".image-gen-form");
349
  const imagePrompt = document.getElementById("prompt");
350
  const model = document.getElementById("model");
351
+ const generateTerms = document.getElementById("generate-terms");
352
+ const generateButton = document.getElementById("generate-button");
353
+
354
  const generateImageContainer = document.querySelector(
355
  ".display-generate .image-container"
356
  );
 
366
  const verificationOutput = document.getElementById("verification-output");
367
  const certificateList = document.getElementById("certificate-list");
368
  const outputContainer = document.querySelector(".output-container");
369
+ const contentCredentialsIcon = document.getElementById("content-crendentials-icon");
370
+ const digitalWatermarkIcon = document.getElementById("digital-watermark-icon");
371
+
372
  var certificates = [];
373
 
374
+ [imagePrompt, model].forEach((item) => {
375
+ item.addEventListener("change", async (event) => {
376
+ setGenerateButtonStatus();
377
+ });
378
+ });
379
+
380
+ const setGenerateButtonStatus = () => {
381
+ if (imagePrompt.value && model.value && generateTerms.checked) generateButton.classList.add("active");
382
+ else generateButton.classList.remove("active");
383
+ };
384
+
385
  generateTab.addEventListener("click", (event) => {
386
  event.target.classList.add("active");
387
  verifyTab.classList.remove("active");
 
466
  .then((data) => {
467
  console.log(data);
468
 
469
+ if (data.contains_c2pa == 'true') {
470
+ contentCredentialsIcon.setAttribute('class', 'check-icon')
471
+ } else {
472
+ contentCredentialsIcon.setAttribute('class', 'x-icon')
473
+ }
474
+
475
+ if (data.contains_watermark == 'true') {
476
+ digitalWatermarkIcon.setAttribute('class', 'check-icon')
477
+ } else {
478
+ digitalWatermarkIcon.setAttribute('class', 'x-icon')
479
+ }
480
 
481
  if (
482
  data.contains_c2pa == "true" &&
 
555
  imageGenForm.addEventListener("submit", async (event) => {
556
  event.preventDefault();
557
 
558
+ if (!imagePrompt.value || !model.value || !generateTerms.checked)
559
+ return;
560
+
561
  placeholder = document.querySelector(".display-generate .placeholder");
562
  spinner = document.querySelector(".display-generate .spinner");
563
  generateActionMenu.style.display = "none";
 
751
  document.querySelector(".details .algorithm").innerHTML =
752
  certificate.algorithm;
753
 
754
+ /*
755
  if (certificate.modulus !== undefined) {
756
  document.querySelector(".details .modulus").innerHTML =
757
  certificate.modulus;
 
759
  } else {
760
  document.querySelector("#modulusContainers").style.display = "none";
761
  }
762
+ */
763
 
764
  if (certificate.namedCurve !== undefined) {
765
  document.querySelector(".details .namedCurve").innerHTML =
static/style.css CHANGED
@@ -133,6 +133,8 @@ label.form-check-label {
133
 
134
  .btn-primary {
135
  width: 100%;
 
 
136
  }
137
 
138
  .display-verify {
@@ -305,4 +307,31 @@ img.thumbnail {
305
 
306
  #logo img {
307
  width: 156px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
308
  }
 
133
 
134
  .btn-primary {
135
  width: 100%;
136
+ background: rgba(206, 206, 206, 1);
137
+ color: white;
138
  }
139
 
140
  .display-verify {
 
307
 
308
  #logo img {
309
  width: 156px;
310
+ }
311
+
312
+ .check-icon, .x-icon {
313
+ width: 16px;
314
+ height: 16px;
315
+ display: inline-block;
316
+ }
317
+
318
+ .check-icon {
319
+ background-image: url('images/check.svg');
320
+ }
321
+
322
+ .x-icon {
323
+ background-image: url('images/x.svg');
324
+ }
325
+
326
+ .btn-primary.active {
327
+ background-color: #1a6dff;
328
+ }
329
+
330
+ .btn-primary.active:hover {
331
+ background-color: #165ad9;
332
+
333
+ }
334
+
335
+ .btn-primary.active:active {
336
+ background: #1247b2;
337
  }