Adds a second "rename this group" button inside the group form on Chicken Smoothie
当前为
// ==UserScript==
// @name Chicken Smoothie: Add Rename Group Button
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Adds a second "rename this group" button inside the group form on Chicken Smoothie
// @author You
// @match https://www.chickensmoothie.com/accounts/viewgroup.php?*
// @grant none
// ==/UserScript==
(function() {
'use strict';
// Wait for the page to load completely
window.addEventListener('load', function() {
// Find the form element where the group dropdown is located
const groupForm = document.querySelector('form[name="gotogroup"]'); // Select the form by name attribute
if (groupForm) {
// Create a new "Rename Group" button
const renameButton = document.createElement('button');
renameButton.textContent = 'Rename This Group';
renameButton.style.marginLeft = '10px'; // Space out from other form elements
renameButton.style.padding = '5px 10px';
renameButton.style.cursor = 'pointer';
renameButton.style.backgroundColor = '#4CAF50'; // Green background
renameButton.style.color = 'white';
renameButton.style.border = 'none';
renameButton.style.borderRadius = '5px';
// Event listener for the "Rename" button
renameButton.addEventListener('click', function() {
// Trigger renaming behavior (you can adjust this as needed)
alert('This would be the renaming functionality.');
// Replace this alert with your renaming logic, such as a prompt or form.
});
// Append the new button inside the form, after the group dropdown
groupForm.appendChild(renameButton);
} else {
console.log('Could not find the form element on the page.');
}
});
})();