Skip to content

Commit cbe45c5

Browse files
committed
Remove unused copy tooltip from index.html and script.js; update star generation logic to only execute on non-mobile devices; improve error handling in clipboard copy function; clean up CSS by removing unnecessary comments and adding a new floating animation keyframe.
1 parent cae6256 commit cbe45c5

3 files changed

Lines changed: 18 additions & 10 deletions

File tree

index.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ <h3 class="example-title">Require Top Reviewer</h3>
168168
</p>
169169
</footer>
170170

171-
<div id="copyTooltip" class="tooltip hidden">Copied!</div>
172171

173172
<script src="stars.js"></script>
174173
<script src="script.js"></script>

script.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ const errorAlert = document.getElementById('errorAlert');
77
const errorMessage = document.getElementById('errorMessage');
88
const codeContent = document.getElementById('codeContent');
99
const copyBtn = document.getElementById('copyBtn');
10-
const copyTooltip = document.getElementById('copyTooltip');
1110
// showExamplesBtn removed - examples are now always visible
1211
const examplesGrid = document.getElementById('examplesGrid');
1312

@@ -22,7 +21,11 @@ const API_ENDPOINT = 'https://api.example.com/generate-rule';
2221
document.addEventListener('DOMContentLoaded', function() {
2322
initializeEventListeners();
2423
hideAllStates();
25-
generateRandomStars();
24+
25+
// Only generate stars on non-mobile devices
26+
if (window.innerWidth > 768) {
27+
generateRandomStars();
28+
}
2629
});
2730

2831
// Event Listeners
@@ -212,7 +215,11 @@ function fallbackCopyToClipboard(text) {
212215
textArea.select();
213216

214217
try {
215-
document.execCommand('copy');
218+
// Note: document.execCommand is deprecated but kept for compatibility
219+
const success = document.execCommand('copy');
220+
if (!success) {
221+
throw new Error('Copy command failed');
222+
}
216223
} catch (err) {
217224
console.error('Fallback copy failed:', err);
218225
}
@@ -328,7 +335,6 @@ document.addEventListener('DOMContentLoaded', function() {
328335
const exampleCards = document.querySelectorAll('.example-card');
329336
exampleCards.forEach(card => {
330337
card.addEventListener('click', function() {
331-
const title = this.querySelector('.example-title').textContent;
332338
const description = this.querySelector('.example-description').textContent;
333339

334340
// Populate the input with the example description

style.css

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,6 @@ body::before {
218218
animation-timing-function: ease-in-out;
219219
}
220220

221-
/* Generated stars will have their positioning set by JavaScript */
222-
223221
/* Card Components */
224222
.card {
225223
background: var(--bg-card);
@@ -1451,9 +1449,14 @@ body::before {
14511449

14521450

14531451
/* Decoration Animations */
1454-
1455-
1456-
1452+
@keyframes float {
1453+
0%, 100% {
1454+
transform: translateY(0px);
1455+
}
1456+
50% {
1457+
transform: translateY(-8px);
1458+
}
1459+
}
14571460

14581461
@keyframes gentleFloat2 {
14591462
0%, 100% { transform: translateY(0px); }

0 commit comments

Comments
 (0)