{"size": 1029, "ext": "js", "max_stars_repo_path": "helpers/dom-management/add-upload-handlers.js", "max_stars_repo_name": "We-Gold/Crop-Locator-Tool", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "helpers/dom-management/add-upload-handlers.js", "max_issues_repo_name": "We-Gold/Crop-Locator-Tool", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "helpers/dom-management/add-upload-handlers.js", "max_forks_repo_name": "We-Gold/Crop-Locator-Tool", "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": 29.4, "max_line_length": 65, "alphanum_fraction": 0.7434402332}
import { handleGuideTextToggle } from "./guide-text"
import { createUploadListeners } from "./create-upload-handlers"

export const addUploadHandlers = () => {
	const {
		replaceCropUploadHandler,
		sourceImageUploadHandler,
		cropImageUploadHandler,
	} = createUploadListeners()

	window.addEventListener("load", function () {
		// Handle the source image being uploaded
		document
			.querySelector("#source-image-input")
			.addEventListener("change", sourceImageUploadHandler)

		// Handle the crop being uploaded
		document
			.querySelector("#crop-image-input")
			.addEventListener("change", cropImageUploadHandler)

		// Handles whenever an image is uploaded to replace the crop
		// Note: this is a secondary feature that appears at the bottom
		// of the page
		document
			.querySelector("#new-crop-input")
			.addEventListener("change", replaceCropUploadHandler)

		// Manages the usage guide toggle button
		document
			.querySelector("#toggle-guide-text")
			.addEventListener("click", handleGuideTextToggle)
	})
}
