Commit Graph

308 Commits (main)

Author SHA1 Message Date
Danil Boldyrev b9c3cff892
fix typo 2024-08-13 15:02:30 +03:00
Danil Boldyrev ee84edc040
Update README.MD 2024-08-13 15:02:12 +03:00
Danil Boldyrev 6d17d9ff12 Fixed a problem with gradio 4+ 2024-08-13 14:59:48 +03:00
Danil Boldyrev 63ca81ef1d
Revert 2024-06-17 13:05:47 +03:00
richrobber2 5e5e36cb39
Update README.MD (#108)
* Update README.MD

* link to russian read me

* change to a language dir

add links for a language directory

* add local version of russian to language label
2024-06-14 16:09:29 -07:00
richrobber2 b1fadac08d Destructuring: Instead of accessing e.ctrlKey, e.metaKey, e.target, and e.code separately, we can destructure these properties directly in the function parameters. This makes the code cleaner and easier to read. 2024-06-12 04:04:54 -07:00
richrobber2 4330e06ebe Destructuring: Instead of accessing e.deltaY multiple times, we can destructure it directly in the function parameters. This makes the code cleaner and easier to read.
Early Return: Instead of wrapping the adjustBrushSize call in an if statement, we can return early if the condition is not met. This reduces the level of indentation and makes the code more readable.

Implicit Return: In arrow functions, if the function body consists of a single statement, you can omit the braces and the return keyword. This makes the code more concise. However, in this case, we need to explicitly return false to prevent the default action.
2024-06-12 04:01:46 -07:00
richrobber2 37d49a66b4 Optional Chaining (?.): This operator allows you to read the value of a property located deep within a chain of connected objects without having to check that each reference in the chain is valid. It's used here to safely access img2imgTabs and querySelectorAll properties of elements. If elements or img2imgTabs is null or undefined, it will return undefined instead of throwing an error.
Nullish Coalescing Operator (??): This operator returns the first argument if it's not null or undefined. Otherwise, it returns the second argument. In this case, if tabs is null or undefined, it will return an empty array to prevent errors when calling Array.from.
2024-06-12 03:58:41 -07:00
richrobber2 21299deb69 use object destructuring 2024-06-12 03:56:31 -07:00
richrobber2 436419230f Logical AND (&&) operator: I've used the logical AND (&&) operator to conditionally execute the addEventListener method. In JavaScript, if the first operand of the && operator is falsy, the second operand is not evaluated. This makes the code more concise and eliminates the need for an if statement. 2024-06-12 03:52:10 -07:00
richrobber2 a6dbceec24 Arrow function: I've used an arrow function instead of a function declaration. Arrow functions are more concise and have simpler syntax. They also have lexical this binding, which can be useful in certain contexts.
Destructuring assignment: I've used destructuring assignment to extract properties from objects. It's more concise and easier to read than accessing each property individually.

Combined conditions: I've combined the first two conditions into one if statement, as they both result in the same action (resetZoom()). This reduces redundancy and makes the code more concise.

Variable for repeated condition: I've created a variable isParentSmaller for the repeated condition parentElement.offsetWidth < targetElement.offsetWidth. This makes the code more readable and avoids unnecessary repeated calculations.
2024-06-12 03:50:07 -07:00
richrobber2 b26e9bc5bb toLowerCase(): I've replaced toLocaleLowerCase() with toLowerCase(). While toLocaleLowerCase() considers locale specific rules for converting characters, toLowerCase() does not. In this case, since we're comparing with the string "none", locale specific rules are not necessary.
Early return: I've replaced break with return in the for loops. This is because break only exits the current iteration of the loop, not the entire function. If el is falsy, we want to exit the entire function, not just the current iteration.

Removed commented code: I've removed the commented code at the top. It's generally a good practice to remove unused code to keep the codebase clean and readable. If this code is needed in the future, it can be retrieved from version control history.
2024-06-12 03:47:34 -07:00
richrobber2 842cf475c6 Refactor fitToElement function for better readability and efficiency
removed unused code (not sure what it was for but it has not been used for a long time im going to assume its not needed anymore)
2024-06-12 03:43:43 -07:00
richrobber2 a6ec26e03b destructure for ease of reading 2024-06-12 03:35:56 -07:00
richrobber2 a15a3c759a Converted the updateZoom function to an arrow function.
Removed the use of Object.assign for targetElement.style as it's not necessary. Directly assigning the properties is more readable and efficient.
2024-06-12 03:34:04 -07:00
richrobber2 7611b51352 Refactor brush size adjustment function for better readability and maintainability 2024-06-12 03:29:10 -07:00
richrobber2 92a5bd84d0 Used optional chaining (?.) to simplify the addition of the event listener to closeBtn. This avoids the need for an explicit check if closeBtn is truthy.
Combined the three if conditions that call fitToElement() into a single condition using logical OR (||), to avoid code duplication.
2024-06-12 03:25:20 -07:00
richrobber2 c5cc39fe1e Converted the fixCanvas function to an arrow function.
Used optional chaining (?.) to simplify the check if img exists and its display style is not "none". This avoids the need for an explicit check if img is truthy.
2024-06-12 03:22:45 -07:00
richrobber2 41ef5671f9 Converted the createFuncButtons function to an arrow function.
Created a helper function createButton to avoid code duplication when creating the buttons.
Used template literals to simplify the creation of the button's className and innerHTML.
2024-06-12 03:21:15 -07:00
richrobber2 94ece4bfd1 Converted the createTooltip function to an arrow function.
Used destructuring in the map and filter callbacks to simplify the access to properties.
Removed the redundant return keyword in the map callback by using implicit return.
2024-06-12 03:18:51 -07:00
richrobber2 698544c974 Used array destructuring to simplify the assignment of canvas, img, and imgUpload.
Used the spread operator (...) to simplify the assignment of rangeWidth, rangeHeight, inputWidth, and inputHeight.
Used array destructuring to simplify the assignment of rangeWidth.value, inputWidth.value, rangeHeight.value, and inputHeight.value.
Converted the for...of loop to a forEach loop for better readability.
2024-06-12 03:15:43 -07:00
richrobber2 504c69040a Converted the forEach callback to an arrow function.
Used optional chaining (?.) to simplify the addition of event listeners to sendToInpainBtn and sendToInpainBtnT2I. This avoids the need for separate if statements.
Used the logical OR operator (||) to simplify the assignment of sendToInpainBtn and sendToInpainBtnT2I. This avoids the need for a separate else block.
2024-06-12 03:13:02 -07:00
richrobber2 9ed3e36193 Converted the setImgDisplayToNone function to an arrow function.
Used optional chaining (?.) to simplify the setting of the display style. This avoids the need for an explicit check if img is truthy before setting its style.
2024-06-12 03:07:54 -07:00
richrobber2 47c4810521 Converted getSendButtons to an arrow function.
Used Boolean() to convert the result of document.querySelector() to a boolean.
Removed the commented out console.log statement.
Used the logical OR operator (||) to simplify the assignment of brush_color and sketch_brush_color in localStorage. This avoids the need for separate if statements.
2024-06-12 03:06:09 -07:00
richrobber2 c51f6bf0f2 Used optional chaining (?.) to simplify the extraction of the zoom level from the scaleMatch array. This avoids the need for an explicit check if scaleMatch is truthy before accessing its second element. 2024-06-12 02:59:08 -07:00
richrobber2 e00b3f58a4 Replaced the multiple equality checks with a single Array.prototype.includes call for better readability.
Used the nullish coalescing operator (??) to simplify the assignment of result[key] when userValue is undefined.
2024-06-12 02:56:04 -07:00
richrobber2 260be2a9cc Used Object.entries and Array.prototype.reduce to iterate over defaultHotkeysConfig and build the result object. This approach is more functional and avoids the need for a separate result object and for...in loop. 2024-06-12 02:51:14 -07:00
richrobber2 333521d2ec minor refactoring 2024-06-12 02:48:08 -07:00
Danil Boldyrev b221123739 fix for inc and dec buttons 2024-03-01 22:01:37 +03:00
Danil Boldyrev 736268215d Fixed an bug when changing brush size via buttons 2024-02-01 10:51:11 +03:00
Danil Boldyrev 55cbff67c0 Fix for working with SDNext 2024-02-01 10:29:40 +03:00
Danil Boldyrev 26450143c5 Added the ability to change the % of change in brush size 2023-12-12 23:26:16 +03:00
Danil Boldyrev 36762c013e Added hotkeys for change brush size, increased the maximum brush size fixed the bug 2023-09-26 19:08:17 +03:00
Danil Boldyrev 120f46efe6 Update modifyed gradio 2023-09-26 19:04:24 +03:00
Danil Boldyrev efba3a949d Improving proper uninstallation
Now if you disable extesion or disable all of them, gradio will automaticly reinstall
2023-09-06 06:11:55 +03:00
Danil Boldyrev 96125f540b remove console.log 2023-09-01 20:41:51 +03:00
Danil Boldyrev 74828c4495 fix button color 2023-09-01 20:15:33 +03:00
Danil Boldyrev 0029e7c617
Update info about 1.6 2023-08-31 22:28:52 +03:00
Danil Boldyrev efe589f697
Update README.MD 2023-08-31 22:28:02 +03:00
Danil Boldyrev de8a02d72d update gradio to 3.41.2, fix for webui 1.6 2023-08-31 22:22:35 +03:00
Danil Boldyrev 1bfb259f27 Returned the ability to select a color, added in 1.6 2023-08-24 21:56:53 +03:00
Danil Boldyrev edf5f981d2 remove console.log 2023-08-24 21:14:06 +03:00
Danil Boldyrev f776de54c9 Fixes for gradio 3.41 2023-08-24 21:03:35 +03:00
Danil Boldyrev 1407ea50e6 Update modifyed gradio to 3.41 2023-08-24 19:21:16 +03:00
Danil Boldyrev 17369a8ba6 fix auto-expand for extensions 2023-08-24 18:32:46 +03:00
Danil Boldyrev 668f958ba1 Synchronized the changes with version 1.6 2023-08-24 18:23:52 +03:00
Danil Boldyrev 439c414c6c Added the ability to control the level of transparency
in new webui
2023-08-16 21:51:45 +03:00
Danil Boldyrev 910a12a6b5 fix for new webui 2023-08-16 20:53:11 +03:00
Danil Boldyrev e2cf341d1d Fix auto-expand again 2023-08-16 11:32:44 +03:00
richrobber2 a2592b6ccc change formating 2023-08-11 21:44:07 -07:00