marwanto606 commited on
Commit
8d47973
·
verified ·
1 Parent(s): 1748e13

Update app.py

Browse files

update document.querySelectorAll

Files changed (1) hide show
  1. app.py +26 -25
app.py CHANGED
@@ -47,31 +47,32 @@ with col2:
47
 
48
  # Inject JavaScript untuk notifikasi klik tombol copy
49
  st.markdown("""
50
- <script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  setTimeout(() => {
52
- const copyBtns = window.parent.document.querySelectorAll('[data-testid="stCopyButton"]');
53
- copyBtns.forEach(btn => {
54
- btn.addEventListener('click', () => {
55
- const notice = document.createElement("div");
56
- notice.innerText = "✅ Prompt copied to clipboard!";
57
- notice.style.position = "fixed";
58
- notice.style.bottom = "30px";
59
- notice.style.right = "30px";
60
- notice.style.backgroundColor = "#4CAF50";
61
- notice.style.color = "white";
62
- notice.style.padding = "10px 16px";
63
- notice.style.borderRadius = "8px";
64
- notice.style.boxShadow = "0 4px 6px rgba(0,0,0,0.2)";
65
- notice.style.zIndex = "9999";
66
- notice.style.fontSize = "14px";
67
- document.body.appendChild(notice);
68
- setTimeout(() => {
69
- notice.remove();
70
- }, 2000);
71
- });
72
- });
73
- }, 1000);
74
- </script>
75
- """, unsafe_allow_html=True)
76
  else:
77
  st.info("Please upload an image to generate a prompt.")
 
47
 
48
  # Inject JavaScript untuk notifikasi klik tombol copy
49
  st.markdown("""
50
+ <script>
51
+ setTimeout(() => {
52
+ const copyBtns = document.querySelectorAll('button[data-testid="stCopyButton"]');
53
+ copyBtns.forEach(btn => {
54
+ btn.addEventListener('click', () => {
55
+ const notice = document.createElement("div");
56
+ notice.innerText = "✅ Prompt copied to clipboard!";
57
+ notice.style.position = "fixed";
58
+ notice.style.bottom = "30px";
59
+ notice.style.right = "30px";
60
+ notice.style.backgroundColor = "#4CAF50";
61
+ notice.style.color = "white";
62
+ notice.style.padding = "10px 16px";
63
+ notice.style.borderRadius = "8px";
64
+ notice.style.boxShadow = "0 4px 6px rgba(0,0,0,0.2)";
65
+ notice.style.zIndex = "9999";
66
+ notice.style.fontSize = "14px";
67
+ document.body.appendChild(notice);
68
  setTimeout(() => {
69
+ notice.remove();
70
+ }, 2000);
71
+ });
72
+ });
73
+ }, 1000);
74
+ </script>
75
+ """, unsafe_allow_html=True)
76
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  else:
78
  st.info("Please upload an image to generate a prompt.")