File size: 3,058 Bytes
3fd12a3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82


  document.addEventListener('DOMContentLoaded', () => {
   var GotitB = document.querySelector(".explainChoix button")
var explain = document.querySelector(".explainChoix")
var SummarizeInput = document.querySelector(".SummarizeInput")
var CaptionInput = document.querySelector(".CaptionInput")
GotitB.addEventListener("click",()=>{
   explain.style.opacity="0"
})

document.querySelectorAll('.select-options input[type="radio"]').forEach(radio => {
    radio.addEventListener('change', (e) => {
      if (e.target.checked) {
        const selectedValue = e.target.value;
        if(selectedValue=="Summarize"){
          SummarizeInput.classList.add("active")
          SummarizeInput.classList.remove("innactive")
          CaptionInput.classList.remove("active")
          CaptionInput.classList.add("innactive")
        }
        else{
          SummarizeInput.classList.add("innactive")
          SummarizeInput.classList.remove("active")
          CaptionInput.classList.remove("innactive")
          CaptionInput.classList.add("active")
        }
      }
    });
  });
    const fileUpload = document.getElementById('file-upload');
    const imageUpload = document.getElementById('image-upload');
    
    // Get the icon buttons
    const fileBtn = document.getElementById('file-btn');
    const imageBtn = document.getElementById('image-btn');
    
    // Set up file input for documents (PDF, DOCX, PPTX, XLSX)
    fileBtn.addEventListener('click', () => {
      fileUpload.click();
    });
    
    fileUpload.addEventListener('change', (e) => {
      if (e.target.files.length > 0) {
        const file = e.target.files[0];
        const validDocTypes = [
          'application/pdf',
          'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
          'application/vnd.openxmlformats-officedocument.presentationml.presentation',
          'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
        ];
        
        if (validDocTypes.includes(file.type)) {
          console.log('Valid document selected:', file.name);
          // Handle the document file here
        } else {
          alert('Please select a valid document (PDF, DOCX, PPTX, or XLSX)');
          fileUpload.value = ''; // Reset the input
        }
      }
    });
    
    // Set up file input for images
    imageBtn.addEventListener('click', () => {
      imageUpload.click();
    });
    
    imageUpload.addEventListener('change', (e) => {
      if (e.target.files.length > 0) {
        const file = e.target.files[0];
        const validImageTypes = ['image/jpeg', 'image/png', 'image/gif', 'image/webp'];
        
        if (validImageTypes.includes(file.type)) {
          console.log('Valid image selected:', file.name);
          // Handle the image file here
        } else {
          alert('Please select a valid image (JPEG, PNG, GIF, or WEBP)');
          imageUpload.value = ''; // Reset the input
        }
      }
    });
  });