Skip to content

Commit

Permalink
0.10
Browse files Browse the repository at this point in the history
  • Loading branch information
crnormand committed Nov 11, 2022
1 parent ff83752 commit a8bfa38
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 19 deletions.
10 changes: 6 additions & 4 deletions image-previewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ImagePreviewer extends Application {
}

getData() {
return { preview: this.imageUrl}
return { preview: this.imageUrl }
}

showPreview(imageUrl, previewPos) {
Expand Down Expand Up @@ -49,9 +49,11 @@ Hooks.on('renderFilePicker', (app, html, data) => {
}
// get the proper image path
let path = ev.target.dataset.path;
let fileExtension = path.split('.')[path.split('.').length - 1].toLowerCase();
if (fileExtension in CONST.IMAGE_FILE_EXTENSIONS) {
imagePreviewer.showPreview(path, previewPos);
if (path) {
let fileExtension = path.split('.')[path.split('.').length - 1].toLowerCase();
if (fileExtension in CONST.IMAGE_FILE_EXTENSIONS) {
imagePreviewer.showPreview(path, previewPos);
}
}
}, ev => {
imagePreviewer.hoverOff();
Expand Down
42 changes: 27 additions & 15 deletions module.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
{
"name": "image-previewer",
"title": "Image Previewer",
"description": "A little app to preview images when you hover over them in the file picker menu.",
"version": "0.9",
"author": "Chris Normand/Nose66#6689",
"scripts": ["./image-previewer.js"],
"styles": ["./image-previewer.css"],
"packs": [],
"url": "https://github.com/crnormand/image-previewer",
"manifest": "https://raw.githubusercontent.com/crnormand/image-previewer/release/module.json",
"download": "https://github.com/crnormand/image-previewer/archive/0.9.zip",
"minimumCoreVersion": "9",
"compatibleCoreVersion": "9"
}
{
"title": "Image Previewer",
"description": "A little app to preview images when you hover over them in the file picker menu.",
"version": "0.10",
"scripts": [
"image-previewer.js"
],
"styles": [
"image-previewer.css"
],
"url": "https://github.com/crnormand/image-previewer",
"manifest": "https://raw.githubusercontent.com/crnormand/image-previewer/release/module.json",
"download": "https://github.com/crnormand/image-previewer/archive/0.10.zip",
"id": "image-previewer",
"authors": [
{
"name": "Chris Normand",
"email": "[email protected]",
"discord": "Nose66#6689",
"flags": {}
}
],
"compatibility": {
"minimum": "9",
"verified": "10"
}
}

0 comments on commit a8bfa38

Please sign in to comment.