mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-09 07:45:01 +02:00
add prettier for JS style
This commit is contained in:
@ -3,7 +3,7 @@ const PLUGIN_API_VERSION = "1.0"
|
||||
const PLUGINS = {
|
||||
/**
|
||||
* Register new buttons to show on each output image.
|
||||
*
|
||||
*
|
||||
* Example:
|
||||
* PLUGINS['IMAGE_INFO_BUTTONS'].push({
|
||||
* text: 'Make a Similar Image',
|
||||
@ -29,14 +29,20 @@ const PLUGINS = {
|
||||
MODIFIERS_LOAD: [],
|
||||
TASK_CREATE: [],
|
||||
OUTPUTS_FORMATS: new ServiceContainer(
|
||||
function png() { return (reqBody) => new SD.RenderTask(reqBody) }
|
||||
, function jpeg() { return (reqBody) => new SD.RenderTask(reqBody) }
|
||||
, function webp() { return (reqBody) => new SD.RenderTask(reqBody) }
|
||||
),
|
||||
function png() {
|
||||
return (reqBody) => new SD.RenderTask(reqBody)
|
||||
},
|
||||
function jpeg() {
|
||||
return (reqBody) => new SD.RenderTask(reqBody)
|
||||
},
|
||||
function webp() {
|
||||
return (reqBody) => new SD.RenderTask(reqBody)
|
||||
}
|
||||
)
|
||||
}
|
||||
PLUGINS.OUTPUTS_FORMATS.register = function(...args) {
|
||||
const service = ServiceContainer.prototype.register.apply(this, args)
|
||||
if (typeof outputFormatField !== 'undefined') {
|
||||
if (typeof outputFormatField !== "undefined") {
|
||||
const newOption = document.createElement("option")
|
||||
newOption.setAttribute("value", service.name)
|
||||
newOption.innerText = service.name
|
||||
@ -46,13 +52,13 @@ PLUGINS.OUTPUTS_FORMATS.register = function(...args) {
|
||||
}
|
||||
|
||||
function loadScript(url) {
|
||||
const script = document.createElement('script')
|
||||
const script = document.createElement("script")
|
||||
const promiseSrc = new PromiseSource()
|
||||
script.addEventListener('error', () => promiseSrc.reject(new Error(`Script "${url}" couldn't be loaded.`)))
|
||||
script.addEventListener('load', () => promiseSrc.resolve(url))
|
||||
script.src = url + '?t=' + Date.now()
|
||||
script.addEventListener("error", () => promiseSrc.reject(new Error(`Script "${url}" couldn't be loaded.`)))
|
||||
script.addEventListener("load", () => promiseSrc.resolve(url))
|
||||
script.src = url + "?t=" + Date.now()
|
||||
|
||||
console.log('loading script', url)
|
||||
console.log("loading script", url)
|
||||
document.head.appendChild(script)
|
||||
|
||||
return promiseSrc.promise
|
||||
@ -60,7 +66,7 @@ function loadScript(url) {
|
||||
|
||||
async function loadUIPlugins() {
|
||||
try {
|
||||
const res = await fetch('/get/ui_plugins')
|
||||
const res = await fetch("/get/ui_plugins")
|
||||
if (!res.ok) {
|
||||
console.error(`Error HTTP${res.status} while loading plugins list. - ${res.statusText}`)
|
||||
return
|
||||
@ -69,6 +75,6 @@ async function loadUIPlugins() {
|
||||
const loadingPromises = plugins.map(loadScript)
|
||||
return await Promise.allSettled(loadingPromises)
|
||||
} catch (e) {
|
||||
console.log('error fetching plugin paths', e)
|
||||
console.log("error fetching plugin paths", e)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user