Skip to content

Commit 8cb777c

Browse files
authored
Update unity-forum-fixer.js
remove Pinned messages fix (forum is fixed)
1 parent b20580e commit 8cb777c

File tree

1 file changed

+1
-68
lines changed

1 file changed

+1
-68
lines changed

unity-forum-fixer.js

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// ==UserScript==
22
// @name UnityForumFixer
33
// @namespace https://unitycoder.com/
4-
// @version 0.82 (27.01.2025)
4+
// @version 0.83 (31.01.2025)
55
// @description Fixes For Unity Forums - https://github.com/unitycoder/UnityForumFixer
66
// @author unitycoder.com
77
// @match https://discussions.unity.com/latest
@@ -26,7 +26,6 @@
2626
TopicsViewCombineViewAndReplyCounts();
2727
OnMouseOverPostPreview();
2828
AddOnHoverOpenNotificationPanel();
29-
FixPinButton();
3029

3130

3231
// update notification panel icons
@@ -678,72 +677,6 @@ function AddOnHoverOpenNotificationPanel() {
678677
}
679678

680679

681-
function FixPinButton() {
682-
// Select all buttons with the .topic-status class
683-
const buttons = document.querySelectorAll('.topic-statuses .topic-status');
684-
685-
// Get the CSRF token from the meta tags in the page head
686-
const csrfToken = document.querySelector('meta[name="csrf-token"]')?.content;
687-
688-
// Check if the CSRF token is available
689-
if (!csrfToken) {
690-
console.error('CSRF token not found');
691-
return;
692-
}
693-
694-
if (buttons.length > 0) {
695-
buttons.forEach((button) => {
696-
// Add a click event listener to each button
697-
button.addEventListener('click', function (event) {
698-
event.preventDefault(); // Prevent the default link behavior
699-
700-
// Find the post ID by looking for the nearest <a> tag with a valid href
701-
const postLink = button.closest('td').querySelector('a.title');
702-
const postId = postLink?.getAttribute('data-topic-id');
703-
704-
if (!postId) {
705-
console.error('Post ID not found for this button');
706-
return;
707-
}
708-
709-
console.log('Post ID:', postId); // Debug log to confirm the ID
710-
711-
// Construct the PUT request URL using the extracted ID
712-
const url = `https://discussions.unity.com/t/${postId}/clear-pin`;
713-
714-
// Send a PUT request with the CSRF token
715-
$.ajax({
716-
url: url,
717-
type: 'PUT',
718-
headers: {
719-
'X-CSRF-Token': csrfToken, // Include the CSRF token
720-
},
721-
success: function (response) {
722-
console.log('PUT request successful:', response);
723-
724-
// Hide the parent row of the clicked button
725-
const parentRow = button.closest('tr');
726-
if (parentRow) {
727-
parentRow.style.display = 'none'; // Hides the row
728-
console.log(`Row with Post ID ${postId} hidden.`);
729-
} else {
730-
console.error('Parent row not found.');
731-
}
732-
},
733-
error: function (xhr, status, error) {
734-
console.error('XHR Status:', xhr.status);
735-
console.error('XHR Response Text:', xhr.responseText);
736-
console.error('Error:', error || 'Unknown error');
737-
alert('Error sending request.');
738-
},
739-
});
740-
});
741-
});
742-
} else {
743-
console.error('No notification buttons found.');
744-
}
745-
}
746-
747680

748681

749682
// HELPER METHODS

0 commit comments

Comments
 (0)