Skip to content

Commit 667ce19

Browse files
authored
Update ai-test.html
1 parent bf45410 commit 667ce19

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

src/ai-test.html

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,72 @@ <h4 style="font-size: 18px; margin: 0; color: #c0c0ff;">🤖 Forum AI: ChatGPT A
3737
</body>
3838
</html>
3939

40+
<style>
41+
/* Floating Button Styles */
42+
#floatingButton {
43+
position: fixed;
44+
bottom: 20px;
45+
right: 20px;
46+
background-color: #007bff;
47+
color: white;
48+
border: none;
49+
padding: 15px 20px;
50+
border-radius: 5px;
51+
cursor: pointer;
52+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
53+
z-index: 1000; /* Ensure it's above other elements */
54+
}
55+
56+
#floatingButton:hover {
57+
background-color: #0056b3;
58+
}
59+
60+
/* Widget Styles */
61+
.widget {
62+
position: fixed;
63+
bottom: 80px; /* Adjust based on button position and desired spacing */
64+
right: 20px;
65+
background-color: white;
66+
border: 1px solid #ccc;
67+
border-radius: 5px;
68+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
69+
z-index: 999; /* Ensure it's below the button if you want the button always on top */
70+
width: 300px; /* Adjust as needed */
71+
max-height: 400px; /* Optional: for scrollable content */
72+
overflow-y: auto; /* Optional: for scrollable content */
73+
display: none; /* Initially hidden */
74+
}
75+
76+
.widget-header {
77+
background-color: #f0f0f0;
78+
padding: 10px;
79+
border-bottom: 1px solid #ddd;
80+
display: flex;
81+
justify-content: space-between;
82+
align-items: center;
83+
border-top-left-radius: 5px;
84+
border-top-right-radius: 5px;
85+
}
86+
87+
.widget-header h3 {
88+
margin: 0;
89+
font-size: 1.2em;
90+
}
91+
92+
#closeWidgetButton {
93+
background: none;
94+
border: none;
95+
font-size: 1.5em;
96+
cursor: pointer;
97+
padding: 0;
98+
line-height: 1;
99+
}
100+
101+
.widget-content {
102+
padding: 15px;
103+
}
104+
</style>
105+
40106
<script>
41107
const apiKey = "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"; // Your provided API key
42108

@@ -74,3 +140,26 @@ <h4 style="font-size: 18px; margin: 0; color: #c0c0ff;">🤖 Forum AI: ChatGPT A
74140
document.getElementById("responseContent").textContent = "Oops, something went wrong!";
75141
}
76142
});
143+
144+
document.addEventListener('DOMContentLoaded', function() {
145+
const floatingButton = document.getElementById('floatingButton');
146+
const widgetContainer = document.getElementById('widgetContainer');
147+
const closeWidgetButton = document.getElementById('closeWidgetButton');
148+
149+
floatingButton.addEventListener('click', function() {
150+
widgetContainer.style.display = 'block'; // Show the widget
151+
});
152+
153+
closeWidgetButton.addEventListener('click', function() {
154+
widgetContainer.style.display = 'none'; // Hide the widget
155+
});
156+
157+
// Optional: Close the widget if the user clicks outside of it
158+
window.addEventListener('click', function(event) {
159+
if (event.target === widgetContainer) {
160+
widgetContainer.style.display = 'none';
161+
}
162+
});
163+
});
164+
165+
</script>

0 commit comments

Comments
 (0)