mirror of
https://github.com/philomena-dev/philomena.git
synced 2024-12-05 00:57:59 +01:00
26 lines
691 B
JavaScript
26 lines
691 B
JavaScript
import { inputDuplicatorCreator } from './input-duplicator';
|
|
|
|
function setupInputs() {
|
|
inputDuplicatorCreator({
|
|
addButtonSelector: '.js-image-add-source',
|
|
fieldSelector: '.js-image-source',
|
|
maxInputCountSelector: '.js-max-source-count',
|
|
removeButtonSelector: '.js-source-remove',
|
|
});
|
|
}
|
|
|
|
function imageSourcesCreator() {
|
|
setupInputs();
|
|
document.addEventListener('fetchcomplete', ({ target, detail }) => {
|
|
const sourceSauce = document.querySelector('.js-sourcesauce');
|
|
|
|
if (target.matches('#source-form')) {
|
|
detail.text().then(text => {
|
|
sourceSauce.outerHTML = text;
|
|
setupInputs();
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
export { imageSourcesCreator };
|