Spaces:
Runtime error
Runtime error
Download javascript/imageParams.js from bilegentile/test: direct link, hf CLI and curl.
- Browser
- Download file 1.07 kB
-
https://huggingface.co/spaces/bilegentile/test/resolve/refs%2Fpr%2F3/javascript/imageParams.js
- Command line
-
hf download hf://spaces/bilegentile/test@refs/pr/3/javascript/imageParams.js
-
curl -L -o imageParams.js https://huggingface.co/spaces/bilegentile/test/resolve/refs%2Fpr%2F3/javascript/imageParams.js
1.07 kB
| let dragDropInitialized = false; | |
| async function initDragDrop() { | |
| if (dragDropInitialized) return; | |
| dragDropInitialized = true; | |
| log('initDragDrop'); | |
| window.addEventListener('drop', (e) => { | |
| const target = e.composedPath()[0]; | |
| if (!target.placeholder) return; | |
| if (target.placeholder.indexOf('Prompt') === -1) return; | |
| const tab = get_tab_index('tabs'); | |
| let promptTarget = ''; | |
| if (tab === 0) promptTarget = 'txt2img_prompt_image'; | |
| else if (tab === 1) promptTarget = 'img2img_prompt_image'; | |
| else if (tab === 2) promptTarget = 'control_prompt_image'; | |
| else return; | |
| const imgParent = gradioApp().getElementById(promptTarget); | |
| const fileInput = imgParent.querySelector('input[type="file"]'); | |
| if (!imgParent || !fileInput) return; | |
| if ((e.dataTransfer?.files?.length || 0) > 0) { | |
| e.stopPropagation(); | |
| e.preventDefault(); | |
| fileInput.files = e.dataTransfer.files; | |
| fileInput.dispatchEvent(new Event('change')); | |
| log('dropEvent files', fileInput.files); | |
| } | |
| }); | |
| } | |
| onAfterUiUpdate(initDragDrop); | |