{"size": 1584, "ext": "js", "max_stars_repo_path": "public/js/Admin/galleryPreview.js", "max_stars_repo_name": "DZ8540/Arbor", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "public/js/Admin/galleryPreview.js", "max_issues_repo_name": "DZ8540/Arbor", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "public/js/Admin/galleryPreview.js", "max_forks_repo_name": "DZ8540/Arbor", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 40.6153846154, "max_line_length": 142, "alphanum_fraction": 0.5593434343}
document.querySelector('#gallery').onchange = evt => {
  document.querySelector('#galleryPreview').innerHTML = '';
  const files = document.querySelector('#gallery').files;

  for (let i = 0; i < files.length; i++) {
    if (files[i]) {
      let image = `
        <div style="margin-right: 20px; position: relative">
<!--            <button style="position: absolute; top: 0; right: 0" class="btn btn-danger galleryImage" id="${i}" type="button">x</button>-->
            <img src="${URL.createObjectURL(files[i])}" width="200px" alt="">
        </div> 
      `;
      document.querySelector('#galleryPreview').insertAdjacentHTML('beforeend', image);
    }
  }

  // let galleryImages = document.querySelectorAll('.galleryImage');
  // galleryImages.forEach(el => {
  //   let id = el.id;
  //   let files = Array.from(document.querySelector('#gallery').files);
  //
  //   el.addEventListener('click', () => {
  //     for (let i = 0; i < files.length; i++) {
  //       if (id == i) {
  //         files.splice(i, 1);
  //       }
  //     }
  //
  //     document.querySelector('#galleryPreview').innerHTML = '';
  //     let image = `
  //           <div style="margin-right: 20px; position: relative">
  //               <button style="position: absolute; top: 0; right: 0" class="btn btn-danger galleryImage" id="${i}" type="button">x</button>
  //               <img src="${URL.createObjectURL(files[i])}" width="200px" alt="">
  //           </div>
  //         `;
  //     document.querySelector('#galleryPreview').insertAdjacentHTML('beforeend', image);
  //   })
  // })
}