OP Posted at 03-02-2025, 06:17 PM
(This post was last modified: 03-02-2025, 06:32 PM by Manfruity.)
Bump button tampermonkey script
Features
![[Image: ZlJgs4K.png]](https://patched.to/pbb-proxy/UUNCQ0JeTUoNGVgIBhBLGwVYDxhiXHNSQAcqHhZeUQ--/ZlJgs4K.png)
Features
- Custom bump message
const bumpMessage = "Bumping Bumping"; -> Change it to yours in the script
- Checks if it was bumped in the last 24 hours
- Checks if marketplace & its your thread
Script:
// ==UserScript==
// @name Patched.to Bump Button
// @namespace https://patched.to/User/manfruity
// @version 1.0
// @description Adds a bump button to Patched.to threads (Only in Marketplace & Own Threads, 24h Cooldown)
// @author Manfruity
// @Match https://patched.to/Thread-*
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Adjustable bump message
const bumpMessage = "Bumping Bumping"; // Change this if needed
const cooldownTime = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
const threadURL = window.location.href; // Unique thread identifier
function timeRemaining(lastBumpTime) {
const timePassed = Date.now() - lastBumpTime;
const timeLeft = cooldownTime - timePassed;
return timeLeft > 0 ? Math.ceil(timeLeft / (60 * 60 * 1000)) : 0; // Return hours left
}
function updateButtonState(bumpButton, lastBumpTime) {
const remainingHours = timeRemaining(lastBumpTime);
if (remainingHours > 0) {
bumpButton.style.background = "rgba(129,17,17,0.8)"; // Cooldown color
bumpButton.innerHTML = `<span><i class="fas fa-clock"></i> Bump again in ${remainingHours}h</span>`;
bumpButton.disabled = true;
} else {
bumpButton.style.background = "#6674DE"; // Default active color
bumpButton.innerHTML = `<span><i class="fas fa-arrow-up"></i> Bump</span>`;
bumpButton.disabled = false;
}
}
function insertBumpButton() {
// Ensure we are in the Marketplace
let marketplaceLink = document.querySelector('a.navLink[itemprop="item"][href="Forum-marketplace"]');
if (!marketplaceLink) return;
// Get logged-in username
let userProfile = document.querySelector('a[rel="profileDropdown"] span');
if (!userProfile) return;
let loggedInUsername = userProfile.textContent.trim();
// Get thread author
let threadAuthorElement = document.querySelector('.thread-info h2.author');
if (!threadAuthorElement) return;
let threadAuthor = threadAuthorElement.textContent.trim().match(/Submitted by (.+?) at/);
if (!threadAuthor || threadAuthor[1] !== loggedInUsername) return;
// Insert button only for the thread owner
let threadHeadRight = document.querySelector('.thread-head .right');
if (!threadHeadRight) return;
let bumpButton = document.createElement('a');
bumpButton.className = 'button';
bumpButton.style.display = 'inline-block';
bumpButton.style.marginLeft = '10px';
bumpButton.style.padding = '5px 15px';
bumpButton.style.color = 'white';
bumpButton.style.textDecoration = 'none';
bumpButton.style.borderRadius = '5px';
bumpButton.style.fontSize = '14px';
bumpButton.style.fontWeight = 'bold';
bumpButton.style.cursor = 'pointer';
let lastBumpTime = localStorage.getItem(`bumpTime_${threadURL}`) || 0;
updateButtonState(bumpButton, lastBumpTime);
bumpButton.addEventListener('click', function () {
if (timeRemaining(lastBumpTime) > 0) return; // Prevent early bump
let iframe = document.querySelector('.cke_wysiwyg_frame');
if (iframe) {
let iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
let editableBody = iframeDoc.querySelector('.cke_editable');
if (editableBody) {
editableBody.innerHTML = bumpMessage; // Insert bump message
localStorage.setItem(`bumpTime_${threadURL}`, Date.now()); // Save bump time
updateButtonState(bumpButton, Date.now()); // Update button UI
// Trigger the submit button click
let submitButton = document.querySelector('#quick_reply_submit');
if (submitButton) {
submitButton.click(); // Submit the reply
} else {
alert("Submit button not found!");
}
} else {
alert("Bump input field not found inside the iframe!");
}
} else {
alert("Editor iframe not found!");
}
});
threadHeadRight.appendChild(bumpButton);
// Auto-update the countdown every minute
setInterval(() => updateButtonState(bumpButton, localStorage.getItem(`bumpTime_${threadURL}`) || 0), 60000);
}
// Wait for the page to fully load
window.addEventListener('load', insertBumpButton);
})();
// @name Patched.to Bump Button
// @namespace https://patched.to/User/manfruity
// @version 1.0
// @description Adds a bump button to Patched.to threads (Only in Marketplace & Own Threads, 24h Cooldown)
// @author Manfruity
// @Match https://patched.to/Thread-*
// @grant none
// ==/UserScript==
(function () {
'use strict';
// Adjustable bump message
const bumpMessage = "Bumping Bumping"; // Change this if needed
const cooldownTime = 24 * 60 * 60 * 1000; // 24 hours in milliseconds
const threadURL = window.location.href; // Unique thread identifier
function timeRemaining(lastBumpTime) {
const timePassed = Date.now() - lastBumpTime;
const timeLeft = cooldownTime - timePassed;
return timeLeft > 0 ? Math.ceil(timeLeft / (60 * 60 * 1000)) : 0; // Return hours left
}
function updateButtonState(bumpButton, lastBumpTime) {
const remainingHours = timeRemaining(lastBumpTime);
if (remainingHours > 0) {
bumpButton.style.background = "rgba(129,17,17,0.8)"; // Cooldown color
bumpButton.innerHTML = `<span><i class="fas fa-clock"></i> Bump again in ${remainingHours}h</span>`;
bumpButton.disabled = true;
} else {
bumpButton.style.background = "#6674DE"; // Default active color
bumpButton.innerHTML = `<span><i class="fas fa-arrow-up"></i> Bump</span>`;
bumpButton.disabled = false;
}
}
function insertBumpButton() {
// Ensure we are in the Marketplace
let marketplaceLink = document.querySelector('a.navLink[itemprop="item"][href="Forum-marketplace"]');
if (!marketplaceLink) return;
// Get logged-in username
let userProfile = document.querySelector('a[rel="profileDropdown"] span');
if (!userProfile) return;
let loggedInUsername = userProfile.textContent.trim();
// Get thread author
let threadAuthorElement = document.querySelector('.thread-info h2.author');
if (!threadAuthorElement) return;
let threadAuthor = threadAuthorElement.textContent.trim().match(/Submitted by (.+?) at/);
if (!threadAuthor || threadAuthor[1] !== loggedInUsername) return;
// Insert button only for the thread owner
let threadHeadRight = document.querySelector('.thread-head .right');
if (!threadHeadRight) return;
let bumpButton = document.createElement('a');
bumpButton.className = 'button';
bumpButton.style.display = 'inline-block';
bumpButton.style.marginLeft = '10px';
bumpButton.style.padding = '5px 15px';
bumpButton.style.color = 'white';
bumpButton.style.textDecoration = 'none';
bumpButton.style.borderRadius = '5px';
bumpButton.style.fontSize = '14px';
bumpButton.style.fontWeight = 'bold';
bumpButton.style.cursor = 'pointer';
let lastBumpTime = localStorage.getItem(`bumpTime_${threadURL}`) || 0;
updateButtonState(bumpButton, lastBumpTime);
bumpButton.addEventListener('click', function () {
if (timeRemaining(lastBumpTime) > 0) return; // Prevent early bump
let iframe = document.querySelector('.cke_wysiwyg_frame');
if (iframe) {
let iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
let editableBody = iframeDoc.querySelector('.cke_editable');
if (editableBody) {
editableBody.innerHTML = bumpMessage; // Insert bump message
localStorage.setItem(`bumpTime_${threadURL}`, Date.now()); // Save bump time
updateButtonState(bumpButton, Date.now()); // Update button UI
// Trigger the submit button click
let submitButton = document.querySelector('#quick_reply_submit');
if (submitButton) {
submitButton.click(); // Submit the reply
} else {
alert("Submit button not found!");
}
} else {
alert("Bump input field not found inside the iframe!");
}
} else {
alert("Editor iframe not found!");
}
});
threadHeadRight.appendChild(bumpButton);
// Auto-update the countdown every minute
setInterval(() => updateButtonState(bumpButton, localStorage.getItem(`bumpTime_${threadURL}`) || 0), 60000);
}
// Wait for the page to fully load
window.addEventListener('load', insertBumpButton);
})();
![[Image: ZlJgs4K.png]](https://patched.to/pbb-proxy/UUNCQ0JeTUoNGVgIBhBLGwVYDxhiXHNSQAcqHhZeUQ--/ZlJgs4K.png)
![[Image: 9f4paub.png]](https://patched.to/pbb-proxy/UUNCQ0JeTUoNGVgIBhBLGwVYDxgBVg1FUkYDHhZeUQ--/9f4paub.png)
Reply