Skip to content

Commit

Permalink
add: 'isLocalFile' check mentioned in Ademking#44
Browse files Browse the repository at this point in the history
  • Loading branch information
Metacor committed Oct 20, 2022
1 parent d389175 commit 6b61588
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
19 changes: 10 additions & 9 deletions dist/all.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ let IS_HELP_OPEN = false
let IS_CROP_OPEN = false

let viewer
let isLocalFile = window.location.href.match(/(file:\/\/)/) ? true : false;
let BACKGROUND_TYPE = 'blurred'
let UPLOAD_SITE = 'imgbb'
let ImgCanvas
Expand Down Expand Up @@ -595,7 +596,7 @@ function init(settings) {
}
},
paint: settings.settings.paint && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: function () {
isKeypressEnabled = true
Expand Down Expand Up @@ -810,14 +811,14 @@ function init(settings) {
}
},
download: settings.settings.download && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: function () {
download(viewer.image)
}
},
upload: settings.settings.upload && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: function () {
let uriString = getBase64Image(viewer.image)
Expand Down Expand Up @@ -900,7 +901,7 @@ function init(settings) {
}
},
colorpicker: settings.settings.colorpicker && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: async function () {
if (!IS_PICKER_OPEN) {
Expand Down Expand Up @@ -1000,7 +1001,7 @@ function init(settings) {
}
},
details: settings.settings.details && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: async function () {
if (!IS_DETAILS_OPEN) {
Expand Down Expand Up @@ -1073,7 +1074,7 @@ function init(settings) {
}
},
print: settings.settings.print && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: function () {
printImage(viewer.image)
Expand Down Expand Up @@ -1275,7 +1276,7 @@ function init(settings) {
}
},
photopea: settings.settings.photopea && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: function () {
let currentUrl = window.location.href
Expand Down Expand Up @@ -1321,7 +1322,7 @@ function init(settings) {
}
},
tineye: settings.settings.tineye && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: function () {
// toastify
Expand Down Expand Up @@ -1353,7 +1354,7 @@ function init(settings) {
}
},
qr: settings.settings.qr && {
show: 1,
show: isLocalFile ? 0 : 1,
size: 'large',
click: function () {
// show loading toast
Expand Down

0 comments on commit 6b61588

Please sign in to comment.