show(success) {

		// If it's already open, don't let it open another one
		if(BigPopup.isOpen) {
			return false;
		}
		BigPopup.isOpen = true;

		// Clear everything first
		this.popup.innerHTML = "";

		// Add title
		this.popup.appendChild(Api.createElement("h2", { innerHTML: this.title }));

		// Create form
		const form = Api.createElement("div");
		form.classList.add("form");
		form.dataset.action = this.action;
		form.dataset.method = this.method;
		form.dataset.clearFields = true;
		form.setAttribute("name", "html-js-form");
		(this.id !== null ? form.dataset.id = this.id : true);


		// Add elements
		for(const el of this.elements) {
			form.appendChild(el);
		}
		

		// Add buttons
		const buttonCancel = Api.createElement("button", { innerHTML: "CANCEL", type: "submit", value: "submit", classList: "border--red small" });
		buttonCancel.addEventListener("click", () => {
			this.hide();
		});
		form.appendChild(buttonCancel);

		const buttonSave = Api.createElement("button", { innerHTML: success, type: "submit", value: "submit", classList: "small" });
		buttonSave.addEventListener("click", () => {
			this.hide();
		});
		buttonSave.setAttribute("name", "html-js-form-submit");
		form.appendChild(buttonSave);


		// Add form to popup
		this.popup.appendChild(form);

		// Create the forms
		HtmlJsForm.getForms();

		// Open popup
		this.popup.style.display = "block";
		setTimeout(() => {
			this.popup.classList.add("opened");
		}, 1);

	}
/**
	 * Shows the popup
	 * 
	 * @param {string} success The text on the success button
	 */
Shows the popup

@param {string} success The text on the success button
Shows the popup @param { string } success The text on the success button
show(success) {
		if(BigPopup.isOpen) {
			return false;
		}
		BigPopup.isOpen = true;
		this.popup.innerHTML = "";
		this.popup.appendChild(Api.createElement("h2", { innerHTML: this.title }));
		const form = Api.createElement("div");
		form.classList.add("form");
		form.dataset.action = this.action;
		form.dataset.method = this.method;
		form.dataset.clearFields = true;
		form.setAttribute("name", "html-js-form");
		(this.id !== null ? form.dataset.id = this.id : true);
		for(const el of this.elements) {
			form.appendChild(el);
		}
		const buttonCancel = Api.createElement("button", { innerHTML: "CANCEL", type: "submit", value: "submit", classList: "border--red small" });
		buttonCancel.addEventListener("click", () => {
			this.hide();
		});
		form.appendChild(buttonCancel);
		const buttonSave = Api.createElement("button", { innerHTML: success, type: "submit", value: "submit", classList: "small" });
		buttonSave.addEventListener("click", () => {
			this.hide();
		});
		buttonSave.setAttribute("name", "html-js-form-submit");
		form.appendChild(buttonSave);
		this.popup.appendChild(form);
		HtmlJsForm.getForms();
		this.popup.style.display = "block";
		setTimeout(() => {
			this.popup.classList.add("opened");
		}, 1);
	}
show ( success ) { if ( BigPopup . isOpen ) { return false ; } BigPopup . isOpen = true ; this . popup . innerHTML = "" ; this . popup . appendChild ( Api . createElement ( "h2" , { innerHTML : this . title } ) ) ; const form = Api . createElement ( "div" ) ; form . classList . add ( "form" ) ; form . dataset . action = this . action ; form . dataset . method = this . method ; form . dataset . clearFields = true ; form . setAttribute ( "name" , "html-js-form" ) ; ( this . id !== null ? form . dataset . id = this . id : true ) ; for ( const el of this . elements ) { form . appendChild ( el ) ; } const buttonCancel = Api . createElement ( "button" , { innerHTML : "CANCEL" , type : "submit" , value : "submit" , classList : "border--red small" } ) ; buttonCancel . addEventListener ( "click" , ( ) => { this . hide ( ) ; } ) ; form . appendChild ( buttonCancel ) ; const buttonSave = Api . createElement ( "button" , { innerHTML : success , type : "submit" , value : "submit" , classList : "small" } ) ; buttonSave . addEventListener ( "click" , ( ) => { this . hide ( ) ; } ) ; buttonSave . setAttribute ( "name" , "html-js-form-submit" ) ; form . appendChild ( buttonSave ) ; this . popup . appendChild ( form ) ; HtmlJsForm . getForms ( ) ; this . popup . style . display = "block" ; setTimeout ( ( ) => { this . popup . classList . add ( "opened" ) ; } , 1 ) ; }
Shows the popup
Shows the popup
// If it's already open, don't let it open another one // Clear everything first // Add title // Create form // Add elements // Add buttons // Add form to popup // Create the forms // Open popup