Hide Buy/Sell listings from blocked sellers with UI to manage block list on lostcity.markets pages (top-left buttons, uniform size)
当前为
// ==UserScript==
// @name LostCity Markets: Block/Unblock Seller Listings
// @namespace http://tampermonkey.net/
// @version 2.2
// @description Hide Buy/Sell listings from blocked sellers with UI to manage block list on lostcity.markets pages (top-left buttons, uniform size)
// @author Zarotrox
// @match https://lostcity.markets/*
// @grant none
// @icon https://i.ibb.co/44SS6xZ/Zarotrox.png
// @license MIT
// ==/UserScript==
(function () {
'use strict';
const STORAGE_KEY = 'blockedSellersList';
function getBlockedSellers() {
const stored = localStorage.getItem(STORAGE_KEY);
return stored ? JSON.parse(stored) : [];
}
function saveBlockedSellers(list) {
localStorage.setItem(STORAGE_KEY, JSON.stringify(list));
}
function hideListings() {
const blockedSellers = getBlockedSellers();
const rows = document.querySelectorAll('tr');
rows.forEach(row => {
const sellerLink = row.querySelector('a[href^="/users/"]');
if (sellerLink) {
const sellerName = sellerLink.textContent.trim();
if (blockedSellers.includes(sellerName)) {
row.style.display = 'none';
}
}
});
}
function createButton(label, onClick, offsetY) {
const button = document.createElement('button');
button.textContent = label;
Object.assign(button.style, {
position: 'fixed',
top: `${offsetY}px`,
left: '20px',
zIndex: 10000,
width: '140px',
height: '40px',
padding: '8px',
backgroundColor: '#222',
color: '#fff',
border: 'none',
borderRadius: '6px',
cursor: 'pointer',
fontSize: '14px',
boxShadow: '0 2px 6px rgba(0,0,0,0.3)',
textAlign: 'center'
});
button.addEventListener('click', onClick);
document.body.appendChild(button);
}
function addBlockButton() {
createButton('🔕 Block Seller', () => {
const name = prompt('Enter seller name to block:');
if (name) {
const list = getBlockedSellers();
if (!list.includes(name)) {
list.push(name);
saveBlockedSellers(list);
hideListings();
alert(`Seller "${name}" has been blocked.`);
} else {
alert(`Seller "${name}" is already blocked.`);
}
}
}, 20);
}
function addUnblockButton() {
createButton('✅ Unblock Seller', () => {
const list = getBlockedSellers();
if (list.length === 0) {
alert('Your block list is empty.');
return;
}
const name = prompt(`Blocked sellers:\n${list.join(', ')}\n\nEnter seller name to unblock:`);
if (name && list.includes(name)) {
const updated = list.filter(s => s !== name);
saveBlockedSellers(updated);
alert(`Seller "${name}" has been unblocked.`);
location.reload(); // Refresh to show unblocked listings
} else if (name) {
alert(`Seller "${name}" is not in your block list.`);
}
}, 70);
}
// Initialize
hideListings();
addBlockButton();
addUnblockButton();
const observer = new MutationObserver(hideListings);
observer.observe(document.body, { childList: true, subtree: true });
})();
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址