many things
This commit is contained in:
		
							
								
								
									
										52
									
								
								gallery.mjs
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								gallery.mjs
									
									
									
									
									
								
							@@ -329,44 +329,21 @@ export default class gallery {
 | 
				
			|||||||
		[
 | 
							[
 | 
				
			||||||
			"moving",
 | 
								"moving",
 | 
				
			||||||
			new Map([
 | 
								new Map([
 | 
				
			||||||
                                [
 | 
									["dragstart", async (event) => {}],
 | 
				
			||||||
                                        "dragstart",
 | 
					 | 
				
			||||||
                                        async (event) => {},
 | 
					 | 
				
			||||||
                                ],
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                [
 | 
									["dragover", async (event) => {}],
 | 
				
			||||||
                                        "dragover",
 | 
					 | 
				
			||||||
                                        async (event) => {},
 | 
					 | 
				
			||||||
                                ],
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                [
 | 
									["dragenter", async (event) => {}],
 | 
				
			||||||
                                        "dragenter",
 | 
					 | 
				
			||||||
                                        async (event) => {},
 | 
					 | 
				
			||||||
                                ],
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                [
 | 
									["dragleave", async (event) => {}],
 | 
				
			||||||
                                        "dragleave",
 | 
					 | 
				
			||||||
                                        async (event) => {},
 | 
					 | 
				
			||||||
                                ],
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                [
 | 
									["dragend", async (event) => {}],
 | 
				
			||||||
                                        "dragend",
 | 
					 | 
				
			||||||
                                        async (event) => {},
 | 
					 | 
				
			||||||
                                ],
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                [
 | 
									["drop", async (event) => {}],
 | 
				
			||||||
                                        "drop",
 | 
					 | 
				
			||||||
                                        async (event) => {},
 | 
					 | 
				
			||||||
                                ],
 | 
					 | 
				
			||||||
			]),
 | 
								]),
 | 
				
			||||||
		],
 | 
							],
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                [
 | 
							["wrap", new Map([["generated", async (wrap, order) => {}]])],
 | 
				
			||||||
                        "wrap",
 | 
					 | 
				
			||||||
                        new Map([
 | 
					 | 
				
			||||||
                                ["generated", async (wrap, order) => {}],
 | 
					 | 
				
			||||||
                        ]),
 | 
					 | 
				
			||||||
                ],
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		[
 | 
							[
 | 
				
			||||||
			"import",
 | 
								"import",
 | 
				
			||||||
@@ -439,7 +416,7 @@ export default class gallery {
 | 
				
			|||||||
		this.#identifiers.push(
 | 
							this.#identifiers.push(
 | 
				
			||||||
			...[...this.#gallery.querySelectorAll("div.image")].map((image) =>
 | 
								...[...this.#gallery.querySelectorAll("div.image")].map((image) =>
 | 
				
			||||||
				image.getAttribute("id")
 | 
									image.getAttribute("id")
 | 
				
			||||||
                        ),
 | 
								)
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -533,7 +510,7 @@ export default class gallery {
 | 
				
			|||||||
			"src",
 | 
								"src",
 | 
				
			||||||
			target instanceof File
 | 
								target instanceof File
 | 
				
			||||||
				? window.URL.createObjectURL(target)
 | 
									? window.URL.createObjectURL(target)
 | 
				
			||||||
                                : (target + "?updated=" + Date.now()),
 | 
									: target + "?updated=" + Date.now()
 | 
				
			||||||
		);
 | 
							);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		// Assembling
 | 
							// Assembling
 | 
				
			||||||
@@ -678,7 +655,7 @@ export default class gallery {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
			// Initializing the image
 | 
								// Initializing the image
 | 
				
			||||||
			const image = this.#gallery.querySelector(
 | 
								const image = this.#gallery.querySelector(
 | 
				
			||||||
                                "div.image#" + CSS.escape(identifier) + ">img",
 | 
									"div.image#" + CSS.escape(identifier) + ">img"
 | 
				
			||||||
			);
 | 
								);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (image instanceof HTMLImageElement) {
 | 
								if (image instanceof HTMLImageElement) {
 | 
				
			||||||
@@ -696,7 +673,9 @@ export default class gallery {
 | 
				
			|||||||
							// Initializing listener for the "LoadEnd" event
 | 
												// Initializing listener for the "LoadEnd" event
 | 
				
			||||||
							reader.onloadend = () => resolve(reader.result);
 | 
												reader.onloadend = () => resolve(reader.result);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                                                        fetch(content).then((r) => r.blob()).then((value) => {
 | 
												fetch(content)
 | 
				
			||||||
 | 
													.then((r) => r.blob())
 | 
				
			||||||
 | 
													.then((value) => {
 | 
				
			||||||
									// Converted "blob:..." string to Blob object
 | 
														// Converted "blob:..." string to Blob object
 | 
				
			||||||
 | 
					
 | 
				
			||||||
									if (base64) {
 | 
														if (base64) {
 | 
				
			||||||
@@ -775,13 +754,14 @@ export default class gallery {
 | 
				
			|||||||
					const identifier = wrap.getAttribute("id");
 | 
										const identifier = wrap.getAttribute("id");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
					if (
 | 
										if (
 | 
				
			||||||
                                                typeof identifier === "string" || typeof identifier === "number"
 | 
											typeof identifier === "string" ||
 | 
				
			||||||
 | 
											typeof identifier === "number"
 | 
				
			||||||
					) {
 | 
										) {
 | 
				
			||||||
						// Initialized the wrap identifier
 | 
											// Initialized the wrap identifier
 | 
				
			||||||
 | 
					
 | 
				
			||||||
						// Converting the image and writing into the converted images buffer
 | 
											// Converting the image and writing into the converted images buffer
 | 
				
			||||||
						converted.push(
 | 
											converted.push(
 | 
				
			||||||
                                                        await this.export(identifier, base64, silent) ?? null,
 | 
												(await this.export(identifier, base64, silent)) ?? null
 | 
				
			||||||
						);
 | 
											);
 | 
				
			||||||
					}
 | 
										}
 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user