Skip to content

Commit 4a7b00b

Browse files
committed
Remove debug
1 parent 5f1135c commit 4a7b00b

File tree

1 file changed

+1
-22
lines changed

1 file changed

+1
-22
lines changed

app/views/papers/_vote_summary.html.erb

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,62 +32,47 @@
3232
<script>
3333
(function() {
3434
try {
35-
console.log('Script starting - checking localStorage availability');
3635
if (!window.localStorage) {
3736
console.error('localStorage is not available in this browser');
3837
return;
3938
}
4039

41-
// Function to initialize the storage functionality
4240
function initializeStorage() {
43-
console.log('Initializing storage functionality');
44-
4541
const commentField = document.getElementById('vote-comment');
4642
if (!commentField) {
4743
console.error('Could not find comment field with ID vote-comment');
4844
return;
4945
}
50-
console.log('Comment field found:', commentField);
5146

5247
const paperId = commentField.dataset.paperId;
5348
if (!paperId) {
5449
console.error('No paper ID found in data attributes');
5550
return;
5651
}
57-
console.log('Paper ID:', paperId);
5852

5953
const storageKey = `vote_comment_${paperId}`;
60-
console.log('Storage key:', storageKey);
6154

62-
// Load saved comment if it exists
6355
try {
6456
const savedComment = localStorage.getItem(storageKey);
65-
console.log('Saved comment from storage:', savedComment);
66-
6757
if (savedComment) {
6858
commentField.value = savedComment;
69-
console.log('Restored comment from storage');
7059
}
7160
} catch (e) {
7261
console.error('Error accessing localStorage:', e);
7362
}
7463

75-
// Save comment on input
7664
commentField.addEventListener('input', function() {
7765
try {
78-
console.log('Input detected, saving comment:', this.value);
7966
localStorage.setItem(storageKey, this.value);
8067
} catch (e) {
8168
console.error('Error saving to localStorage:', e);
8269
}
8370
});
8471

85-
// Clear storage when form is submitted
8672
const form = commentField.closest('form');
8773
if (form) {
8874
form.addEventListener('submit', function() {
8975
try {
90-
console.log('Form submitted, clearing storage');
9176
localStorage.removeItem(storageKey);
9277
} catch (e) {
9378
console.error('Error clearing localStorage:', e);
@@ -98,17 +83,11 @@
9883
}
9984
}
10085

101-
// Try to initialize immediately if DOM is already loaded
10286
if (document.readyState === 'complete' || document.readyState === 'interactive') {
103-
console.log('DOM already loaded, initializing immediately');
10487
initializeStorage();
10588
}
10689

107-
// Also set up the DOMContentLoaded listener as a backup
108-
document.addEventListener('DOMContentLoaded', function() {
109-
console.log('DOM Content Loaded event fired');
110-
initializeStorage();
111-
});
90+
document.addEventListener('DOMContentLoaded', initializeStorage);
11291

11392
} catch (e) {
11493
console.error('Error in vote comment storage script:', e);

0 commit comments

Comments
 (0)