36 lines
849 B
JavaScript
36 lines
849 B
JavaScript
"use strict";
|
|
|
|
class DownloadForm {
|
|
constructor(callback) {
|
|
this.query_selector = '#download-form';
|
|
this.callback = (event) => {
|
|
event.preventDefault();
|
|
callback(this.downloadFormUrl.value);
|
|
};
|
|
this.addEventListeners();
|
|
}
|
|
|
|
addEventListeners() {
|
|
this.downloadFormButton.addEventListener('click', this.callback);
|
|
this.element.addEventListener('submit', this.callback);
|
|
}
|
|
|
|
get downloadFormButton() {
|
|
return this.element.querySelector('#download-form-button');
|
|
}
|
|
|
|
get downloadFormUrl() {
|
|
return this.element.querySelector('#download-form-url');
|
|
}
|
|
|
|
get querySelector() {
|
|
return this.query_selector;
|
|
}
|
|
|
|
get element() {
|
|
return document.querySelector(this.querySelector);
|
|
}
|
|
}
|
|
|
|
export { DownloadForm };
|