Sebastiankay commited on
Commit
b022cd3
·
1 Parent(s): 436c61b
Files changed (3) hide show
  1. .gitignore +1 -0
  2. javascript.js +23 -43
  3. photo-enhance.code-workspace +12 -0
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ neu.html
javascript.js CHANGED
@@ -1,49 +1,29 @@
1
  function gradioCustomJS() {
2
  console.log("gradioCustomJS Started")
3
-
4
- //component-15
5
- const tabNav = document.querySelector("#component-153 > div.tab-nav.svelte-1uw5tnk")
6
- /*const tabNav = document.querySelector('.tab-nav')
7
- tabNav.addEventListener("wheel", (event) => {
8
- event.preventDefault()
9
- const scrollLeft = tabNav.scrollLeft + event.deltaY
10
- tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
11
- })
12
- tabNav.addEventListener("mouseover", () => {
13
- tabNav.addEventListener("wheel", (event) => {
14
- event.preventDefault()
15
- let scrollLeft = 0;
16
- Math.sign(event.deltaY) < 0 && (scrollLeft = tabNav.scrollLeft - 20), Math.sign(event.deltaY) > 0 && (scrollLeft = tabNav.scrollLeft + 20);
17
- tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
18
- })
19
- })
20
-
21
- tabNav.addEventListener("mouseout", () => {
22
- tabNav.removeEventListener("wheel", (event) => {
23
- event.preventDefault()
24
- const scrollLeft = tabNav.scrollLeft + event.deltaY
25
- tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
26
- })
27
- })
28
- */
29
-
30
- // Funktion, um die Scroll-Richtung des Mausrads zu übersetzen
31
- function translateMouseWheel(e) {
32
- if (e.type === 'wheel') {
33
- if (e.target.closest("#component-153 > div.tab-nav.svelte-1uw5tnk")) {
34
- if (e.deltaY > 0) {
35
- e.target.closest("#component-153 > div.tab-nav.svelte-1uw5tnk").scrollLeft += 50;
36
- } else if (e.deltaY < 0) {
37
- e.target.closest("#component-153 > div.tab-nav.svelte-1uw5tnk").scrollLeft -= 50;
38
- }
39
- e.preDefault();
40
  }
41
- }
42
- }
 
43
 
44
- // Füge die Funktion zum Event-Listener hinzu
45
- //document.querySelector('.tab-nav').addEventListener('wheel', translateMouseWheel);
46
- document.addEventListener('wheel', translateMouseWheel);
 
 
 
 
47
 
48
- return "Custom Gradio JS"
49
  }
 
1
  function gradioCustomJS() {
2
  console.log("gradioCustomJS Started")
3
+
4
+ //component-15
5
+ const tabNav = document.querySelector("#component-153 > div.tab-nav.svelte-1uw5tnk")
6
+ tabNav.addEventListener("mouseover", () => {
7
+ tabNav.addEventListener("wheel", (event) => {
8
+ event.preventDefault()
9
+ let scrollLeft = 0
10
+ if (Math.sign(event.deltaY) < 0) {
11
+ scrollLeft = tabNav.scrollLeft - 20
12
+ }
13
+ if (Math.sign(event.deltaY) > 0) {
14
+ scrollLeft = tabNav.scrollLeft + 20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
16
+ tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
17
+ })
18
+ })
19
 
20
+ tabNav.addEventListener("mouseout", () => {
21
+ tabNav.removeEventListener("wheel", (event) => {
22
+ event.preventDefault()
23
+ const scrollLeft = tabNav.scrollLeft + 10
24
+ tabNav.scrollLeft = Math.max(0, Math.min(scrollLeft, tabNav.scrollWidth - tabNav.clientWidth))
25
+ })
26
+ })
27
 
28
+ return "Custom Gradio JS"
29
  }
photo-enhance.code-workspace ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "folders": [
3
+ {
4
+ "name": "ControlNet Preprocessors Only",
5
+ "path": "."
6
+ }
7
+ ],
8
+ "settings": {
9
+ "prettier.semi": false,
10
+ "gitdoc.enabled": false
11
+ }
12
+ }