can you get it to make a tampermonkey compatable userscript.js to tag users/members on xenforo forum similar to reddit enhancement suite tagging feature?
Asked it exactly that.....
Sure! Here's a Tampermonkey-compatible userscript that allows you to tag users on a XenForo forum similarly to the Reddit Enhancement Suite tagging feature. This script will let you add tags next to usernames and store them locally in your browser.
To use this script:// ==UserScript==
// @name XenForo User Tagging
// @namespace Home | Tampermonkey
// @version 1.0
// @description Add tags to users in XenForo forums
// @author ChatGPT
// @match https://*/*
// @match http://*/*
// @grant GM_getValue
// @grant GM_setValue
// ==/UserScript==
(function() {
'use strict';
function getTags() {
const tags = JSON.parse(GM_getValue('xenforoUserTags', '{}'));
return tags;
}
function setTags(tags) {
GM_setValue('xenforoUserTags', JSON.stringify(tags));
}
function updateTag(username, tag) {
const tags = getTags();
tags[username] = tag;
setTags(tags);
}
function addTagToUser(element, tag) {
const tagElement = document.createElement('span');
tagElement.textContent = `[${tag}] `;
tagElement.style.color = '#0079d3';
element.prepend(tagElement);
}
function addTagInput(element, username) {
const input = document.createElement('input');
input.type = 'text';
input.placeholder = 'Add tag';
input.value = getTags()[username] || '';
input.style.width = '100px';
input.style.marginLeft = '5px';
input.addEventListener('change', () => {
updateTag(username, input.value);
location.reload();
});
element.appendChild(input);
}
function processUserElement(element) {
const username = element.textContent.trim();
const tag = getTags()[username];
if (tag) {
addTagToUser(element, tag);
}
addTagInput(element, username);
}
function processXenForoUsers() {
const userElements = document.querySelectorAll('.username');
userElements.forEach(processUserElement);
}
// Check if the current site is a XenForo forum
if (document.querySelector('html[data-app="public"][data-template="forum_list"]')) {
processXenForoUsers();
}
})();
- Install the Tampermonkey browser extension if you haven't already.
- Open the Tampermonkey dashboard and click on the "Create a new script" button.
- Replace the default content with the userscript provided above.
- Save the script (Ctrl+S or Command+S) and make sure it's enabled in Tampermonkey.
- Visit a XenForo forum, and you should see an input box next to usernames where you can add tags.